From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- dom/tests/mochitest/webcomponents/chrome.ini | 17 + dom/tests/mochitest/webcomponents/dummy_page.html | 10 + dom/tests/mochitest/webcomponents/head.js | 26 ++ .../htmlconstructor_autonomous_tests.js | 107 +++++ .../webcomponents/htmlconstructor_builtin_tests.js | 282 ++++++++++++++ dom/tests/mochitest/webcomponents/inert_style.css | 10 + dom/tests/mochitest/webcomponents/mochitest.ini | 50 +++ .../mochitest/webcomponents/test_bug1017896.html | 32 ++ .../mochitest/webcomponents/test_bug1269155.html | 95 +++++ .../mochitest/webcomponents/test_bug1276240.html | 44 +++ .../mochitest/webcomponents/test_bug900724.html | 32 ++ .../test_custom_element_callback_innerhtml.html | 43 ++ .../webcomponents/test_custom_element_define.html | 129 ++++++ .../test_custom_element_define_parser.html | 61 +++ .../test_custom_element_ensure_custom_element.html | 55 +++ .../webcomponents/test_custom_element_get.html | 31 ++ .../test_custom_element_htmlconstructor.html | 42 ++ ...test_custom_element_htmlconstructor_chrome.html | 40 ++ .../test_custom_element_in_shadow.html | 129 ++++++ .../test_custom_element_lifecycle.html | 432 +++++++++++++++++++++ .../test_custom_element_namespace.html | 95 +++++ .../test_custom_element_namespace.xhtml | 104 +++++ ...stom_element_set_element_creation_callback.html | 159 ++++++++ .../webcomponents/test_custom_element_stack.html | 138 +++++++ .../test_custom_element_template.html | 33 ++ ..._element_throw_on_dynamic_markup_insertion.html | 66 ++++ .../test_custom_element_uncatchable_exception.html | 37 ++ .../webcomponents/test_custom_element_upgrade.html | 41 ++ .../test_custom_element_upgrade_chrome.html | 43 ++ .../test_custom_element_when_defined.html | 140 +++++++ .../webcomponents/test_detached_style.html | 35 ++ .../webcomponents/test_document_adoptnode.html | 42 ++ .../webcomponents/test_document_importnode.html | 42 ++ .../webcomponents/test_event_composed.html | 72 ++++ .../webcomponents/test_event_retarget.html | 153 ++++++++ .../webcomponents/test_event_stopping.html | 174 +++++++++ .../webcomponents/test_link_prefetch.html | 110 ++++++ .../test_shadowdom_active_pseudo_class.html | 62 +++ .../webcomponents/test_shadowdom_ime.html | 59 +++ .../mochitest/webcomponents/test_shadowroot.html | 77 ++++ .../webcomponents/test_shadowroot_clonenode.html | 46 +++ .../test_shadowroot_inert_element.html | 30 ++ .../webcomponents/test_shadowroot_style.html | 85 ++++ .../webcomponents/test_shadowroot_style_order.html | 52 +++ .../webcomponents/test_style_fallback_content.html | 39 ++ .../mochitest/webcomponents/test_template.html | 153 ++++++++ .../webcomponents/test_template_xhtml.html | 46 +++ .../mochitest/webcomponents/test_upgrade_page.html | 11 + .../webcomponents/test_xul_custom_element.xhtml | 386 ++++++++++++++++++ .../test_xul_shadowdom_accesskey.xhtml | 60 +++ dom/tests/mochitest/webcomponents/upgrade_tests.js | 128 ++++++ 51 files changed, 4385 insertions(+) create mode 100644 dom/tests/mochitest/webcomponents/chrome.ini create mode 100644 dom/tests/mochitest/webcomponents/dummy_page.html create mode 100644 dom/tests/mochitest/webcomponents/head.js create mode 100644 dom/tests/mochitest/webcomponents/htmlconstructor_autonomous_tests.js create mode 100644 dom/tests/mochitest/webcomponents/htmlconstructor_builtin_tests.js create mode 100644 dom/tests/mochitest/webcomponents/inert_style.css create mode 100644 dom/tests/mochitest/webcomponents/mochitest.ini create mode 100644 dom/tests/mochitest/webcomponents/test_bug1017896.html create mode 100644 dom/tests/mochitest/webcomponents/test_bug1269155.html create mode 100644 dom/tests/mochitest/webcomponents/test_bug1276240.html create mode 100644 dom/tests/mochitest/webcomponents/test_bug900724.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_define.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_define_parser.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_get.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor_chrome.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_lifecycle.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_namespace.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_namespace.xhtml create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_set_element_creation_callback.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_stack.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_template.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_throw_on_dynamic_markup_insertion.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_uncatchable_exception.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_upgrade.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_upgrade_chrome.html create mode 100644 dom/tests/mochitest/webcomponents/test_custom_element_when_defined.html create mode 100644 dom/tests/mochitest/webcomponents/test_detached_style.html create mode 100644 dom/tests/mochitest/webcomponents/test_document_adoptnode.html create mode 100644 dom/tests/mochitest/webcomponents/test_document_importnode.html create mode 100644 dom/tests/mochitest/webcomponents/test_event_composed.html create mode 100644 dom/tests/mochitest/webcomponents/test_event_retarget.html create mode 100644 dom/tests/mochitest/webcomponents/test_event_stopping.html create mode 100644 dom/tests/mochitest/webcomponents/test_link_prefetch.html create mode 100644 dom/tests/mochitest/webcomponents/test_shadowdom_active_pseudo_class.html create mode 100644 dom/tests/mochitest/webcomponents/test_shadowdom_ime.html create mode 100644 dom/tests/mochitest/webcomponents/test_shadowroot.html create mode 100644 dom/tests/mochitest/webcomponents/test_shadowroot_clonenode.html create mode 100644 dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html create mode 100644 dom/tests/mochitest/webcomponents/test_shadowroot_style.html create mode 100644 dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html create mode 100644 dom/tests/mochitest/webcomponents/test_style_fallback_content.html create mode 100644 dom/tests/mochitest/webcomponents/test_template.html create mode 100644 dom/tests/mochitest/webcomponents/test_template_xhtml.html create mode 100644 dom/tests/mochitest/webcomponents/test_upgrade_page.html create mode 100644 dom/tests/mochitest/webcomponents/test_xul_custom_element.xhtml create mode 100644 dom/tests/mochitest/webcomponents/test_xul_shadowdom_accesskey.xhtml create mode 100644 dom/tests/mochitest/webcomponents/upgrade_tests.js (limited to 'dom/tests/mochitest/webcomponents') diff --git a/dom/tests/mochitest/webcomponents/chrome.ini b/dom/tests/mochitest/webcomponents/chrome.ini new file mode 100644 index 0000000000..8f54af95e3 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/chrome.ini @@ -0,0 +1,17 @@ +[DEFAULT] +support-files = + dummy_page.html + +[test_custom_element_ensure_custom_element.html] +[test_custom_element_htmlconstructor_chrome.html] +support-files = + htmlconstructor_autonomous_tests.js + htmlconstructor_builtin_tests.js +[test_custom_element_namespace.html] +[test_custom_element_namespace.xhtml] +[test_custom_element_upgrade_chrome.html] +support-files = + test_upgrade_page.html + upgrade_tests.js +[test_xul_custom_element.xhtml] +[test_xul_shadowdom_accesskey.xhtml] diff --git a/dom/tests/mochitest/webcomponents/dummy_page.html b/dom/tests/mochitest/webcomponents/dummy_page.html new file mode 100644 index 0000000000..fd238954c6 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/dummy_page.html @@ -0,0 +1,10 @@ + + + +Dummy test page + + + +

