Update web-platform-tests to revision d73b07b850fa51f23e846518bb6e8c59c58eef19

This commit is contained in:
WPT Sync Bot 2019-04-29 21:53:13 -04:00
parent 62031e3cb0
commit 7776ed79d7
107 changed files with 3306 additions and 538 deletions

View file

@ -924,11 +924,6 @@ const subresourceMap = {
invoker: url =>
requestViaDedicatedWorker(workerUrlThatImports(url), {type: "module"}),
},
"classic-data-worker-fetch": {
path: "/common/security-features/subresource/empty.py",
invoker: url =>
requestViaDedicatedWorker(dedicatedWorkerUrlThatFetches(url), {}),
},
"shared-worker": {
path: "/common/security-features/subresource/shared-worker.py",
invoker: requestViaSharedWorker,
@ -1064,12 +1059,32 @@ function invokeRequest(subresource, sourceContextList) {
"iframe": { // <iframe src="same-origin-URL"></iframe>
invoker: invokeFromIframe,
},
"classic-worker": {
// Classic dedicated worker loaded from same-origin.
invoker: invokeFromWorker.bind(undefined, false, {}),
},
"classic-data-worker": {
// Classic dedicated worker loaded from data: URL.
invoker: invokeFromWorker.bind(undefined, true, {}),
},
"module-worker": {
// Module dedicated worker loaded from same-origin.
invoker: invokeFromWorker.bind(undefined, false, {type: 'module'}),
},
"module-data-worker": {
// Module dedicated worker loaded from data: URL.
invoker: invokeFromWorker.bind(undefined, true, {type: 'module'}),
},
};
return sourceContextMap[sourceContextList[0].sourceContextType].invoker(
subresource, sourceContextList);
}
// Quick hack to expose invokeRequest when common.js is loaded either
// as a classic or module script.
self.invokeRequest = invokeRequest;
/**
invokeFrom*() functions are helper functions with the same parameters
and return values as invokeRequest(), that are tied to specific types
@ -1078,6 +1093,51 @@ function invokeRequest(subresource, sourceContextList) {
sourceContextList[0] is an iframe.
*/
/**
@param {boolean} isDataUrl
true if the worker script is loaded from data: URL.
Otherwise, the script is loaded from same-origin.
@param {object} workerOptions
The `options` argument for Worker constructor.
Other parameters and return values are the same as those of invokeRequest().
*/
function invokeFromWorker(isDataUrl, workerOptions,
subresource, sourceContextList) {
const currentSourceContext = sourceContextList.shift();
let workerUrl =
"/common/security-features/scope/worker.py?policyDeliveries=" +
encodeURIComponent(JSON.stringify(
currentSourceContext.policyDeliveries || []));
if (workerOptions.type === 'module') {
workerUrl += "&type=module";
}
let promise;
if (isDataUrl) {
promise = fetch(workerUrl)
.then(r => r.text())
.then(source => {
return 'data:text/javascript;base64,' + btoa(source);
});
} else {
promise = Promise.resolve(workerUrl);
}
return promise
.then(url => {
const worker = new Worker(url, workerOptions);
worker.postMessage({subresource: subresource,
sourceContextList: sourceContextList});
return bindEvents2(worker, "message", worker, "error", window, "error");
})
.then(event => {
if (event.data.error)
return Promise.reject(event.data.error);
return event.data;
});
}
function invokeFromIframe(subresource, sourceContextList) {
const currentSourceContext = sourceContextList.shift();
const frameUrl =