Update web-platform-tests to revision d7afcb8708eac08a614d161d5622a48172daf7e3

This commit is contained in:
WPT Sync Bot 2019-05-15 10:40:54 -04:00 committed by Josh Matthews
parent 6f8bb4dd40
commit edff458e23
791 changed files with 17647 additions and 10322 deletions

View file

@ -0,0 +1,17 @@
const windowProps = ["innerWidth", "innerHeight"];
["noopener", "noreferrer"].forEach(openerStyle => {
async_test(t => {
const channelName = "34342" + openerStyle + "8907";
const channel = new BroadcastChannel(channelName);
window.open("support/sizing-target.html?" + channelName, "", openerStyle);
channel.onmessage = t.step_func_done(e => {
// Send message first so if asserts throw the popup is still closed
channel.postMessage(null);
for(const prop of windowProps) {
assert_equals(window[prop], e.data[prop]);
}
});
}, `window.open() with ${openerStyle} should have equal viewport width and height`);
});

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<script>
const windowProps = ["innerWidth", "innerHeight"];
const windowPropsObj = {};
const channelName = location.search.substr(1);
const channel = new BroadcastChannel(channelName);
for (const prop of windowProps) {
windowPropsObj[prop] = window[prop];
}
channel.postMessage(windowPropsObj);
// Because messages are not delivered synchronously and because closing a
// browsing context prompts the eventual clearing of all task sources, this
// document should not be closed until the opener document has confirmed
// receipt.
channel.onmessage = () => { window.close() };
</script>

View file

@ -12,27 +12,30 @@
<script src=/resources/testharnessreport.js></script>
<script>
var testData = [
{ testDescription: "window.open() with 'noopener' should not reuse existing target",
{ testDescription: "window.open() with 'noopener' should reuse existing target",
secondWindowFeatureString: "noopener",
shouldReuse: false },
shouldReturnWindow: false },
{ testDescription: "noopener=1 means the same as noopener",
secondWindowFeatureString: "noopener=1",
shouldReuse: false },
shouldReturnWindow: false },
{ testDescription: "noopener=0 means lack of noopener",
secondWindowFeatureString: "noopener=0",
shouldReuse: true },
{ testDescription: "noopener needs to be present as a token on its own",
shouldReturnWindow: true },
{ testDescription: "noopener separated only by spaces should work",
secondWindowFeatureString: "make me noopener",
shouldReuse: true },
shouldReturnWindow: false },
{ testDescription: "Trailing noopener should work",
secondWindowFeatureString: "abc def, \n\r noopener",
shouldReuse: false },
shouldReturnWindow: false },
{ testDescription: "Leading noopener should work",
secondWindowFeatureString: "noopener \f\t , hey, there",
shouldReuse: false },
shouldReturnWindow: false },
{ testDescription: "Interior noopener should work",
secondWindowFeatureString: "and now, noopener , hey, there",
shouldReuse: false },
shouldReturnWindow: false },
{ testDescription: "noreferrer should also suppress opener when reusing existing target",
secondWindowFeatureString: "noreferrer",
shouldReturnWindow: false },
];
/**
@ -54,7 +57,7 @@ function indexedTests() {
t.secondWindowFeatureString = test.secondWindowFeatureString;
t.windowName = "someuniquename" + i;
if (test.shouldReuse) {
if (test.shouldReturnWindow) {
t.step(function() {
var windowName = this.windowName;
@ -83,9 +86,9 @@ function indexedTests() {
channel.onmessage = this.step_func_done(function(e) {
var data = e.data;
assert_equals(data.name, windowName, "Should have the right name");
assert_equals(data.haveOpener, false, "Should not have opener");
assert_equals(data.haveOpener, true, "Should still have opener");
assert_equals(w1.opener, window);
assert_equals(w1.location.href, "about:blank");
assert_not_equals(w1.location.href, "about:blank", "Should have navigated");
});
w1 = window.open("", windowName);