Bug 1130570 - Tests use iframe instead of window.open. r=nsm

--HG--
extra : rebase_source : 30c2a3921cfa5208257da144ae496967a14d6511
This commit is contained in:
Andrea Marchesini 2015-02-12 15:10:11 -08:00
Родитель 00d3e72974
Коммит c5a2a88f83
2 изменённых файлов: 14 добавлений и 5 удалений

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

@ -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)