mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-14 03: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
62
dom/workers/test/serviceworkers/test_workerUpdate.html
Normal file
62
dom/workers/test/serviceworkers/test_workerUpdate.html
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1065366 - Test ServiceWorkerGlobalScope.update</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
function simpleRegister() {
|
||||
return navigator.serviceWorker.register("worker_update.js", { scope: "workerUpdate/" });
|
||||
}
|
||||
|
||||
var registration;
|
||||
function waitForMessages(sw) {
|
||||
registration = sw;
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
window.onmessage = function(e) {
|
||||
if (e.data === "FINISH") {
|
||||
ok(true, "The worker has updated itself");
|
||||
resolve();
|
||||
} else if (e.data === "FAIL") {
|
||||
ok(false, "The worker failed to update itself");
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var frame = document.createElement("iframe");
|
||||
frame.setAttribute("src", "workerUpdate/update.html");
|
||||
document.body.appendChild(frame);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
simpleRegister().then(waitForMessages).catch(function(e) {
|
||||
ok(false, "Something went wrong.");
|
||||
}).then(function() {
|
||||
return registration.unregister();
|
||||
}).then(function() {
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["dom.serviceWorkers.exemptFromPerDomainMax", true],
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
["dom.serviceWorkers.testing.enabled", true]
|
||||
]}, runTest);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue