mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
Update web-platform-tests to revision 314de955a5102650136404f6439f22f8d838e0f4
This commit is contained in:
parent
521748c01e
commit
6b4094e2a4
133 changed files with 1609 additions and 628 deletions
|
@ -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);
|
Loading…
Add table
Add a link
Reference in a new issue