diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/bindings/test | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/bindings/test')
-rw-r--r-- | dom/bindings/test/TestBindingHeader.h | 65 | ||||
-rw-r--r-- | dom/bindings/test/TestCodeGen.webidl | 18 | ||||
-rw-r--r-- | dom/bindings/test/TestExampleGen.webidl | 5 | ||||
-rw-r--r-- | dom/bindings/test/test_dom_xrays.html | 23 |
4 files changed, 81 insertions, 30 deletions
diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index 77053d9ba6..2e8c496758 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -131,29 +131,6 @@ class TestInterface : public nsISupports, public nsWrapperCache { JS::Handle<JS::Value>, const Optional<JS::Handle<JSObject*>>&, const Optional<JS::Handle<JSObject*>>&, ErrorResult&); - static already_AddRefed<TestInterface> Test3(const GlobalObject&, - const LongOrStringAnyRecord&, - ErrorResult&); - - static already_AddRefed<TestInterface> Test4( - const GlobalObject&, const Record<nsString, Record<nsString, JS::Value>>&, - ErrorResult&); - - static already_AddRefed<TestInterface> Test5( - const GlobalObject&, - const Record< - nsString, - Sequence<Record<nsString, - Record<nsString, Sequence<Sequence<JS::Value>>>>>>&, - ErrorResult&); - - static already_AddRefed<TestInterface> Test6( - const GlobalObject&, - const Sequence<Record< - nsCString, - Sequence<Sequence<Record<nsCString, Record<nsString, JS::Value>>>>>>&, - ErrorResult&); - // Integer types int8_t ReadonlyByte(); int8_t WritableByte(); @@ -1394,6 +1371,48 @@ class TestInterface : public nsISupports, public nsWrapperCache { void PassString(OwningNonNull<nsAString>&) = delete; }; +class TestLegacyFactoryFunctionInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + // And now our actual WebIDL API + static already_AddRefed<TestLegacyFactoryFunctionInterface> Test3( + const GlobalObject&, const LongOrStringAnyRecord&, ErrorResult&); + + static already_AddRefed<TestLegacyFactoryFunctionInterface> Test4( + const GlobalObject&, const Record<nsString, Record<nsString, JS::Value>>&, + ErrorResult&); +}; + +class TestLegacyFactoryFunctionInterface2 : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + // And now our actual WebIDL API + static already_AddRefed<TestLegacyFactoryFunctionInterface2> Test5( + const GlobalObject&, + const Record< + nsString, + Sequence<Record<nsString, + Record<nsString, Sequence<Sequence<JS::Value>>>>>>&, + ErrorResult&); + + static already_AddRefed<TestLegacyFactoryFunctionInterface2> Test6( + const GlobalObject&, + const Sequence<Record< + nsCString, + Sequence<Sequence<Record<nsCString, Record<nsString, JS::Value>>>>>>&, + ErrorResult&); +}; + class TestIndexedGetterInterface : public nsISupports, public nsWrapperCache { public: NS_DECL_ISUPPORTS diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index 827d9c35a7..0d186cd682 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -162,10 +162,6 @@ enum OnlyForUseInInnerUnion { LegacyFactoryFunction=Test2(DictForConstructor dict, any any1, object obj1, object? obj2, sequence<Dict> seq, optional any any2, optional object obj3, optional object? obj4), - LegacyFactoryFunction=Test3((long or record<DOMString, any>) arg1), - LegacyFactoryFunction=Test4(record<DOMString, record<DOMString, any>> arg1), - LegacyFactoryFunction=Test5(record<DOMString, sequence<record<DOMString, record<DOMString, sequence<sequence<any>>>>>> arg1), - LegacyFactoryFunction=Test6(sequence<record<ByteString, sequence<sequence<record<ByteString, record<USVString, any>>>>>> arg1), Exposed=Window] interface TestInterface { constructor(); @@ -1087,7 +1083,19 @@ interface TestInterface { undefined passUnionArrayBuffer((DOMString or ArrayBuffer) foo); undefined passUnionAllowSharedArrayBuffer((DOMString or [AllowShared] ArrayBuffer) foo); - // If you add things here, add them to TestExampleGen and TestJSImplGen as well + // If you add things here, add them to TestExampleGen as well +}; + +[LegacyFactoryFunction=Test3((long or record<DOMString, any>) arg1), + LegacyFactoryFunction=Test4(record<DOMString, record<DOMString, any>> arg1), + Exposed=Window] +interface TestLegacyFactoryFunctionInterface { +}; + +[LegacyFactoryFunction=Test5(record<DOMString, sequence<record<DOMString, record<DOMString, sequence<sequence<any>>>>>> arg1), + LegacyFactoryFunction=Test6(sequence<record<ByteString, sequence<sequence<record<ByteString, record<USVString, any>>>>>> arg1), + Exposed=Window] +interface TestLegacyFactoryFunctionInterface2 { }; [Exposed=Window] diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index 3d90e2bf9b..65e9840cec 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -870,7 +870,10 @@ interface TestExampleInterface { undefined passUnionArrayBuffer((DOMString or ArrayBuffer) foo); undefined passUnionAllowSharedArrayBuffer((DOMString or [AllowShared] ArrayBuffer) foo); - // If you add things here, add them to TestCodeGen and TestJSImplGen as well + // If you add things here, add them to TestExampleGen. If they need to be + // supported in JS-implemented WebIDL then you need to add them to + // TestJSImplGen as well, if they are not supported in JS-implemented WebIDL + // then the codegen should throw for that specific case. }; [Exposed=Window] diff --git a/dom/bindings/test/test_dom_xrays.html b/dom/bindings/test/test_dom_xrays.html index 6d65ab7315..eafa0c632c 100644 --- a/dom/bindings/test/test_dom_xrays.html +++ b/dom/bindings/test/test_dom_xrays.html @@ -176,6 +176,27 @@ function test() { // ECMAScript-defined properties live on the prototype, overriding any named properties. checkXrayProperty(coll, "toString", [ undefined, undefined, win.Object.prototype.toString ]); + // Constructors + img = new win.Image(); + ok(win.HTMLImageElement.isInstance(img), "Constructor created the right type of object"); + + let threw; + try { + threw = false; + win.Image(); + } catch (e) { + threw = true; + } + ok(threw, "Constructors should throw when called without new"); + + try { + threw = false; + new win.Node(); + } catch (e) { + threw = true; + } + ok(threw, "Constructing an interface without a constructor should throw"); + // Frozen arrays should come from our compartment, not the target one. var languages1 = win.navigator.languages; isnot(languages1, undefined, "Must have .languages"); @@ -358,7 +379,7 @@ function test() { // legacyCaller should work. ok(win.HTMLAllCollection.isInstance(doc.all), "HTMLDocument.all should be an instance of HTMLAllCollection"); - let element, threw; + let element; try { threw = false; element = doc.all(0); |