Debugging patch for bug 1157901

This commit is contained in:
Ehsan Akhgari 2015-04-29 08:31:29 -04:00
Родитель 61f0c79664
Коммит 531d28100a
3 изменённых файлов: 13 добавлений и 0 удалений

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

@ -17,18 +17,24 @@
var registration;
var promise;
SimpleTest.requestCompleteLog();
function start() {
info("start got called");
return navigator.serviceWorker.register("worker_updatefoundevent.js",
{ scope: "./updatefoundevent.html" })
.then((swr) => registration = swr);
}
function startWaitForUpdateFound() {
info("startWaitForUpdateFound got called");
registration.onupdatefound = function(e) {
info("onupdatefound");
}
promise = new Promise(function(resolve, reject) {
window.onmessage = function(e) {
info("Got message " + e.data);
if (e.data == "finish") {
ok(true, "Received updatefound");
@ -46,15 +52,18 @@
}
function registerNext() {
info("registerNext got called");
return navigator.serviceWorker.register("worker_updatefoundevent2.js",
{ scope: "./updatefoundevent.html" });
}
function waitForUpdateFound() {
info("waitForUpdateFound got called");
return promise;
}
function unregister() {
info("unregister got called");
return registration.unregister().then(function(result) {
ok(result, "Unregister should return true.");
});
@ -76,6 +85,7 @@
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["browser.dom.window.dump.enabled", true],
]}, runTest);
</script>
</pre>

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

@ -6,8 +6,10 @@
onactivate = function(e) {
e.waitUntil(new Promise(function(resolve, reject) {
registration.onupdatefound = function(e) {
dump("Update found for scope " + registration.scope + "\n");
clients.matchAll().then(function(clients) {
if (!clients.length) {
dump("No clients found\n");
reject("No clients found");
}

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

@ -1 +1,2 @@
// Not useful.
dump("worker_updatefoundevent2.js loaded\n");