Title: [281814] trunk/LayoutTests
Revision
281814
Author
[email protected]
Date
2021-08-31 12:11:54 -0700 (Tue, 31 Aug 2021)

Log Message

Resync web-platform-tests/shadow-dom
https://bugs.webkit.org/show_bug.cgi?id=229698

Reviewed by Antti Koivisto.

Resync WPT tests for shadow DOM as of 62d977d3e3161a900aecd007ff3fc88b621fdc65.

* resources/resource-files.json:
* web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative-expected.txt:
* web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative.html:
* web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1-expected.xht: Added.
* web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html: Added.
* web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2-expected.xht: Added.
* web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html: Added.
* web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3-expected.xht: Added.
* web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html: Added.
* web-platform-tests/shadow-dom/focus/w3c-import.log:
* web-platform-tests/shadow-dom/imperative-slot-api-expected.txt:
* web-platform-tests/shadow-dom/imperative-slot-api-slotchange-expected.txt:
* web-platform-tests/shadow-dom/imperative-slot-api-slotchange.html:
* web-platform-tests/shadow-dom/imperative-slot-api.html:
* web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash-expected.txt: Added.
* web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash.html: Added.
* web-platform-tests/shadow-dom/w3c-import.log:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/TestExpectations (281813 => 281814)


--- trunk/LayoutTests/TestExpectations	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/TestExpectations	2021-08-31 19:11:54 UTC (rev 281814)
@@ -3354,6 +3354,9 @@
 fast/text/design-system-ui-15.html [ ImageOnlyFailure ]
 fast/text/design-system-ui-16.html [ ImageOnlyFailure ]
 
+# This is a crash test. The result is ignored for now.
+imported/w3c/web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash.html [ Pass Failure ]
+
 # wpt css-images failures
 webkit.org/b/200207 imported/w3c/web-platform-tests/css/css-images/css-image-fallbacks-and-annotations002.html [ ImageOnlyFailure ]
 webkit.org/b/200207 imported/w3c/web-platform-tests/css/css-images/css-image-fallbacks-and-annotations003.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-31 19:11:54 UTC (rev 281814)
@@ -1,3 +1,30 @@
+2021-08-31  Ryosuke Niwa  <[email protected]>
+
+        Resync web-platform-tests/shadow-dom
+        https://bugs.webkit.org/show_bug.cgi?id=229698
+
+        Reviewed by Antti Koivisto.
+
+        Resync WPT tests for shadow DOM as of 62d977d3e3161a900aecd007ff3fc88b621fdc65.
+
+        * resources/resource-files.json:
+        * web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative-expected.txt:
+        * web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative.html:
+        * web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1-expected.xht: Added.
+        * web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html: Added.
+        * web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2-expected.xht: Added.
+        * web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html: Added.
+        * web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3-expected.xht: Added.
+        * web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html: Added.
+        * web-platform-tests/shadow-dom/focus/w3c-import.log:
+        * web-platform-tests/shadow-dom/imperative-slot-api-expected.txt:
+        * web-platform-tests/shadow-dom/imperative-slot-api-slotchange-expected.txt:
+        * web-platform-tests/shadow-dom/imperative-slot-api-slotchange.html:
+        * web-platform-tests/shadow-dom/imperative-slot-api.html:
+        * web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash-expected.txt: Added.
+        * web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash.html: Added.
+        * web-platform-tests/shadow-dom/w3c-import.log:
+
 2021-08-31  Chris Dumez  <[email protected]>
 
         Implement self.structuredClone()

