mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 1465670 P7 Make the fetch mochitest reroute test framework use a unique scope. r=asuth
This commit is contained in:
parent
f91f6158ab
commit
81094133b3
@ -1,11 +1,13 @@
|
||||
var gRegistration;
|
||||
var iframe;
|
||||
|
||||
function testScript(script) {
|
||||
var scope = "./reroute.html?" + script.replace(".js", "");
|
||||
function setupSW(registration) {
|
||||
gRegistration = registration;
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "reroute.html?" + script.replace(".js", "");
|
||||
iframe = document.createElement("iframe");
|
||||
iframe.src = scope;
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
@ -16,13 +18,14 @@ function testScript(script) {
|
||||
}, function() {
|
||||
var scriptURL = location.href.includes("sw_empty_reroute.html")
|
||||
? "empty.js" : "reroute.js";
|
||||
navigator.serviceWorker.register(scriptURL, {scope: "/"})
|
||||
navigator.serviceWorker.register(scriptURL, {scope: scope})
|
||||
.then(swr => waitForState(swr.installing, 'activated', swr))
|
||||
.then(setupSW);
|
||||
});
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
iframe.remove();
|
||||
gRegistration.unregister().then(SimpleTest.finish, function(e) {
|
||||
dump("unregistration failed: " + e + "\n");
|
||||
SimpleTest.finish();
|
||||
|
Loading…
Reference in New Issue
Block a user