Skip to content

Commit

Permalink
Bug 1458619 [wpt PR 10789] - HTML: document.open() and aborting docum…
Browse files Browse the repository at this point in the history
…ents, a=testonly

Automatic update from web-platform-testsHTML: document.open() and aborting documents (#10789)

For whatwg/html#3999.

Co-authored-by: Anne van Kesteren <[email protected]>
--

wpt-commits: 2c6612a9b0f67c95fc8cc772cfecc2c1d435d75d
wpt-pr: 10789
  • Loading branch information
annevk authored and moz-wptsync-bot committed Sep 12, 2018
1 parent 40fbc0e commit c403751
Show file tree
Hide file tree
Showing 13 changed files with 648 additions and 15 deletions.
101 changes: 89 additions & 12 deletions testing/web-platform/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -198148,6 +198148,11 @@
{}
]
],
"common/slow.py": [
[
{}
]
],
"common/stringifiers.js": [
[
{}
Expand Down Expand Up @@ -290673,11 +290678,6 @@
{}
]
],
"html/semantics/scripting-1/the-script-element/resources/slow.py": [
[
{}
]
],
"html/semantics/scripting-1/the-script-element/script-not-executed-after-shutdown-child.html": [
[
{}
Expand Down Expand Up @@ -291413,6 +291413,16 @@
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/http-refresh.py": [
[
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/meta-refresh.py": [
[
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/page-with-frame.html": [
[
{}
Expand All @@ -291423,6 +291433,11 @@
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/slow-png.py": [
[
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/url-frame.html": [
[
{}
Expand Down Expand Up @@ -368743,6 +368758,36 @@
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-refresh-immediate.window.js": [
[
"/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-refresh-immediate.window.html",
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-refresh-multisecond-header.window.js": [
[
"/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-refresh-multisecond-header.window.html",
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-refresh-multisecond-meta.window.js": [
[
"/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-refresh-multisecond-meta.window.html",
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-while-navigating.window.js": [
[
"/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-while-navigating.window.html",
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort.sub.window.js": [
[
"/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort.sub.window.html",
{}
]
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js": [
[
"/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.html",
Expand Down Expand Up @@ -440158,6 +440203,10 @@
"6805c323df5a975231648b830e33ce183c3cbbd3",
"support"
],
"common/slow.py": [
"f3b1c7e2ea61b571bd56cc1c70c5f89bb8e7e4dc",
"support"
],
"common/stringifiers.js": [
"b59ca9c246f75a72d532d58ef628824f8905ff7a",
"support"
Expand Down Expand Up @@ -610715,11 +610764,11 @@
"testharness"
],
"html/semantics/scripting-1/the-script-element/load-error-events-2.html": [
"cefa053e754335e4a84424422a8bfaa9bc72ba75",
"0748b459092089e12743df4ccb458c6edf770515",
"testharness"
],
"html/semantics/scripting-1/the-script-element/load-error-events-3.html": [
"c2cf0dbdd988507047184bff3489caeb167f6c88",
"83a752ce2cd860ffb4354a540e5b553d720eb4e9",
"testharness"
],
"html/semantics/scripting-1/the-script-element/log.py": [
Expand Down Expand Up @@ -611586,10 +611635,6 @@
"a6095097dd7e17b1e5370b739b31d361f8fdaf7b",
"support"
],
"html/semantics/scripting-1/the-script-element/resources/slow.py": [
"f3b1c7e2ea61b571bd56cc1c70c5f89bb8e7e4dc",
"support"
],
"html/semantics/scripting-1/the-script-element/script-charset-01.html": [
"c5ac0d0a62a048a55d091935cb6ea733e52a5b82",
"testharness"
Expand Down Expand Up @@ -611667,7 +611712,7 @@
"testharness"
],
"html/semantics/scripting-1/the-script-element/script-text-modifications.html": [
"7278182e171947bbb546e655de84815ff6cacd83",
"0066d3f4260d92b0f541624062269d13fdbd763d",
"testharness"
],
"html/semantics/scripting-1/the-script-element/script-text-xhtml.xhtml": [
Expand Down Expand Up @@ -613518,6 +613563,26 @@
"1c70fce591a38dd7917e1fffbd1d9ebab46e8b7f",
"testharness"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-refresh-immediate.window.js": [
"8d045b9e0ab56874c5eb32367ed56274e0e94a22",
"testharness"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-refresh-multisecond-header.window.js": [
"8c6c1267c4e899a78bd3ad0e67fd8491fd139606",
"testharness"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-refresh-multisecond-meta.window.js": [
"2895f959e55dc3cf2fdfc933c751699b09438b50",
"testharness"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-while-navigating.window.js": [
"e3efeffb8b3af56d365336dba357e0d76f7295aa",
"testharness"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort.sub.window.js": [
"b2f05cf056d54a0602a55a8dda7c67cb94883055",
"testharness"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js": [
"1d94de8a7c9f28dfab32111deb664d9921437e46",
"testharness"
Expand Down Expand Up @@ -613670,6 +613735,14 @@
"2404105b09a7724cf8cc5e2cf6d7bf7a8fb6f39b",
"support"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/http-refresh.py": [
"d2acd4361f92fe286ab13688a9174ce7c5465755",
"support"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/meta-refresh.py": [
"dd3cef44b44252beb3c7729271c51490a475a660",
"support"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/page-with-frame.html": [
"a1ab01e072b038cd0ec46a8497650845aca83062",
"support"
Expand All @@ -613678,6 +613751,10 @@
"a92a7ae39f8351f97cd865dca5ebe8d4260aa229",
"support"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/slow-png.py": [
"5fa2fd9a9d850a8a0708985034b89aecf4a51654",
"support"
],
"html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/url-frame.html": [
"be483ff0aea456c3bc7f2e62d863e7f981453203",
"support"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
var test5_load = event_test('no src, parser-inserted, has style sheets blocking scripts, script nesting level == 1', false, false);
</script>

<link rel="stylesheet" href="resources/slow.py"></link>
<link rel="stylesheet" href="/common/slow.py"></link>
<!-- This is testing the case where an inline classic script is inserted
by parser while there is an loading stylesheet. Therefore, it is critical to
place a <link rel="stylesheet"> just above the <script> to be tested. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
false, false);

document.write(
`<link rel="stylesheet" href="resources/slow.py"></link>
`<link rel="stylesheet" href="/common/slow.py"></link>
<script onload="onLoad(test6_load);"
onerror="onError(test6_load);">
"use strict";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</script>

<!-- This is "a style sheet that is blocking scripts" and thus ... -->
<link rel="stylesheet" href="resources/slow.py"></link>
<link rel="stylesheet" href="/common/slow.py"></link>

<script src="resources/script-text-modifications.py" async></script>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
// The following tests deal with the <meta http-equiv=refresh> pragma and the
// `Refresh` header. The spec is still hazy on the precise behavior in those
// cases but we use https://github.com/whatwg/html/issues/4003 as a guideline.

async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
frame.onload = t.step_func(() => {
frame.onload = null;

const client = new frame.contentWindow.XMLHttpRequest();
client.open("GET", "/common/blank.html");
client.onabort = t.step_func_done();
client.send();

frame.contentDocument.open();
});
frame.src = "resources/meta-refresh.py?0";
}, "document.open() aborts documents that are queued for navigation through <meta> refresh with timeout 0 (XMLHttpRequest)");

async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
frame.onload = t.step_func(() => {
frame.onload = null;

frame.contentWindow.fetch("/common/blank.html").then(
t.unreached_func("Fetch should have been aborted"),
t.step_func_done());

frame.contentDocument.open();
});
frame.src = "resources/meta-refresh.py?0";
}, "document.open() aborts documents that are queued for navigation through <meta> refresh with timeout 0 (fetch())");

// We cannot test for img element's error event for this test, as Firefox does
// not fire the event if the fetch is aborted while Chrome does.
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
frame.onload = t.step_func(() => {
frame.onload = null;

let happened = false;
const img = frame.contentDocument.createElement("img");
img.src = new URL("resources/slow-png.py", document.URL);
img.onload = t.unreached_func("Image loading should not have succeeded");
// The image fetch starts in a microtask, so let's be sure to test after
// the fetch has started.
t.step_timeout(() => {
frame.contentDocument.open();
happened = true;
});
// If 3 seconds have passed and the image has still not loaded, we consider
// it aborted. slow-png.py only sleeps for 2 wallclock seconds.
t.step_timeout(t.step_func_done(() => {
assert_true(happened);
}), 3000);
});
frame.src = "resources/meta-refresh.py?0";
}, "document.open() aborts documents that are queued for navigation through <meta> refresh with timeout 0 (image loading)");

async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
frame.onload = t.step_func(() => {
frame.onload = null;

const client = new frame.contentWindow.XMLHttpRequest();
client.open("GET", "/common/blank.html");
client.onabort = t.step_func_done();
client.send();

frame.contentDocument.open();
});
frame.src = "resources/http-refresh.py?0";
}, "document.open() aborts documents that are queued for navigation through Refresh header with timeout 0 (XMLHttpRequest)");

async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
frame.onload = t.step_func(() => {
frame.onload = null;

frame.contentWindow.fetch("/common/blank.html").then(
t.unreached_func("Fetch should have been aborted"),
t.step_func_done());

frame.contentDocument.open();
});
frame.src = "resources/http-refresh.py?0";
}, "document.open() aborts documents that are queued for navigation through Refresh header with timeout 0 (fetch())");

// We cannot test for img element's error event for this test, as Firefox does
// not fire the event if the fetch is aborted while Chrome does.
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
frame.onload = t.step_func(() => {
frame.onload = null;

let happened = false;
const img = frame.contentDocument.createElement("img");
img.src = new URL("resources/slow-png.py", document.URL);
img.onload = t.unreached_func("Image loading should not have succeeded");
// The image fetch starts in a microtask, so let's be sure to test after
// the fetch has started.
t.step_timeout(() => {
frame.contentDocument.open();
happened = true;
});
// If 3 seconds have passed and the image has still not loaded, we consider
// it aborted. slow-png.py only sleeps for 2 wallclock seconds.
t.step_timeout(t.step_func_done(() => {
assert_true(happened);
}), 3000);
});
frame.src = "resources/http-refresh.py?0";
}, "document.open() aborts documents that are queued for navigation through Refresh header with timeout 0 (image loading)");
Loading

0 comments on commit c403751

Please sign in to comment.