Bug 1447238 [wpt PR 10106] - Reject customized built-in elements in attachShadow, a=testonly
authorHayato Ito <hayato@chromium.org>
Mon, 09 Apr 2018 17:38:37 +0000
changeset 467156 05184c40e4d5cbf2d895e8f534a4293b342de242
parent 467155 1facf5ae4b13c54c8f80319f4d1a3c1aa00961d7
child 467157 ea2668153d4af4aee66e628882b26a5387c02e3c
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1447238, 10106, 823033, 970142, 545026
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1447238 [wpt PR 10106] - Reject customized built-in elements in attachShadow, a=testonly Automatic update from web-platform-testsReject customized built-in elements in attachShadow Element::CanAttachShadowRoot() needs to be updated because it returns wrongly true for customized built-in elements. The spec: https://dom.spec.whatwg.org/#dom-element-attachshadow Bug: 823033 Change-Id: Ia9aeb47569414830f5435f37f85d96101b9fe432 Reviewed-on: https://chromium-review.googlesource.com/970142 Reviewed-by: Koji Ishii <kojii@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Hayato Ito <hayato@chromium.org> Cr-Commit-Position: refs/heads/master@{#545026} wpt-commits: 99914e138abbd268494757edbdb800566727179b wpt-pr: 10106 wpt-commits: 99914e138abbd268494757edbdb800566727179b wpt-pr: 10106
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/shadow-dom/Element-interface-attachShadow-custom-element.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -361556,16 +361556,22 @@
     ]
    ],
    "shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.html": [
     [
      "/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.html",
      {}
     ]
    ],
+   "shadow-dom/Element-interface-attachShadow-custom-element.html": [
+    [
+     "/shadow-dom/Element-interface-attachShadow-custom-element.html",
+     {}
+    ]
+   ],
    "shadow-dom/Element-interface-attachShadow.html": [
     [
      "/shadow-dom/Element-interface-attachShadow.html",
      {}
     ]
    ],
    "shadow-dom/Element-interface-shadowRoot-attribute.html": [
     [
@@ -594865,16 +594871,20 @@
   "shadow-dom/Document-prototype-importNode.html": [
    "857cfd26d985a763ac16dac4b86b1223e6792388",
    "testharness"
   ],
   "shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.html": [
    "e33e48a3eb754e961f07b7850caff67eee38fe69",
    "testharness"
   ],
+  "shadow-dom/Element-interface-attachShadow-custom-element.html": [
+   "4628a8a6e145713c7e0e9df0960d51e34df2fc53",
+   "testharness"
+  ],
   "shadow-dom/Element-interface-attachShadow.html": [
    "e5b4dedaf8f78a6ce771af4509da8acb3aca3441",
    "testharness"
   ],
   "shadow-dom/Element-interface-shadowRoot-attribute.html": [
    "9309a89a4cf31421a4d6adb17134f9179613d9be",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/shadow-dom/Element-interface-attachShadow-custom-element.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<title>Shadow DOM: Attaching a ShadowRoot for custom elements</title>
+<meta name="author" title="Hayato Ito" href="mailto:hayato@chromium.org">
+<link rel="help" href="https://dom.spec.whatwg.org/#dom-element-attachshadow">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+class MyAutonomousCustomElement extends HTMLElement {
+}
+
+customElements.define('my-custom', MyAutonomousCustomElement);
+
+test(() => {
+  assert_true(document.createElement('my-custom').attachShadow({mode: "open"}) instanceof ShadowRoot);
+}, 'Element.attachShadow must create an instance of ShadowRoot for autonomous custom elements');
+
+class MyCustomizedBuiltinElement extends HTMLInputElement {
+}
+
+customElements.define('my-input', MyCustomizedBuiltinElement, { extends: 'input' });
+
+test(() => {
+  assert_throws({'name': 'NotSupportedError'}, () => {
+    document.createElement('input', {is: 'my-input'}).attachShadow({mode: "open"});
+  });
+}, 'Element.attachShadow must throw a NotSupportedError for customized built-in elements');
+</script>
+</body>
+</html>