mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +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
|
@ -1,6 +1,3 @@
|
|||
const url_base = "/feature-policy/experimental-features/resources/";
|
||||
window.messageResponseCallback = null;
|
||||
|
||||
function rectMaxY(rect) {
|
||||
return rect.height + rect.y;
|
||||
}
|
||||
|
@ -23,33 +20,6 @@ function rects_intersect(rect1, rect2) {
|
|||
rect2.y < rectMaxY(rect1);
|
||||
}
|
||||
|
||||
// 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 rectToString(rect) {
|
||||
return `Location: (${rect.x}, ${rect.y}) Size: (${rect.width}, ${rect.height})`;
|
||||
}
|
||||
|
||||
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