Dummy test page

+ + diff --git a/dom/tests/mochitest/webcomponents/head.js b/dom/tests/mochitest/webcomponents/head.js new file mode 100644 index 0000000000..23c91d63be --- /dev/null +++ b/dom/tests/mochitest/webcomponents/head.js @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +/** + * Loads an iframe. + * + * @return {Promise} promise that resolves when iframe is loaded. + */ +function createIframe(aSrcDoc) { + return new Promise(function (aResolve, aReject) { + let iframe = document.createElement("iframe"); + iframe.onload = function () { + aResolve(iframe.contentDocument); + }; + iframe.onerror = function () { + aReject("Failed to load iframe"); + }; + if (aSrcDoc) { + iframe.srcdoc = aSrcDoc; + } + document.body.appendChild(iframe); + }); +} diff --git a/dom/tests/mochitest/webcomponents/htmlconstructor_autonomous_tests.js b/dom/tests/mochitest/webcomponents/htmlconstructor_autonomous_tests.js new file mode 100644 index 0000000000..75b42389cc --- /dev/null +++ b/dom/tests/mochitest/webcomponents/htmlconstructor_autonomous_tests.js @@ -0,0 +1,107 @@ +promises.push( + test_with_new_window(testWindow => { + // Test calling the HTMLElement constructor. + (() => { + SimpleTest.doesThrow(() => { + testWindow.HTMLElement(); + }, "calling the HTMLElement constructor should throw a TypeError"); + })(); + + // Test constructing a HTMLELement. + (() => { + SimpleTest.doesThrow(() => { + new testWindow.HTMLElement(); + }, "constructing a HTMLElement should throw a TypeError"); + })(); + + // Test constructing a custom element with defining HTMLElement as entry. + (() => { + testWindow.customElements.define( + "x-defining-html-element", + testWindow.HTMLElement + ); + SimpleTest.doesThrow(() => { + new testWindow.HTMLElement(); + }, "constructing a custom element with defining HTMLElement as registry " + "entry should throw a TypeError"); + })(); + + // Test calling a custom element constructor and constructing an autonomous + // custom element. + (() => { + let num_constructor_invocations = 0; + class X extends testWindow.HTMLElement { + constructor() { + super(); + num_constructor_invocations++; + } + } + testWindow.customElements.define("x-element", X); + SimpleTest.doesThrow(() => { + X(); + }, "calling an autonomous custom element constructor should throw a TypeError"); + + let element = new X(); + SimpleTest.is( + Object.getPrototypeOf(Cu.waiveXrays(element)), + X.prototype, + "constructing an autonomous custom element; " + + "the element should be a registered constructor" + ); + SimpleTest.is( + element.localName, + "x-element", + "constructing an autonomous custom element; " + + 'the element tag name should be "x-element"' + ); + SimpleTest.is( + element.namespaceURI, + "http://www.w3.org/1999/xhtml", + "constructing an autonomous custom element; " + + "the element should be in the HTML namespace" + ); + SimpleTest.is( + element.prefix, + null, + "constructing an autonomous custom element; " + + "the element name should not have a prefix" + ); + SimpleTest.is( + element.ownerDocument, + testWindow.document, + "constructing an autonomous custom element; " + + "the element should be owned by the registry's associated " + + "document" + ); + SimpleTest.is( + num_constructor_invocations, + 1, + "constructing an autonomous custom element; " + + "the constructor should have been invoked once" + ); + })(); + + // Test if prototype is no an object. + (() => { + function ElementWithNonObjectPrototype() { + let o = Reflect.construct(testWindow.HTMLElement, [], new.target); + SimpleTest.is( + Object.getPrototypeOf(Cu.waiveXrays(o)), + window.HTMLElement.prototype, + "constructing an autonomous custom element; " + + "if prototype is not object, fallback from NewTarget's realm" + ); + } + + // Prototype have to be an object during define(), otherwise define will + // throw an TypeError exception. + ElementWithNonObjectPrototype.prototype = {}; + testWindow.customElements.define( + "x-non-object-prototype", + ElementWithNonObjectPrototype + ); + + ElementWithNonObjectPrototype.prototype = "string"; + new ElementWithNonObjectPrototype(); + })(); + }) +); diff --git a/dom/tests/mochitest/webcomponents/htmlconstructor_builtin_tests.js b/dom/tests/mochitest/webcomponents/htmlconstructor_builtin_tests.js new file mode 100644 index 0000000000..0b72ca3f7a --- /dev/null +++ b/dom/tests/mochitest/webcomponents/htmlconstructor_builtin_tests.js @@ -0,0 +1,282 @@ +[ + // [TagName, InterfaceName] + ["a", "Anchor"], + ["abbr", ""], + ["acronym", ""], + ["address", ""], + ["area", "Area"], + ["article", ""], + ["aside", ""], + ["audio", "Audio"], + ["b", ""], + ["base", "Base"], + ["basefont", ""], + ["bdo", ""], + ["big", ""], + ["blockquote", "Quote"], + ["body", "Body"], + ["br", "BR"], + ["button", "Button"], + ["canvas", "Canvas"], + ["caption", "TableCaption"], + ["center", ""], + ["cite", ""], + ["code", ""], + ["col", "TableCol"], + ["colgroup", "TableCol"], + ["data", "Data"], + ["datalist", "DataList"], + ["dd", ""], + ["del", "Mod"], + ["details", "Details"], + ["dfn", ""], + ["dir", "Directory"], + ["div", "Div"], + ["dl", "DList"], + ["dt", ""], + ["em", ""], + ["embed", "Embed"], + ["fieldset", "FieldSet"], + ["figcaption", ""], + ["figure", ""], + ["font", "Font"], + ["footer", ""], + ["form", "Form"], + ["frame", "Frame"], + ["frameset", "FrameSet"], + ["h1", "Heading"], + ["h2", "Heading"], + ["h3", "Heading"], + ["h4", "Heading"], + ["h5", "Heading"], + ["h6", "Heading"], + ["head", "Head"], + ["header", ""], + ["hgroup", ""], + ["hr", "HR"], + ["html", "Html"], + ["i", ""], + ["iframe", "IFrame"], + ["image", ""], + ["img", "Image"], + ["input", "Input"], + ["ins", "Mod"], + ["kbd", ""], + ["label", "Label"], + ["legend", "Legend"], + ["li", "LI"], + ["link", "Link"], + ["listing", "Pre"], + ["main", ""], + ["map", "Map"], + ["mark", ""], + ["marquee", "Marquee"], + ["menu", "Menu"], + ["meta", "Meta"], + ["meter", "Meter"], + ["nav", ""], + ["nobr", ""], + ["noembed", ""], + ["noframes", ""], + ["noscript", ""], + ["object", "Object"], + ["ol", "OList"], + ["optgroup", "OptGroup"], + ["option", "Option"], + ["output", "Output"], + ["p", "Paragraph"], + ["param", "Param"], + ["picture", "Picture"], + ["plaintext", ""], + ["pre", "Pre"], + ["progress", "Progress"], + ["q", "Quote"], + ["rb", ""], + ["rp", ""], + ["rt", ""], + ["rtc", ""], + ["ruby", ""], + ["s", ""], + ["samp", ""], + ["script", "Script"], + ["section", ""], + ["select", "Select"], + ["small", ""], + ["source", "Source"], + ["span", "Span"], + ["strike", ""], + ["strong", ""], + ["style", "Style"], + ["sub", ""], + ["summary", ""], + ["sup", ""], + ["table", "Table"], + ["tbody", "TableSection"], + ["td", "TableCell"], + ["textarea", "TextArea"], + ["tfoot", "TableSection"], + ["th", "TableCell"], + ["thead", "TableSection"], + ["template", "Template"], + ["time", "Time"], + ["title", "Title"], + ["tr", "TableRow"], + ["track", "Track"], + ["tt", ""], + ["u", ""], + ["ul", "UList"], + ["var", ""], + ["video", "Video"], + ["wbr", ""], + ["xmp", "Pre"], +].forEach(e => { + let tagName = e[0]; + let interfaceName = "HTML" + e[1] + "Element"; + promises.push( + test_with_new_window(testWindow => { + // Use window from iframe to isolate the test. + // Test calling the HTML*Element constructor. + (() => { + SimpleTest.doesThrow(() => { + testWindow[interfaceName](); + }, "calling the " + interfaceName + " constructor should throw a TypeError"); + })(); + + // Test constructing a HTML*ELement. + (() => { + SimpleTest.doesThrow(() => { + new testWindow[interfaceName](); + }, "constructing a " + interfaceName + " should throw a TypeError"); + })(); + + // Test constructing a custom element with defining HTML*Element as entry. + (() => { + testWindow.customElements.define( + "x-defining-" + tagName, + testWindow[interfaceName] + ); + SimpleTest.doesThrow(() => { + new testWindow[interfaceName](); + }, "constructing a custom element with defining " + interfaceName + " as registry entry should throw a TypeError"); + })(); + + // Since HTMLElement can be registered without specifying "extends", skip + // testing HTMLElement tags. + if (interfaceName !== "HTMLElement") { + // Test constructing a customized HTML*Element with defining a registry entry + // without specifying "extends". + (() => { + class X extends testWindow[interfaceName] {} + testWindow.customElements.define("x-defining-invalid-" + tagName, X); + SimpleTest.doesThrow(() => { + new X(); + }, "constructing a customized " + interfaceName + " with defining a " + 'registry entry without specifying "extends" should throw a TypeError'); + })(); + } + + // Test constructing a built-in custom element with defining a registry entry + // with incorrect "extends" information. + (() => { + class X extends testWindow[interfaceName] {} + testWindow.customElements.define("x-defining-incorrect-" + tagName, X, { + extends: tagName === "img" ? "p" : "img", + }); + SimpleTest.doesThrow(() => { + new X(); + }, "constructing a customized " + interfaceName + " with defining a " + 'registry entry with incorrect "extends" should throw a TypeError'); + })(); + + // Test calling a custom element constructor and constructing a built-in + // custom element. + (() => { + let num_constructor_invocations = 0; + class X extends testWindow[interfaceName] { + constructor() { + super(); + num_constructor_invocations++; + } + } + testWindow.customElements.define("x-" + tagName, X, { + extends: tagName, + }); + SimpleTest.doesThrow(() => { + X(); + }, "calling a customized " + interfaceName + " constructor should throw a TypeError"); + + let element = new X(); + + SimpleTest.is( + Object.getPrototypeOf(Cu.waiveXrays(element)), + X.prototype, + "constructing a customized " + + interfaceName + + "; the element should be a registered constructor" + ); + SimpleTest.is( + element.localName, + tagName, + "constructing a customized " + + interfaceName + + '; the element tag name should be "' + + tagName + + '"' + ); + SimpleTest.is( + element.namespaceURI, + "http://www.w3.org/1999/xhtml", + "constructing a customized " + + interfaceName + + "; the element should be in the HTML namespace" + ); + SimpleTest.is( + element.prefix, + null, + "constructing a customized " + + interfaceName + + "; the element name should not have a prefix" + ); + SimpleTest.is( + element.ownerDocument, + testWindow.document, + "constructing a customized " + + interfaceName + + "; the element should be owned by the registry's associated " + + "document" + ); + SimpleTest.is( + num_constructor_invocations, + 1, + "constructing a customized " + + interfaceName + + "; the constructor should have been invoked once" + ); + })(); + + // Test if prototype is no an object. + (() => { + function ElementWithNonObjectPrototype() { + let o = Reflect.construct(testWindow[interfaceName], [], new.target); + SimpleTest.is( + Object.getPrototypeOf(Cu.waiveXrays(o)), + window[interfaceName].prototype, + "constructing a customized " + + interfaceName + + "; if prototype is not object, fallback from NewTarget's realm" + ); + } + + // Prototype have to be an object during define(), otherwise define will + // throw an TypeError exception. + ElementWithNonObjectPrototype.prototype = {}; + testWindow.customElements.define( + "x-non-object-prototype-" + tagName, + ElementWithNonObjectPrototype, + { extends: tagName } + ); + + ElementWithNonObjectPrototype.prototype = "string"; + new ElementWithNonObjectPrototype(); + })(); + }) + ); +}); diff --git a/dom/tests/mochitest/webcomponents/inert_style.css b/dom/tests/mochitest/webcomponents/inert_style.css new file mode 100644 index 0000000000..3b005ede8c --- /dev/null +++ b/dom/tests/mochitest/webcomponents/inert_style.css @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* This style is linked in test_shadowroot_inert_link to ensure + that link element in ShadowRoot is inert. */ +span { + padding-top: 10px; +} + diff --git a/dom/tests/mochitest/webcomponents/mochitest.ini b/dom/tests/mochitest/webcomponents/mochitest.ini new file mode 100644 index 0000000000..a268de66dc --- /dev/null +++ b/dom/tests/mochitest/webcomponents/mochitest.ini @@ -0,0 +1,50 @@ +[DEFAULT] +support-files = + inert_style.css + dummy_page.html + head.js + +[test_bug900724.html] +[test_bug1017896.html] +[test_bug1276240.html] +[test_custom_element_callback_innerhtml.html] +[test_custom_element_htmlconstructor.html] +support-files = + htmlconstructor_autonomous_tests.js + htmlconstructor_builtin_tests.js +[test_custom_element_in_shadow.html] +[test_custom_element_throw_on_dynamic_markup_insertion.html] +[test_custom_element_get.html] +[test_custom_element_when_defined.html] +[test_custom_element_uncatchable_exception.html] +skip-if = !debug # TestFunctions only applied in debug builds +[test_custom_element_upgrade.html] +support-files = + test_upgrade_page.html + upgrade_tests.js +[test_custom_element_lifecycle.html] +[test_custom_element_stack.html] +[test_custom_element_define.html] +[test_custom_element_define_parser.html] +[test_custom_element_set_element_creation_callback.html] +[test_custom_element_template.html] +[test_detached_style.html] +[test_document_adoptnode.html] +[test_document_importnode.html] +[test_event_composed.html] +[test_event_retarget.html] +[test_event_stopping.html] +[test_template.html] +[test_template_xhtml.html] +[test_shadowdom_active_pseudo_class.html] +support-files = + !/gfx/layers/apz/test/mochitest/apz_test_utils.js +[test_shadowdom_ime.html] +[test_shadowroot.html] +[test_shadowroot_clonenode.html] +[test_shadowroot_inert_element.html] +[test_shadowroot_style.html] +[test_shadowroot_style_order.html] +[test_style_fallback_content.html] +[test_link_prefetch.html] +[test_bug1269155.html] diff --git a/dom/tests/mochitest/webcomponents/test_bug1017896.html b/dom/tests/mochitest/webcomponents/test_bug1017896.html new file mode 100644 index 0000000000..53562e9251 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_bug1017896.html @@ -0,0 +1,32 @@ + + + + + Test template element in stale document. + + + + +Bug 1017896 +
+ + + diff --git a/dom/tests/mochitest/webcomponents/test_bug1269155.html b/dom/tests/mochitest/webcomponents/test_bug1269155.html new file mode 100644 index 0000000000..6464ca92e7 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_bug1269155.html @@ -0,0 +1,95 @@ + + + + + Test for Bug 1269155 + + + + + + +Mozilla Bug 1269155 +

+ +
+
+
+ + + diff --git a/dom/tests/mochitest/webcomponents/test_bug1276240.html b/dom/tests/mochitest/webcomponents/test_bug1276240.html new file mode 100644 index 0000000000..220f005138 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_bug1276240.html @@ -0,0 +1,44 @@ + + + + + Test for Bug 1276240 + + + + + +Mozilla Bug 1276240 +

+ +
+
+
+ + diff --git a/dom/tests/mochitest/webcomponents/test_bug900724.html b/dom/tests/mochitest/webcomponents/test_bug900724.html new file mode 100644 index 0000000000..19abc37ac8 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_bug900724.html @@ -0,0 +1,32 @@ + + + + + Test for form-association in template contents. + + + + +Bug 900724 +
+
+
+ + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html b/dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html new file mode 100644 index 0000000000..c8a8d872ed --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html @@ -0,0 +1,43 @@ + + + + + Test for connected callback for element created in the document by the parser + + + + +Bug 1102502 +
+ + + + + + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_define.html b/dom/tests/mochitest/webcomponents/test_custom_element_define.html new file mode 100644 index 0000000000..7ab5ed44aa --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_define.html @@ -0,0 +1,129 @@ + + + + + Test for customElements.define + + + + +Bug 783129 +
+ +
+ + + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_define_parser.html b/dom/tests/mochitest/webcomponents/test_custom_element_define_parser.html new file mode 100644 index 0000000000..dc247220d4 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_define_parser.html @@ -0,0 +1,61 @@ + + + + + Test for customElements.define for elements created by the parser + + + + + +Bug 783129 + + + +
+ + + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html b/dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html new file mode 100644 index 0000000000..03ed2e3815 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html @@ -0,0 +1,55 @@ + + + + + + Test for customElements.ensureCustomElement + + + + + +

+ +

+
+
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_get.html b/dom/tests/mochitest/webcomponents/test_custom_element_get.html
new file mode 100644
index 0000000000..0688d21aaa
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_get.html
@@ -0,0 +1,31 @@
+
+
+
+
+  Test custom elements get function.
+  
+  
+
+
+
+Bug 1275838
+
+
+
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor.html b/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor.html
new file mode 100644
index 0000000000..c295a15038
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor.html
@@ -0,0 +1,42 @@
+
+
+
+
+  Test HTMLConstructor for custom elements.
+  
+  
+
+
+Bug 1274159
+
+
+
+
+
+
+
+
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor_chrome.html b/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor_chrome.html
new file mode 100644
index 0000000000..2adb0aac28
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_htmlconstructor_chrome.html
@@ -0,0 +1,40 @@
+
+
+
+
+  Test HTMLConstructor for custom elements.
+  
+  
+
+
+Bug 1274159
+
+
+
+
+
+
+
+
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html b/dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html
new file mode 100644
index 0000000000..4371d296ce
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html
@@ -0,0 +1,129 @@
+
+
+
+
+  Test for custom element callbacks in shadow DOM.
+  
+  
+  
+
+
+Bug 1087460
+
+
+
+
+
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_lifecycle.html b/dom/tests/mochitest/webcomponents/test_custom_element_lifecycle.html
new file mode 100644
index 0000000000..a02d0b297b
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_lifecycle.html
@@ -0,0 +1,432 @@
+
+
+
+
+  Test for custom elements lifecycle callback
+  
+
+
+
+Bug 783129
+
+ + +
+ + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_namespace.html b/dom/tests/mochitest/webcomponents/test_custom_element_namespace.html new file mode 100644 index 0000000000..a4dc4c40cc --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_namespace.html @@ -0,0 +1,95 @@ + + + + Custom Elements in an HTML document + + + + + +

+
+ + +
+

+
+
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_namespace.xhtml b/dom/tests/mochitest/webcomponents/test_custom_element_namespace.xhtml
new file mode 100644
index 0000000000..5bfdd779ad
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_namespace.xhtml
@@ -0,0 +1,104 @@
+
+
+
+
+  Custom Elements in an XHTML document
+  
+  
+  
+
+
+  

+
+ + + + +
+

+
+
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_set_element_creation_callback.html b/dom/tests/mochitest/webcomponents/test_custom_element_set_element_creation_callback.html
new file mode 100644
index 0000000000..6a8f127d93
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_set_element_creation_callback.html
@@ -0,0 +1,159 @@
+
+
+
+
+  Test for customElements.setElementCreationCallback
+  
+  
+
+
+Bug 1460815
+
+
+ + + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_stack.html b/dom/tests/mochitest/webcomponents/test_custom_element_stack.html new file mode 100644 index 0000000000..1b20103eb7 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_stack.html @@ -0,0 +1,138 @@ + + + + + Test for custom elements lifecycle callback + + + + +Bug 783129 +
+
+ + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_template.html b/dom/tests/mochitest/webcomponents/test_custom_element_template.html new file mode 100644 index 0000000000..f077f84ebe --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_template.html @@ -0,0 +1,33 @@ + + + + + Test for custom elements in template + + + + + +Bug 1091425 + + + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_throw_on_dynamic_markup_insertion.html b/dom/tests/mochitest/webcomponents/test_custom_element_throw_on_dynamic_markup_insertion.html new file mode 100644 index 0000000000..6c8c5e032c --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_throw_on_dynamic_markup_insertion.html @@ -0,0 +1,66 @@ + + + + + Test throw on dynamic markup insertion when creating element synchronously from parser + + + + +Bug 1378079 +
+ + + + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_uncatchable_exception.html b/dom/tests/mochitest/webcomponents/test_custom_element_uncatchable_exception.html new file mode 100644 index 0000000000..96c2add0dd --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_uncatchable_exception.html @@ -0,0 +1,37 @@ + + + + + Test custom elements runtime exception + + + + +Bug 1407669 + + + diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_upgrade.html b/dom/tests/mochitest/webcomponents/test_custom_element_upgrade.html new file mode 100644 index 0000000000..5759925cfa --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_upgrade.html @@ -0,0 +1,41 @@ + + + + + Test upgrade steps for custom elements. + + + + +Bug 1299363 + + + + + + \ No newline at end of file diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_upgrade_chrome.html b/dom/tests/mochitest/webcomponents/test_custom_element_upgrade_chrome.html new file mode 100644 index 0000000000..5913fc8601 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_upgrade_chrome.html @@ -0,0 +1,43 @@ + + + + + Test upgrade steps for custom elements. + + + + +Bug 1299363 + + + + + + \ No newline at end of file diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_when_defined.html b/dom/tests/mochitest/webcomponents/test_custom_element_when_defined.html new file mode 100644 index 0000000000..04cca31581 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_custom_element_when_defined.html @@ -0,0 +1,140 @@ + + + + + Test custom elements whenDefined function. + + + + +Bug 1275839 + + + + diff --git a/dom/tests/mochitest/webcomponents/test_detached_style.html b/dom/tests/mochitest/webcomponents/test_detached_style.html new file mode 100644 index 0000000000..4fc32d6650 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_detached_style.html @@ -0,0 +1,35 @@ + + + + + Test for creating style in shadow root of host not in document. + + + + + +Bug 1062578 + + + diff --git a/dom/tests/mochitest/webcomponents/test_document_adoptnode.html b/dom/tests/mochitest/webcomponents/test_document_adoptnode.html new file mode 100644 index 0000000000..50f35a55df --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_document_adoptnode.html @@ -0,0 +1,42 @@ + + + + + Test for Bug 1177991 + + + + + + +Mozilla Bug 1177991 +

+ +
+
+
+ + diff --git a/dom/tests/mochitest/webcomponents/test_document_importnode.html b/dom/tests/mochitest/webcomponents/test_document_importnode.html new file mode 100644 index 0000000000..e56fcacf27 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_document_importnode.html @@ -0,0 +1,42 @@ + + + + + Test for Bug 1177914 + + + + + + +Mozilla Bug 1177914 +

+ +
+
+
+ + diff --git a/dom/tests/mochitest/webcomponents/test_event_composed.html b/dom/tests/mochitest/webcomponents/test_event_composed.html new file mode 100644 index 0000000000..b96cd5f9dc --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_event_composed.html @@ -0,0 +1,72 @@ + + + + Test for composed event in web components + + + + + + +
+ + + diff --git a/dom/tests/mochitest/webcomponents/test_event_retarget.html b/dom/tests/mochitest/webcomponents/test_event_retarget.html new file mode 100644 index 0000000000..05b4fa3ebe --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_event_retarget.html @@ -0,0 +1,153 @@ + + + + + Test for event retargeting in web components + + + + + +Bug 887541 + + + diff --git a/dom/tests/mochitest/webcomponents/test_event_stopping.html b/dom/tests/mochitest/webcomponents/test_event_stopping.html new file mode 100644 index 0000000000..c90988d869 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_event_stopping.html @@ -0,0 +1,174 @@ + + + + + Test for event model in web components + + + + + +Bug 887541 + + + diff --git a/dom/tests/mochitest/webcomponents/test_link_prefetch.html b/dom/tests/mochitest/webcomponents/test_link_prefetch.html new file mode 100644 index 0000000000..c376ec1981 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_link_prefetch.html @@ -0,0 +1,110 @@ + + + + + Test Prefetch (bug 580313) + + + + +Mozilla Bug 580313 +

+ +
+
+
+ + diff --git a/dom/tests/mochitest/webcomponents/test_shadowdom_active_pseudo_class.html b/dom/tests/mochitest/webcomponents/test_shadowdom_active_pseudo_class.html new file mode 100644 index 0000000000..88f69190eb --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_shadowdom_active_pseudo_class.html @@ -0,0 +1,62 @@ + + +Test :active pseudo-class in shadow DOM + + + + + +Bug 1782142 +
+ diff --git a/dom/tests/mochitest/webcomponents/test_shadowdom_ime.html b/dom/tests/mochitest/webcomponents/test_shadowdom_ime.html new file mode 100644 index 0000000000..e023ff04a2 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_shadowdom_ime.html @@ -0,0 +1,59 @@ + + + + + Test for Bug 1429982 + + + + + +Mozilla Bug 1553852 +

+
+
+
+
+
+
+ + + diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot.html b/dom/tests/mochitest/webcomponents/test_shadowroot.html new file mode 100644 index 0000000000..07bc8b3fcd --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_shadowroot.html @@ -0,0 +1,77 @@ + + + + + Test for ShadowRoot + + + + + +Bug 806506 + + + diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_clonenode.html b/dom/tests/mochitest/webcomponents/test_shadowroot_clonenode.html new file mode 100644 index 0000000000..e344615596 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_shadowroot_clonenode.html @@ -0,0 +1,46 @@ + + + + + Test for Bug 1429982 + + + + + + +Mozilla Bug 1429982 +

+ +
+
+
+ + + diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html b/dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html new file mode 100644 index 0000000000..7fd5f78122 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html @@ -0,0 +1,30 @@ + + + + + Test for inert elements in ShadowRoot + + + + + +Bug 806506 + + + diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_style.html b/dom/tests/mochitest/webcomponents/test_shadowroot_style.html new file mode 100644 index 0000000000..824a8decea --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_shadowroot_style.html @@ -0,0 +1,85 @@ + + + + + Test for ShadowRoot styling + + + + + +Bug 806506 + + + + diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html b/dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html new file mode 100644 index 0000000000..05976a934a --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html @@ -0,0 +1,52 @@ + + + + + Test for ShadowRoot style order + + + + + +Bug 806506 + + + diff --git a/dom/tests/mochitest/webcomponents/test_style_fallback_content.html b/dom/tests/mochitest/webcomponents/test_style_fallback_content.html new file mode 100644 index 0000000000..33aef21322 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_style_fallback_content.html @@ -0,0 +1,39 @@ + + + + + Test for styling fallback content + + + + + +Bug 806506 + + + diff --git a/dom/tests/mochitest/webcomponents/test_template.html b/dom/tests/mochitest/webcomponents/test_template.html new file mode 100644 index 0000000000..8e663b2c93 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_template.html @@ -0,0 +1,153 @@ + + + + + Test for template element + + + + + + +Bug 818976 + + + +
+ + + + + + + + +
+ + + diff --git a/dom/tests/mochitest/webcomponents/test_template_xhtml.html b/dom/tests/mochitest/webcomponents/test_template_xhtml.html new file mode 100644 index 0000000000..b14e5c365a --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_template_xhtml.html @@ -0,0 +1,46 @@ + + + + + Test for template element + + + + +Bug 1011831 + + + diff --git a/dom/tests/mochitest/webcomponents/test_upgrade_page.html b/dom/tests/mochitest/webcomponents/test_upgrade_page.html new file mode 100644 index 0000000000..d1822b715e --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_upgrade_page.html @@ -0,0 +1,11 @@ + + + +Upgrade test page + + + +

Upgrade test page

+ + + \ No newline at end of file diff --git a/dom/tests/mochitest/webcomponents/test_xul_custom_element.xhtml b/dom/tests/mochitest/webcomponents/test_xul_custom_element.xhtml new file mode 100644 index 0000000000..f2c50f7bde --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_xul_custom_element.xhtml @@ -0,0 +1,386 @@ + + + + + + XUL Custom Elements + + + + +

+ +

+  
+
diff --git a/dom/tests/mochitest/webcomponents/test_xul_shadowdom_accesskey.xhtml b/dom/tests/mochitest/webcomponents/test_xul_shadowdom_accesskey.xhtml new file mode 100644 index 0000000000..79fb167276 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_xul_shadowdom_accesskey.xhtml @@ -0,0 +1,60 @@ + + + + + + + diff --git a/dom/tests/mochitest/webcomponents/upgrade_tests.js b/dom/tests/mochitest/webcomponents/upgrade_tests.js new file mode 100644 index 0000000000..85cff984f0 --- /dev/null +++ b/dom/tests/mochitest/webcomponents/upgrade_tests.js @@ -0,0 +1,128 @@ +function test_upgrade(f, msg) { + // Run upgrading test on an element created by HTML parser. + test_with_new_window(function (testWindow, testMsg) { + let elementParser = testWindow.document.querySelector("unresolved-element"); + f(testWindow, elementParser, testMsg); + }, msg + " (HTML parser)"); + + // Run upgrading test on an element created by document.createElement. + test_with_new_window(function (testWindow, testMsg) { + let element = testWindow.document.createElement("unresolved-element"); + testWindow.document.documentElement.appendChild(element); + f(testWindow, element, testMsg); + }, msg + " (document.createElement)"); +} + +// Test cases + +test_upgrade(function (testWindow, testElement, msg) { + class MyCustomElement extends testWindow.HTMLElement {} + testWindow.customElements.define("unresolved-element", MyCustomElement); + SimpleTest.is( + Object.getPrototypeOf(Cu.waiveXrays(testElement)), + MyCustomElement.prototype, + msg + ); +}, "Custom element must be upgraded if there is a matching definition"); + +test_upgrade(function (testWindow, testElement, msg) { + testElement.remove(); + class MyCustomElement extends testWindow.HTMLElement {} + testWindow.customElements.define("unresolved-element", MyCustomElement); + SimpleTest.is( + Object.getPrototypeOf(testElement), + testWindow.HTMLElement.prototype, + msg + ); +}, "Custom element must not be upgraded if it has been removed from tree"); + +test_upgrade(function (testWindow, testElement, msg) { + let exceptionToThrow = { name: "exception thrown by a custom constructor" }; + class ThrowCustomElement extends testWindow.HTMLElement { + constructor() { + super(); + if (exceptionToThrow) { + throw exceptionToThrow; + } + } + } + + let uncaughtError; + window.onerror = function (message, url, lineNumber, columnNumber, error) { + uncaughtError = error; + return true; + }; + testWindow.customElements.define("unresolved-element", ThrowCustomElement); + + SimpleTest.is(uncaughtError.name, exceptionToThrow.name, msg); +}, "Upgrading must report an exception thrown by a custom element constructor"); + +test_upgrade(function (testWindow, testElement, msg) { + class InstantiatesItselfAfterSuper extends testWindow.HTMLElement { + constructor(doNotCreateItself) { + super(); + if (!doNotCreateItself) { + new InstantiatesItselfAfterSuper(true); + } + } + } + + let uncaughtError; + window.onerror = function (message, url, lineNumber, columnNumber, error) { + uncaughtError = error; + return true; + }; + testWindow.customElements.define( + "unresolved-element", + InstantiatesItselfAfterSuper + ); + + SimpleTest.is(uncaughtError.name, "TypeError", msg); +}, "Upgrading must report an TypeError when the top of the " + + "construction stack is marked AlreadyConstructed"); + +test_upgrade(function (testWindow, testElement, msg) { + class InstantiatesItselfBeforeSuper extends testWindow.HTMLElement { + constructor(doNotCreateItself) { + if (!doNotCreateItself) { + new InstantiatesItselfBeforeSuper(true); + } + super(); + } + } + + let uncaughtError; + window.onerror = function (message, url, lineNumber, columnNumber, error) { + uncaughtError = error; + return true; + }; + testWindow.customElements.define( + "unresolved-element", + InstantiatesItselfBeforeSuper + ); + + SimpleTest.is(uncaughtError.name, "TypeError", msg); +}, "Upgrading must report an TypeError when the top of the " + + "construction stack is marked AlreadyConstructed due to a custom element " + + "constructor constructing itself before super() call"); + +test_upgrade(function (testWindow, testElement, msg) { + class MyOtherElement extends testWindow.HTMLElement { + constructor() { + super(); + if (this == testElement) { + return testWindow.document.createElement("other-element"); + } + } + } + + let uncaughtError; + window.onerror = function (message, url, lineNumber, columnNumber, error) { + uncaughtError = error; + return true; + }; + testWindow.customElements.define("unresolved-element", MyOtherElement); + + SimpleTest.is(uncaughtError.name, "TypeError", msg); +}, "Upgrading must report an TypeError when the returned element is " + + "not SameValue as the upgraded element"); -- cgit v1.2.3