Update web-platform-tests to revision ef625c6ac28d0ac07ef0c62a6f22c10d14a2623a

This commit is contained in:
WPT Sync Bot 2019-01-23 21:00:43 -05:00
parent 5b41c01bdc
commit bd01f2fabd
125 changed files with 3871 additions and 323 deletions

View file

@ -1,12 +1,12 @@
// Opens |url| in an iframe, establish a message channel with it, and waits for
// a message from the frame content. Returns a promise that resolves with the
// data of the message, or rejects on 2000ms timeout.
function openSXGInIframeAndWaitForMessage(test_object, url) {
function openSXGInIframeAndWaitForMessage(test_object, url, referrerPolicy) {
return new Promise(async (resolve, reject) => {
// We can't catch the network error on iframe. So we use the timer.
test_object.step_timeout(() => reject('timeout'), 2000);
const frame = await withIframe(url, 'sxg_iframe');
const frame = await withIframe(url, 'sxg_iframe', referrerPolicy);
const channel = new MessageChannel();
channel.port1.onmessage = (event) => resolve(event.data);
frame.contentWindow.postMessage(
@ -14,11 +14,14 @@ function openSXGInIframeAndWaitForMessage(test_object, url) {
});
}
function withIframe(url, name) {
function withIframe(url, name, referrerPolicy) {
return new Promise((resolve, reject) => {
const frame = document.createElement('iframe');
frame.src = url;
frame.name = name;
if (referrerPolicy !== undefined) {
frame.referrerPolicy = referrerPolicy;
}
frame.onload = () => resolve(frame);
frame.onerror = () => reject('failed to load ' + url);
document.body.appendChild(frame);