Modified: trunk/LayoutTests/imported/w3c/resources/resource-files.json (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/resources/resource-files.json	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/resources/resource-files.json	2021-08-31 19:11:54 UTC (rev 281814)
@@ -81,7 +81,9 @@
         "shadow-dom/declarative/support/declarative-child-frame.html",
         "shadow-dom/event-on-pseudo-element-crash.html",
         "shadow-dom/imperative-slot-api-crash.html",
+        "shadow-dom/imperative-slot-assign-not-slotable-crash.html",
         "shadow-dom/nested-slot-remove-crash.html",
+        "shadow-dom/user-agent-shadow-root-crash.html",
         "web-platform-tests/FileAPI/BlobURL/support/file_test3.html",
         "web-platform-tests/FileAPI/support/document-domain-setter.sub.html",
         "web-platform-tests/FileAPI/support/incumbent.sub.html",

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative-expected.txt (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative-expected.txt	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative-expected.txt	2021-08-31 19:11:54 UTC (rev 281814)
@@ -14,6 +14,8 @@
     <span>root 1</span>
   </...
 FAIL Declarative Shadow DOM: template containing declarative shadow root assert_true: Inner div should have a shadow root expected true got false
+FAIL Declarative Shadow DOM: template containing (deeply nested) declarative shadow root assert_true: Inner div should have a shadow root expected true got false
+FAIL Declarative Shadow DOM: template containing a template containing declarative shadow root assert_true: Inner div should have a shadow root expected true got false
 FAIL Declarative Shadow DOM: template containing declarative shadow root and UA shadow root assert_true: Inner div should have a shadow root expected true got false
 PASS Declarative Shadow DOM: template containing closed declarative shadow root and UA shadow root
 PASS Declarative Shadow DOM: template root element

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative.html (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative.html	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative.html	2021-08-31 19:11:54 UTC (rev 281814)
@@ -169,6 +169,45 @@
 }, 'Declarative Shadow DOM: template containing declarative shadow root');
 </script>
 
+<template id="template-containing-deep-shadow">
+  <div><div><div><div><div>
+    <div class="innerdiv">
+      <template shadowroot=open>Content</template>
+    </div>
+  </div></div></div></div></div>
+</template>
+<script>
+test(() => {
+  const template = document.querySelector('#template-containing-deep-shadow');
+  const host = document.createElement('div');
+  host.style.display = 'none';
+  document.body.appendChild(host);
+  host.appendChild(template.content.cloneNode(true));
+  assert_true(!!host.querySelector('div.innerdiv').shadowRoot,"Inner div should have a shadow root");
+}, 'Declarative Shadow DOM: template containing (deeply nested) declarative shadow root');
+</script>
+
+<template id="template-containing-template">
+  <div>
+    <template id="inner-template">
+      <div class="innerdiv">
+        <template shadowroot=open>Content</template>
+      </div>
+    </template>
+  </div>
+</template>
+<script>
+test(() => {
+  const template = document.querySelector('#template-containing-template');
+  const host = document.createElement('div');
+  host.style.display = 'none';
+  document.body.appendChild(host);
+  host.appendChild(template.content.cloneNode(true));
+  const innerTemplate = host.querySelector('#inner-template');
+  assert_true(!!innerTemplate.content.querySelector('div.innerdiv').shadowRoot,"Inner div should have a shadow root");
+}, 'Declarative Shadow DOM: template containing a template containing declarative shadow root');
+</script>
+
 <template id="template-containing-ua-shadow">
   <div class="innerdiv">
     <template shadowroot=open>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1-expected.xht (0 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1-expected.xht	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1-expected.xht	2021-08-31 19:11:54 UTC (rev 281814)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>CSS Reftest Reference</title>
+  <link rel="author" title="Gérard Talbot" href="" />
+  <style type="text/css"><![CDATA[
+  div
+  {
+  background-color: green;
+  height: 100px;
+  width: 100px;
+  }
+  ]]></style>
+ </head>
+ <body>
+  <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+  <div></div>
+ </body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html (0 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html	2021-08-31 19:11:54 UTC (rev 281814)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content=":focus should match a shadow host which contains the focused element">
+<link rel="help" href=""
+<link rel="help=" href=""
+<link rel="match" href=""
+</head>
+<body>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div id="host"></div>
+<style>
+#host { background: red; width: 100px; height: 100px; }
+#host:focus { background: green; }
+</style>
+<script>
+
+const shadowRoot = host.attachShadow({mode: 'closed'});
+shadowRoot.innerHTML = '<div tabindex="0" style="outline: none;"></div>';
+shadowRoot.firstChild.focus();
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2-expected.xht (0 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2-expected.xht	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2-expected.xht	2021-08-31 19:11:54 UTC (rev 281814)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>CSS Reftest Reference</title>
+  <link rel="author" title="Gérard Talbot" href="" />
+  <style type="text/css"><![CDATA[
+  div
+  {
+  background-color: green;
+  height: 100px;
+  width: 100px;
+  }
+  ]]></style>
+ </head>
+ <body>
+  <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+  <div></div>
+ </body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html (0 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html	2021-08-31 19:11:54 UTC (rev 281814)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content=":focus should match a shadow host which contains the focused element">
+<link rel="help" href=""
+<link rel="help=" href=""
+<link rel="match" href=""
+</head>
+<body>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div id="host"><span>FAIL</span></div>
+<style>
+#host { background: green; width: 100px; height: 100px; }
+#host span { background: red; }
+#host:focus span { background: green; color: green; }
+</style>
+<script>
+
+const shadowRoot = host.attachShadow({mode: 'closed'});
+shadowRoot.innerHTML = '<div tabindex="0" style="outline: none;"><slot></slot></div>';
+shadowRoot.firstChild.focus();
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3-expected.xht (0 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3-expected.xht	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3-expected.xht	2021-08-31 19:11:54 UTC (rev 281814)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>CSS Reftest Reference</title>
+  <link rel="author" title="Gérard Talbot" href="" />
+  <style type="text/css"><![CDATA[
+  div
+  {
+  background-color: green;
+  height: 100px;
+  width: 100px;
+  }
+  ]]></style>
+ </head>
+ <body>
+  <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+  <div></div>
+ </body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html (0 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html	2021-08-31 19:11:54 UTC (rev 281814)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content=":focus should not match a shadow host if the focused element is a slotted content">
+<link rel="help" href=""
+<link rel="help=" href=""
+<link rel="match" href=""
+</head>
+<body>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div id="host"><div id="target" tabindex="0"></div></div>
+<style>
+#host { background: green; width: 100px; height: 100px; }
+#host:focus #target { background: red; width: 100px; height: 100px; }
+#target { outline: none; }
+</style>
+<script>
+
+const shadowRoot = host.attachShadow({mode: 'closed'});
+shadowRoot.innerHTML = '<slot></slot>';
+target.focus();
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/w3c-import.log (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/w3c-import.log	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/w3c-import.log	2021-08-31 19:11:54 UTC (rev 281814)
@@ -21,8 +21,11 @@
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-zero.html
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-method-delegatesFocus.html
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-matches-on-shadow-host.html
+/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1-expected.xht
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html
+/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2-expected.xht
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html
+/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3-expected.xht
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-selector-delegatesFocus.html
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.html

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-expected.txt (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-expected.txt	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-expected.txt	2021-08-31 19:11:54 UTC (rev 281814)
@@ -10,7 +10,7 @@
 FAIL Moving a slot to a new host, the slot loses its previously assigned slottables. tTree.s1.assign is not a function. (In 'tTree.s1.assign(tTree.c1, tTree.c2, tTree.c3)', 'tTree.s1.assign' is undefined)
 FAIL Moving a slot's tree order position within a shadow host has no impact on its assigned slottables. tTree.s1.assign is not a function. (In 'tTree.s1.assign(tTree.c1, tTree.c2, tTree.c3)', 'tTree.s1.assign' is undefined)
 FAIL Appending slottable to different host, it loses slot assignment. It can be re-assigned within a new host. tTree.s1.assign is not a function. (In 'tTree.s1.assign(tTree.c1, tTree.c2, tTree.c3)', 'tTree.s1.assign' is undefined)
-FAIL Previously assigned node should not be assigned if slot moved to a new shadow root. The slot remains empty when moved back, trigger recalc. tTree.s1.assign is not a function. (In 'tTree.s1.assign(tTree.c1)', 'tTree.s1.assign' is undefined)
+FAIL Previously assigned node should not be assigned if slot moved to a new shadow root. The node is re-assigned when moved back. tTree.s1.assign is not a function. (In 'tTree.s1.assign(tTree.c1)', 'tTree.s1.assign' is undefined)
 FAIL Assignment with the same node in parameters should be ignored, first one wins. tTree.s1.assign is not a function. (In 'tTree.s1.assign(tTree.c1, tTree.c1, tTree.c1)', 'tTree.s1.assign' is undefined)
 FAIL Removing a slot from DOM resets its slottable's slot assignment. tTree.s1.assign is not a function. (In 'tTree.s1.assign(tTree.c1, tTree.c2, tTree.c3)', 'tTree.s1.assign' is undefined)
 FAIL Nodes can be assigned even if slots or nodes aren't in the same tree. tTree.s1.assign is not a function. (In 'tTree.s1.assign(tTree.c1, tTree.c2)', 'tTree.s1.assign' is undefined)

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-slotchange-expected.txt (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-slotchange-expected.txt	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-slotchange-expected.txt	2021-08-31 19:11:54 UTC (rev 281814)
@@ -11,4 +11,5 @@
 FAIL No slotchange event when adding or removing an empty slot. assert_equals: expected 0 but got 1
 FAIL No slotchange event when adding another slotable. assert_equals: expected 0 but got 1
 FAIL Fire slotchange event when assign node to nested slot, ensure event bubbles ups. tTree.s3.assign is not a function. (In 'tTree.s3.assign(tTree.s1)', 'tTree.s3.assign' is undefined)
+FAIL Signal a slot change should be done in tree order. promise_test: Unhandled rejection with value: object "TypeError: tTree.s1.assign is not a function. (In 'tTree.s1.assign(tTree.c1)', 'tTree.s1.assign' is undefined)"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-slotchange.html (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-slotchange.html	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-slotchange.html	2021-08-31 19:11:54 UTC (rev 281814)
@@ -11,6 +11,9 @@
     <template id="shadow_root" data-mode="open" data-slot-assignment="manual">
       <slot id="s1"><div id="fb">fallback</div></slot>
       <slot id="s2"></slot>
+      <div>
+        <slot id="s2.5"></slot>
+      </div>
       <slot id="s3"></slot>
     </template>
     <div id="c1"></div>
@@ -355,4 +358,37 @@
     }));
   }));
 }, "Fire slotchange event when assign node to nested slot, ensure event bubbles ups.");
+
+promise_test(async t => {
+  async function mutationObserversRun() {
+    return new Promise(r => {
+      t.step_timeout(r, 0);
+    });
+  }
+  let tTree = createTestTree(test_slotchange);
+
+  tTree.s1.assign(tTree.c1);
+  tTree["s2.5"].assign(tTree.c2);
+
+  let slotChangedOrder = [];
+
+  // Clears out pending mutation observers
+  await mutationObserversRun();
+
+  tTree.s1.addEventListener("slotchange", function() {
+    slotChangedOrder.push("s1");
+  });
+
+  tTree.s3.addEventListener("slotchange", function() {
+    slotChangedOrder.push("s3");
+  });
+
+  tTree["s2.5"].addEventListener("slotchange", function() {
+    slotChangedOrder.push("s2.5");
+  });
+
+  tTree.s3.assign(tTree.c2, tTree.c1);
+  await mutationObserversRun();
+  assert_array_equals(slotChangedOrder, ["s1", "s2.5", "s3"]);
+}, 'Signal a slot change should be done in tree order.');
 </script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api.html (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api.html	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api.html	2021-08-31 19:11:54 UTC (rev 281814)
@@ -196,6 +196,7 @@
   tTree.host4.append(tTree.c1);
   assert_array_equals(tTree.s1.assignedNodes(), [tTree.c2, tTree.c3]);
   assert_array_equals(tTree.s4.assignedNodes(), []);
+  assert_equals(tTree.c1.assignedSlot, null);
 
   tTree.s4.assign(tTree.c1);
   assert_array_equals(tTree.s4.assignedNodes(), [tTree.c1]);
@@ -214,8 +215,8 @@
   assert_array_equals(tTree.s2.assignedNodes(), []);
 
   tTree.shadow_root.insertBefore(tTree.s1, tTree.s2);
-  assert_array_equals(tTree.s1.assignedNodes(), []);
-}, 'Previously assigned node should not be assigned if slot moved to a new shadow root. The slot remains empty when moved back, trigger recalc.');
+  assert_array_equals(tTree.s1.assignedNodes(), [tTree.c1]);
+}, 'Previously assigned node should not be assigned if slot moved to a new shadow root. The node is re-assigned when moved back.');
 
 test(() => {
   let tTree = createTestTree(test_assign);

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash-expected.txt (0 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash-expected.txt	2021-08-31 19:11:54 UTC (rev 281814)
@@ -0,0 +1,13 @@
+CONSOLE MESSAGE: TypeError: document.getElementById('slot').assign is not a function. (In 'document.getElementById('slot').assign(nonSlotable)', 'document.getElementById('slot').assign' is undefined)
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x50
+  RenderBlock {HTML} at (0,0) size 800x50
+    RenderBody {BODY} at (8,16) size 784x18
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 226x18
+          text run at (0,0) width 226: "This test passes if it does not crash."
+      RenderBlock (anonymous) at (0,34) size 784x0
+        RenderInline {OBJECT} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash.html (0 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash.html	2021-08-31 19:11:54 UTC (rev 281814)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<link rel=author href=""
+<link rel=help href=""
+
+<p>This test passes if it does not crash.</p>
+
+<slot id=slot>
+<object id=object>
+<script>
+_onload_ = () => {
+  const nonSlotable = document.createProcessingInstruction(undefined, undefined);
+  document.getElementById('slot').assign(nonSlotable);
+  document.getElementById('object').appendChild(nonSlotable);
+}
+</script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/w3c-import.log (281813 => 281814)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/w3c-import.log	2021-08-31 19:04:19 UTC (rev 281813)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/w3c-import.log	2021-08-31 19:11:54 UTC (rev 281814)
@@ -51,6 +51,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api-slotchange.html
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-api.html
+/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/imperative-slot-assign-not-slotable-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/innerHTML-setter.xhtml
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/input-element-list.html
 /LayoutTests/imported/w3c/web-platform-tests/shadow-dom/input-type-radio.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to