Update web-platform-tests to revision b'468d01bbd84da2babf265c6af46947be68713440'

This commit is contained in:
WPT Sync Bot 2021-09-07 11:16:33 +00:00 committed by cybai
parent 35e95f55a1
commit 58e8ee674b
9438 changed files with 266112 additions and 106976 deletions

View file

@ -0,0 +1,24 @@
// This tests whether the insertion point gets reset before or after the readystatechange event.
// See https://github.com/whatwg/html/pull/6613#discussion_r620171070.
// Recall that resetting the insertion point means that document.write() performs the document open
// steps and blows away previous content in the document.
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => { frame.remove(); });
frame.src = "../opening-the-input-stream/resources/dummy.html";
frame.onload = t.step_func_done(() => {
const states = [];
frame.contentDocument.onreadystatechange = t.step_func(() => {
if (frame.contentDocument.readyState === "interactive") {
assert_not_equals(frame.contentDocument.textContent, "", "Precondition check: dummy document is not empty");
frame.contentDocument.write("Some text");
// If the insertion point is reset before the readystatechange handler, then the
// document.write() call above will blow away the text originally in dummy.html, leaving only what we wrote.
assert_equals(frame.contentDocument.textContent, "Some text");
}
});
});
}, "document.write() during readystatechange to interactive");

View file

@ -0,0 +1,65 @@
// This tests the issues discussed in https://github.com/whatwg/html/issues/4299
// and fixed in https://github.com/whatwg/html/pull/6567.
// Note: because browsers do not interoperate on the spec's notion of window reuse (see e.g. https://crbug.com/778318)
// we pick a specific interoperable test case, which is "currently on initial about:blank, but loading something".
async_test(t => {
const iframe = document.createElement("iframe");
// We can't just leave it at the actual initial about:blank because of the interop issues mentioned above.
// So put it in the "currently on initial about:blank, but loading something" state which interoperably does Window
// reuse.
iframe.src = "/common/blank.html";
// Create the Window object. It will be for the initial about:blank since the load of /common/blank.html hasn't
// completed.
document.body.append(iframe);
// Store a string on that Window object so we can later test if it's reused.
iframe.contentWindow.persistedString = "Hello world!";
// This will reset the initial about:blank-ness. But, it will also cancel any ongoing loads.
iframe.contentDocument.open();
// So, re-start the load of /common/blank.html.
iframe.src = "/common/blank.html";
// When the load finally happens, will it reuse the Window object or not?
// Because document.open() resets the initial about:blank-ness, it will *not* reuse the Window object.
// The point of the test is to assert that.
iframe.addEventListener("load", t.step_func_done(() => {
assert_equals(
iframe.contentDocument.URL,
iframe.src,
"Prerequisite check: we are getting the right load event"
);
assert_equals(iframe.contentWindow.persistedString, undefined);
}), { once: true });
}, "document.open() removes the initial about:blank-ness of the document");
// This test is redundant with others in WPT but it's intended to make it clear that document.open() is the
// distinguishing factor. It does the same exact thing but without document.open() and with the resulting final assert
// flipped.
async_test(t => {
const iframe = document.createElement("iframe");
iframe.src = "/common/blank.html";
document.body.append(iframe);
iframe.contentWindow.persistedString = "Hello world!";
// NO document.open() call.
iframe.src = "/common/blank.html";
iframe.addEventListener("load", t.step_func_done(() => {
assert_equals(
iframe.contentDocument.URL,
iframe.src,
"Prerequisite check: we are getting the right load event"
);
assert_equals(iframe.contentWindow.persistedString, "Hello world!");
}), { once: true });
}, "Double-check: without document.open(), Window reuse indeed happens");

View file

@ -1,7 +1,7 @@
from base64 import decodestring
import time
from base64 import decodebytes
png_response = decodestring(b'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg==')
png_response = decodebytes(b'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg==')
def main(request, response):
time.sleep(2)