WebKit Bugzilla
Attachment 348600 Details for
Bug 189183
: slotchange-event-bubbling.html fails in Chrome & Firefox
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixes the test
bug-189183-20180830214302.patch (text/plain), 6.89 KB, created by
Ryosuke Niwa
on 2018-08-30 21:43:03 PDT
(
hide
)
Description:
Fixes the test
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-08-30 21:43:03 PDT
Size:
6.89 KB
patch
obsolete
>Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 235537) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,25 @@ >+2018-08-30 Ryosuke Niwa <rniwa@webkit.org> >+ >+ slotchange-event-bubbling.html fails in Chrome & Firefox >+ https://bugs.webkit.org/show_bug.cgi?id=189183 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ slotchange event is supposed to fire when a slot element is inserted and there are assinged nodes. >+ >+ Firefox and Chrome implements this behavior and fails this test since the test doesn't let microstask >+ check point run before start mutating the DOM. >+ >+ Fixed the test by manually waiting for the current microtask queue is emptied after constructing >+ the test shadow tree so that slotchange event from the initial tree construction doesn't get merged >+ with slotchange event fired for the actual DOM mutation being tested. >+ >+ Also fixed typos in slotchange-in-fallback.html and a bug that we were removing the slot instead >+ of the shadow host at the end of each test case. >+ >+ * fast/shadow-dom/slotchange-event-bubbling.html: >+ * fast/shadow-dom/slotchange-in-fallback.html: >+ > 2018-08-30 Zalan Bujtas <zalan@apple.com> > > CounterMaps should hold a unique_ptr of CounterMap. >Index: LayoutTests/fast/shadow-dom/slotchange-event-bubbling.html >=================================================================== >--- LayoutTests/fast/shadow-dom/slotchange-event-bubbling.html (revision 235537) >+++ LayoutTests/fast/shadow-dom/slotchange-event-bubbling.html (working copy) >@@ -75,7 +75,7 @@ test_slotchange_event_bubbles('open', fa > test_slotchange_event_bubbles('open', true); > > function test_single_slotchange_event_for_nested_slots(outerMode, innerMode, connected) { >- promise_test(() => { >+ promise_test(async () => { > const outerHost = document.createElement('outer-host'); > if (connected) > document.body.appendChild(outerHost); >@@ -91,6 +91,8 @@ function test_single_slotchange_event_fo > const innerSlotParent = innerShadow.querySelector('div'); > const innerSlot = innerShadow.querySelector('slot'); > >+ await Promise.resolve(); >+ > const observer = create_slotchange_observer(); > observer.observe(outerSlot); > observer.observe(innerHost); >@@ -109,23 +111,23 @@ function test_single_slotchange_event_fo > outerHost.textContent = ' '; > > assert_array_equals(observer.takeLog(), [], 'slotchange event must not be fired synchronously'); >- return Promise.resolve().then(() => { >- const log = observer.takeLog(); >+ await Promise.resolve(); > >- const events = new Set(log.map((entry) => entry.event)); >- assert_equals(events.size, 1, 'Mutating the assigned content of a slot must fire exactly one slotchange event'); >+ const log = observer.takeLog(); > >- assert_slotchange_log(log[0], outerSlot, outerSlot, 'slotchange event must be dispatched at the slot element first'); >- assert_slotchange_log(log[1], innerSlot, outerSlot, 'slotchange event must bubble up from a slot element to its assigned slot'); >- assert_slotchange_log(log[2], innerSlotParent, outerSlot, 'slotchange event must bubble up to the parent node of a slot'); >- assert_slotchange_log(log[3], innerShadow, outerSlot, 'slotchange event must bubble up to the shadow root'); >- assert_slotchange_log(log[4], innerHost, outerSlot, >- 'slotchange event must bubble up to the shadow host if the host is a descendent of the tree in which the event was fired'); >- assert_slotchange_log(log[5], outerHostParent, outerSlot, >- 'slotchange event must bubble up to the parent of an inner shadow host'); >- assert_slotchange_log(log[6], outerShadow, outerSlot, 'slotchange event must bubble up to the shadow root'); >- assert_equals(log.length, 7, 'slotchange must not bubble beyond the shadow root in which the event was fired'); >- }); >+ const events = new Set(log.map((entry) => entry.event)); >+ assert_equals(events.size, 1, 'Mutating the assigned content of a slot must fire exactly one slotchange event'); >+ >+ assert_slotchange_log(log[0], outerSlot, outerSlot, 'slotchange event must be dispatched at the slot element first'); >+ assert_slotchange_log(log[1], innerSlot, outerSlot, 'slotchange event must bubble up from a slot element to its assigned slot'); >+ assert_slotchange_log(log[2], innerSlotParent, outerSlot, 'slotchange event must bubble up to the parent node of a slot'); >+ assert_slotchange_log(log[3], innerShadow, outerSlot, 'slotchange event must bubble up to the shadow root'); >+ assert_slotchange_log(log[4], innerHost, outerSlot, >+ 'slotchange event must bubble up to the shadow host if the host is a descendent of the tree in which the event was fired'); >+ assert_slotchange_log(log[5], outerHostParent, outerSlot, >+ 'slotchange event must bubble up to the parent of an inner shadow host'); >+ assert_slotchange_log(log[6], outerShadow, outerSlot, 'slotchange event must bubble up to the shadow root'); >+ assert_equals(log.length, 7, 'slotchange must not bubble beyond the shadow root in which the event was fired'); > }, `A single slotchange event must bubble from a ${connected ? 'connected' : 'disconnected'} ${innerMode}-mode shadow tree to` > + `a slot in its parent ${outerMode}-mode shadow tree`); > } >Index: LayoutTests/fast/shadow-dom/slotchange-in-fallback.html >=================================================================== >--- LayoutTests/fast/shadow-dom/slotchange-in-fallback.html (revision 235537) >+++ LayoutTests/fast/shadow-dom/slotchange-in-fallback.html (working copy) >@@ -19,14 +19,14 @@ function generateTests(...args) { > testMutatingSlot('open', false, ...args); > } > >-function testMutatingSlot(mode, connectedToDocument, shadowContent, slotName, prepareSlot, mutateSlot, description) >+function testMutatingSlot(mode, connectedToDocument, hostContent, slotName, prepareSlot, mutateSlot, description) > { > promise_test(async function () { > const host = document.createElement('div'); > if (connectedToDocument) > document.body.appendChild(host); >- if (shadowContent) >- host.innerHTML = shadowContent; >+ if (hostContent) >+ host.innerHTML = hostContent; > > const shadowRoot = host.attachShadow({mode}); > >@@ -44,9 +44,9 @@ function testMutatingSlot(mode, connecte > > mutateSlot(slot); > await Promise.resolve(); >- assert_equals(eventCount, shadowContent ? 0 : 1); >+ assert_equals(eventCount, hostContent ? 0 : 1); > >- slot.remove(); >+ host.remove(); > }, description + ` in a ${connectedToDocument ? 'connected' : 'disconnected'} ${mode} mode shadow root`); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
cdumez
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189183
: 348600