Auto merge of #22802 - gterzian:only_run_tasks_for_fully_active_docs, r=nox

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

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #22792 (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22802)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-03-11 12:32:03 -04:00 committed by GitHub
commit f2ea73f360
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 219 additions and 14 deletions

View file

@ -302547,6 +302547,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": [
[
{}
@ -395569,6 +395579,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",
@ -664969,6 +664985,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"
@ -664981,6 +665001,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>