зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1130570 - Tests use iframe instead of window.open. r=nsm
--HG-- extra : rebase_source : 30c2a3921cfa5208257da144ae496967a14d6511
This commit is contained in:
Родитель
00d3e72974
Коммит
c5a2a88f83
|
@ -17,11 +17,11 @@
|
|||
|
||||
// Make sure to use good, unique messages, since the actual expression will not show up in test results.
|
||||
function my_ok(result, msg) {
|
||||
window.opener.postMessage({status: "ok", result: result, message: msg}, "*");
|
||||
parent.postMessage({status: "ok", result: result, message: msg}, "*");
|
||||
}
|
||||
|
||||
function finish() {
|
||||
window.opener.postMessage({status: "done"}, "*");
|
||||
parent.postMessage({status: "done"}, "*");
|
||||
}
|
||||
|
||||
navigator.serviceWorker.ready.then(function(swr) {
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
<pre id="test"></pre>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var content;
|
||||
var iframe;
|
||||
|
||||
function simpleRegister() {
|
||||
// We use the control scope for the less specific registration. The window will register a worker on controller/
|
||||
return navigator.serviceWorker.register("worker.js", { scope: "./control" });
|
||||
|
@ -27,17 +30,23 @@
|
|||
ok(e.data.result, e.data.message);
|
||||
} else if (e.data.status == "done") {
|
||||
window.onmessage = null;
|
||||
w.close();
|
||||
content.removeChild(iframe);
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var w = window.open("controller/index.html");
|
||||
content = document.getElementById("content");
|
||||
ok(content, "Parent exists.");
|
||||
|
||||
iframe = document.createElement("iframe");
|
||||
iframe.setAttribute('src', "controller/index.html");
|
||||
content.appendChild(iframe);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
// This document just flips the prefs and opens the window for the actual test.
|
||||
// This document just flips the prefs and opens the iframe for the actual test.
|
||||
function runTest() {
|
||||
simpleRegister()
|
||||
.then(testController)
|
||||
|
|
Загрузка…
Ссылка в новой задаче