blob: d4ebd1323c30c5e157e1f0910a940d42f983f03c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/**
* Bug 1264593 - A test case for the shared worker by first party isolation.
*/
const TEST_DOMAIN = "https://example.net/";
const TEST_PATH =
TEST_DOMAIN + "browser/browser/components/originattributes/test/browser/";
const TEST_PAGE = TEST_PATH + "file_sharedworker.html";
async function getResultFromSharedworker(aBrowser) {
let response = await SpecialPowers.spawn(aBrowser, [], async function () {
let worker = new content.SharedWorker(
"file_sharedworker.js",
"isolationSharedWorkerTest"
);
let result = await new content.Promise(resolve => {
worker.port.onmessage = function (e) {
// eslint-disable-next-line no-unsanitized/property
content.document.getElementById("display").innerHTML = e.data;
resolve(e.data);
};
});
return result;
});
return response;
}
IsolationTestTools.runTests(TEST_PAGE, getResultFromSharedworker);
|