mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-16 04:07:31 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
29
dom/workers/test/serviceworkers/sharedWorker_fetch.js
Normal file
29
dom/workers/test/serviceworkers/sharedWorker_fetch.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
var clients = new Array();
|
||||
clients.length = 0;
|
||||
|
||||
var broadcast = function(message) {
|
||||
var length = clients.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
port = clients[i];
|
||||
port.postMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
onconnect = function(e) {
|
||||
clients.push(e.ports[0]);
|
||||
if (clients.length == 1) {
|
||||
clients[0].postMessage("Connected");
|
||||
} else if (clients.length == 2) {
|
||||
broadcast("BothConnected");
|
||||
clients[0].onmessage = function(e) {
|
||||
if (e.data == "StartFetchWithWrongIntegrity") {
|
||||
// The fetch will succeed because the integrity value is invalid and we
|
||||
// are looking for the console message regarding the bad integrity value.
|
||||
fetch("SharedWorker_SRIFailed.html", {"integrity": "abc"}).then(
|
||||
function () {
|
||||
clients[0].postMessage('SRI_failed');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue