mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update web-platform-tests to revision e87f38097902e16348d4e17f4fe3bc2d0112bff1
This commit is contained in:
parent
2f8fa32e91
commit
db5631a086
381 changed files with 11610 additions and 4232 deletions
|
@ -304,6 +304,26 @@ function requestViaLinkPrefetch(url) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates a new beacon request.
|
||||
* @param {string} url The URL of a resource to prefetch.
|
||||
* @return {Promise} The promise for success/error events.
|
||||
*/
|
||||
async function requestViaSendBeacon(url) {
|
||||
function wait(ms) {
|
||||
return new Promise(resolve => step_timeout(resolve, ms));
|
||||
}
|
||||
if (!navigator.sendBeacon(url)) {
|
||||
// If mixed-content check fails, it should return false.
|
||||
throw new Error('sendBeacon() fails.');
|
||||
}
|
||||
// We don't have a means to see the result of sendBeacon() request
|
||||
// for sure. Let's wait for a while and let the generic test function
|
||||
// ask the server for the result.
|
||||
await wait(500);
|
||||
return 'allowed';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new media element with a child source element, binds loadeddata and
|
||||
* error events, sets attributes and appends to document.body.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue