Update web-platform-tests to revision 314de955a5102650136404f6439f22f8d838e0f4

This commit is contained in:
WPT Sync Bot 2018-05-23 21:10:23 -04:00
parent 521748c01e
commit 6b4094e2a4
133 changed files with 1609 additions and 628 deletions

View file

@ -0,0 +1,34 @@
const url_base = "/feature-policy/experimental-features/resources/";
window.messageResponseCallback = null;
function setFeatureState(iframe, feature, origins) {
iframe.setAttribute("allow", `${feature} ${origins};`);
}
// Returns a promise which is resolved when the <iframe> is navigated to |url|
// and "load" handler has been called.
function loadUrlInIframe(iframe, url) {
return new Promise((resolve) => {
iframe.addEventListener("load", resolve);
iframe.src = url;
});
}
// Posts |message| to |target| and resolves the promise with the response coming
// back from |target|.
function sendMessageAndGetResponse(target, message) {
return new Promise((resolve) => {
window.messageResponseCallback = resolve;
target.postMessage(message, "*");
});
}
function onMessage(e) {
if (window.messageResponseCallback) {
window.messageResponseCallback(e.data);
window.messageResponseCallback = null;
}
}
window.addEventListener("message", onMessage);