in BC event-loop, only run tasks related to fully-active documents

This commit is contained in:
Gregory Terzian 2019-02-01 20:35:45 +08:00
parent 6b648429f5
commit ecfb9c639a
9 changed files with 219 additions and 14 deletions

View file

@ -300628,6 +300628,16 @@
{}
]
],
"html/webappapis/scripting/event-loops/resources/iframe.html": [
[
{}
]
],
"html/webappapis/scripting/event-loops/resources/page-with-frame.html": [
[
{}
]
],
"html/webappapis/scripting/events/contains.json": [
[
{}
@ -383105,6 +383115,12 @@
{}
]
],
"html/webappapis/scripting/event-loops/fully_active_document.window.js": [
[
"/html/webappapis/scripting/event-loops/fully_active_document.window.html",
{}
]
],
"html/webappapis/scripting/event-loops/microtask_after_raf.html": [
[
"/html/webappapis/scripting/event-loops/microtask_after_raf.html",
@ -639124,6 +639140,10 @@
"5d7e5e600e90861a1703ae37321b1b2583024d19",
"support"
],
"html/webappapis/scripting/event-loops/fully_active_document.window.js": [
"950a8a29ee5731785f350508dc8abec7ca98ba64",
"testharness"
],
"html/webappapis/scripting/event-loops/microtask_after_raf.html": [
"824dbc4b92e33323862c5ce59c427cba079d98ce",
"testharness"
@ -639136,6 +639156,14 @@
"e2279f93ddb09d14d7065c89357ab102e0ba0ce0",
"support"
],
"html/webappapis/scripting/event-loops/resources/iframe.html": [
"32e486236079ea089c0084bad1118599af06f2cd",
"support"
],
"html/webappapis/scripting/event-loops/resources/page-with-frame.html": [
"f13170576efc074f3c92528f707fe8952d85f0cc",
"support"
],
"html/webappapis/scripting/event-loops/task_microtask_ordering-manual.html": [
"ed2f70e196e061926c97817807a315415c625e87",
"manual"

View file

@ -1,5 +0,0 @@
[002.html]
type: testharness
[navigating 2]
expected: FAIL

View file

@ -0,0 +1,29 @@
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
frame.onload = t.step_func(() => {
// Right now the doc of the iframe inside "frame" is still "fully-active".
// Navigate parent away, making the child iframe's doc "active", not "fully-active".
frame.contentWindow.location = "/common/blank.html";
frame.onload = t.step_func(() => {
// The child iframe's doc is "active", not "fully-active", and should not receive the storage notification.
sessionStorage.setItem('myCat', 'Tom');
t.step_timeout(() => {
// The child iframe's hasn't received the storage notification.
assert_equals(sessionStorage.getItem("Received storage event"), null);
frame.contentWindow.history.go(-1);
t.step_timeout(() => {
// Now The child iframe's doc is "fully-active" again,
// the previously not run storage task should now have been run.
assert_equals(sessionStorage.getItem("Received storage event"), "true");
t.done();
}, 1000);
}, 1000);
});
});
frame.src = "resources/page-with-frame.html";
}, "Tasks for documents that are not fully active are stored, and run when the documents becomes fully-active");

View file

@ -0,0 +1,7 @@
<!doctype html>
<title>Childframe</title>
<script>
window.addEventListener('storage', () => {
sessionStorage.setItem("Received storage event", true);
});
</script>

View file

@ -0,0 +1 @@
<iframe src="iframe.html"></iframe>