Bug 1423507 - Data URL Shared Workers must be shared when the parent origins match - WPT, r=bkelly

This commit is contained in:
Andrea Marchesini 2017-12-07 12:32:06 +01:00
Родитель 65b913c5f4
Коммит 4aa1ef9c23
3 изменённых файлов: 95 добавлений и 0 удалений

Просмотреть файл

@ -286741,6 +286741,11 @@
{}
]
],
"workers/support/iframe_sw_dataUrl.html": [
[
{}
]
],
"workers/support/name-as-accidental-global.js": [
[
{}
@ -352264,6 +352269,12 @@
{}
]
],
"workers/SharedWorker_dataUrl.html": [
[
"/workers/SharedWorker_dataUrl.html",
{}
]
],
"workers/WorkerGlobalScope_ErrorEvent_colno.htm": [
[
"/workers/WorkerGlobalScope_ErrorEvent_colno.htm",
@ -581861,6 +581872,10 @@
"d74620a63e7d911ef60b995cabf6b360c2c46a4f",
"testharness"
],
"workers/SharedWorker_dataUrl.html": [
"f65d3caef416775c970a554448cebdf02580428f",
"testharness"
],
"workers/WorkerGlobalScope_ErrorEvent_colno.htm": [
"8ceb41543f928c918010000d638099faeb674980",
"testharness"
@ -582865,6 +582880,10 @@
"b0e679dd7720701364abeaca6870d94db5d7ee74",
"support"
],
"workers/support/iframe_sw_dataUrl.html": [
"2cd66112b612e7b861af00af5ccc26cc7c5a76f8",
"support"
],
"workers/support/name-as-accidental-global.js": [
"530670268fae610b60066773ee475743b8498b53",
"support"

Просмотреть файл

@ -0,0 +1,63 @@
<!DOCTYPE html>
<title>Shared Worker: Data URL cross-origin checks</title>
<script src="/common/get-host-info.sub.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
</body>
<script>
function dirname(path) {
return path.replace(/\/[^\/]*$/, '/');
}
promise_test(t => {
return new Promise(function(resolve) {
let count = 0;
onmessage = e => {
assert_equals(e.data, 1);
if (++count == 2) {
resolve(true);
}
};
let iframeA = document.createElement('iframe');
document.body.appendChild(iframeA);
iframeA.src = get_host_info().HTTP_REMOTE_ORIGIN +
dirname(location.pathname) +
"support/iframe_sw_dataUrl.html";
let iframeB = document.createElement('iframe');
document.body.appendChild(iframeB);
iframeB.src = get_host_info().HTTPS_REMOTE_ORIGIN +
dirname(location.pathname) +
"support/iframe_sw_dataUrl.html";
});
}, 'Data URL not shared by cross-origin SharedWorkers');
promise_test(t => {
return new Promise(function(resolve) {
let count = 0;
onmessage = e => {
assert_equals(e.data, ++count);
if (count == 2) {
resolve(true);
}
};
let iframeA = document.createElement('iframe');
document.body.appendChild(iframeA);
iframeA.src = get_host_info().HTTP_ORIGIN +
dirname(location.pathname) +
"support/iframe_sw_dataUrl.html";
let iframeB = document.createElement('iframe');
document.body.appendChild(iframeB);
iframeB.src = get_host_info().HTTP_ORIGIN +
dirname(location.pathname) +
"support/iframe_sw_dataUrl.html";
});
}, 'Data URLs shared by same-origin SharedWorkers');
</script>
</html>

Просмотреть файл

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>Iframe for Shared Worker: Data URL cross-origin checks</title>
<body>
<script>
let worker = new SharedWorker('data:text/javascript,let conns=0; onconnect = e => { e.ports[0].postMessage(++conns); }');
worker.port.onmessage = e => {
parent.postMessage(e.data, '*');
}
</script>
</body>
</html>