зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1457485 [wpt PR 10686] - HTML: document.open() event listener removal, a=testonly
Automatic update from web-platform-testsHTML: document.open() event listener removal For https://github.com/whatwg/html/pull/3653. -- wpt-commits: 923d852c61cb50cb3be540dcbf54f2d5ec1518e1 wpt-pr: 10686
This commit is contained in:
Родитель
d5adacc9f0
Коммит
8f71718a61
|
@ -333529,6 +333529,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js": [
|
||||
[
|
||||
"/html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"html/dom/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js": [
|
||||
[
|
||||
"/html/dom/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.html",
|
||||
|
@ -564404,6 +564410,10 @@
|
|||
"a2a5acc9dfe53c7482eeaa4be3a4819238f8e120",
|
||||
"testharness"
|
||||
],
|
||||
"html/dom/dynamic-markup-insertion/opening-the-input-stream/event-listeners.window.js": [
|
||||
"ccf357a8081b99de1d85e05196145e83b3de2ab5",
|
||||
"testharness"
|
||||
],
|
||||
"html/dom/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js": [
|
||||
"1e1c656e1d19c9c459faf16327e099a4c9e13872",
|
||||
"testharness"
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
test(t => {
|
||||
const frame = document.body.appendChild(document.createElement("iframe")),
|
||||
body = frame.contentDocument.body;
|
||||
t.add_cleanup(() => frame.remove());
|
||||
frame.contentDocument.addEventListener("x", t.unreached_func("document event listener not removed"));
|
||||
body.addEventListener("x", t.unreached_func("body event listener not removed"));
|
||||
frame.contentDocument.open();
|
||||
frame.contentDocument.dispatchEvent(new Event("x"));
|
||||
body.dispatchEvent(new Event("x"));
|
||||
frame.contentDocument.close();
|
||||
}, "Event listeners are to be removed");
|
||||
|
||||
test(t => {
|
||||
const frame = document.body.appendChild(document.createElement("iframe"));
|
||||
t.add_cleanup(() => frame.remove());
|
||||
let once = false;
|
||||
frame.contentDocument.addEventListener("x", () => {
|
||||
frame.contentDocument.open();
|
||||
once = true;
|
||||
});
|
||||
frame.contentDocument.addEventListener("x", t.unreached_func("second event listener not removed"));
|
||||
frame.contentDocument.dispatchEvent(new Event("x"));
|
||||
assert_true(once);
|
||||
frame.contentDocument.close();
|
||||
}, "Event listeners are to be removed with immediate effect");
|
||||
|
||||
test(t => {
|
||||
const frame = document.body.appendChild(document.createElement("iframe")),
|
||||
shadow = frame.contentDocument.body.attachShadow({ mode: "closed" }),
|
||||
shadowChild = shadow.appendChild(document.createElement("div")),
|
||||
shadowShadow = shadowChild.attachShadow({ mode: "open" }),
|
||||
nodes = [shadow, shadowChild, shadowShadow];
|
||||
t.add_cleanup(() => frame.remove());
|
||||
nodes.forEach(node => {
|
||||
node.addEventListener("x", t.unreached_func(node + "'s event listener not removed"));
|
||||
});
|
||||
frame.contentDocument.open();
|
||||
nodes.forEach(node => {
|
||||
node.dispatchEvent(new Event("x"));
|
||||
});
|
||||
frame.contentDocument.close();
|
||||
}, "Event listeners are to be removed from shadow trees as well");
|
Загрузка…
Ссылка в новой задаче