Backed out changeset 99a4fb4ba5c1 (bug 1172870) for causing test regressions m4 on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2015-10-30 16:41:32 +01:00
Родитель cb10921e0d
Коммит 7351a2cd94
4 изменённых файлов: 36 добавлений и 115 удалений

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

@ -190,7 +190,6 @@ support-files =
header_checker.sjs
openWindow_worker.js
redirect.sjs
open_window/client.html
[test_app_protocol.html]
skip-if = release_build
@ -288,5 +287,5 @@ skip-if = e10s # Bug 1214305
skip-if = e10s # Bug 1214305
[test_serviceworker_header.html]
[test_openWindow.html]
skip-if = toolkit == "android" || toolkit == "gonk"
skip-if = toolkit == "android" || toolkit == "gonk" || e10s
[test_imagecache_max_age.html]

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

@ -1,16 +1,7 @@
// the worker won't shut down between events because we increased
// the timeout values.
var client;
var window_count = 0;
var expected_window_count = 6;
var resolve_got_all_windows = null;
var got_all_windows = new Promise(function(res, rej) {
resolve_got_all_windows = res;
});
// |expected_window_count| needs to be updated for every new call that's
// expected to actually open a new window regardless of what |clients.openWindow|
// returns.
function testForUrl(url, throwType, clientProperties, resultsArray) {
return clients.openWindow(url)
.then(function(e) {
@ -52,64 +43,48 @@ function testForUrl(url, throwType, clientProperties, resultsArray) {
}
onmessage = function(event) {
if (event.data == "testNoPopup") {
client = event.source;
client = event.source;
var results = [];
var promises = [];
promises.push(testForUrl("about:blank", "TypeError", null, results));
promises.push(testForUrl("http://example.com", "InvalidAccessError", null, results));
promises.push(testForUrl("_._*`InvalidURL", "InvalidAccessError", null, results));
Promise.all(promises).then(function(e) {
client.postMessage(results);
});
}
if (event.data == "NEW_WINDOW") {
window_count += 1;
if (window_count == expected_window_count) {
resolve_got_all_windows();
}
}
if (event.data == "CHECK_NUMBER_OF_WINDOWS") {
got_all_windows.then(function() {
return clients.matchAll();
}).then(function(cl) {
event.source.postMessage({result: cl.length == expected_window_count,
message: "The number of windows is correct."});
for (i = 0; i < cl.length; i++) {
cl[i].postMessage("CLOSE");
}
});
}
var results = [];
var promises = [];
promises.push(testForUrl("about:blank", "TypeError", null, results));
promises.push(testForUrl("http://example.com", "InvalidAccessError", null, results));
promises.push(testForUrl("_._*`InvalidURL", "InvalidAccessError", null, results));
Promise.all(promises).then(function(e) {
client.postMessage(results);
});
}
onnotificationclick = function(e) {
var results = [];
var promises = [];
var redirect = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/redirect.sjs?"
var redirect_xorigin = "http://example.com/tests/dom/workers/test/serviceworkers/redirect.sjs?"
var same_origin = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/open_window/client.html"
var different_origin = "http://example.com/tests/dom/workers/test/serviceworkers/open_window/client.html"
promises.push(testForUrl("about:blank", "TypeError", null, results));
promises.push(testForUrl(different_origin, null, null, results));
promises.push(testForUrl(same_origin, null, {url: same_origin}, results));
promises.push(testForUrl("http://example.com", null, null, results));
promises.push(testForUrl("http://mochi.test:8888/same_origin.html", null,
{url: "http://mochi.test:8888/same_origin.html"}, results));
// redirect tests
promises.push(testForUrl(redirect + "open_window/client.html", null,
{url: same_origin}, results));
promises.push(testForUrl(redirect + different_origin, null, null, results));
promises.push(testForUrl(redirect_xorigin + "open_window/client.html", null,
var redirect = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/redirect.sjs?"
var baseURL = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/"
promises.push(testForUrl(redirect + "same_origin_redirect.html", null,
{url: baseURL + "same_origin_redirect.html"}, results));
promises.push(testForUrl(redirect + "http://example.com/redirect_to_other_origin.html", null,
null, results));
promises.push(testForUrl(redirect_xorigin + same_origin, null,
{url: same_origin}, results));
var redirect_xorigin = "http://example.com/tests/dom/workers/test/serviceworkers/redirect.sjs?"
promises.push(testForUrl(redirect_xorigin + "xorigin_redirect.html", null,
null, results));
promises.push(testForUrl(redirect_xorigin + "http://mochi.test:8888/xorigin_to_same_origin.html", null,
{url: "http://mochi.test:8888/xorigin_to_same_origin.html"}, results));
Promise.all(promises).then(function(e) {
client.postMessage(results);
});
}
onfetch = function(e) {
if (e.request.url.indexOf(same_origin) >= 0) {
e.respondWith(new Response("same_origin_window"));
}
}

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

@ -1,48 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>Bug 1172870 - page opened by ServiceWorkerClients.OpenWindow</title>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<script class="testbody" type="text/javascript">
window.onload = function() {
if (window.location == "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/open_window/client.html") {
navigator.serviceWorker.ready.then(function(result) {
navigator.serviceWorker.onmessage = function(event) {
if (event.data !== "CLOSE") {
dump("ERROR: unexepected reply from the service worker.\n");
}
if (parent) {
parent.postMessage("CLOSE", "*");
}
window.close();
}
navigator.serviceWorker.controller.postMessage("NEW_WINDOW");
})
} else {
window.onmessage = function(event) {
if (event.data !== "CLOSE") {
dump("ERROR: unexepected reply from the iframe.\n");
}
window.close();
}
var iframe = document.createElement('iframe');
iframe.src = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/open_window/client.html";
document.body.appendChild(iframe);
}
}
</script>
</pre>
</body>
</html>

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

@ -65,20 +65,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1172870
return p;
}
function checkNumberOfWindows(ctx) {
return new Promise(function(res, rej) {
navigator.serviceWorker.onmessage = function(event) {
navigator.serviceWorker.onmessage = null;
ok(event.data.result, event.data.message);
res(ctx);
}
ctx.registration.active.postMessage("CHECK_NUMBER_OF_WINDOWS");
});
}
function clear(ctx) {
MockServices.unregister();
var browser = SpecialPowers.Services.wm.getMostRecentWindow("navigator:browser").gBrowser;
ok(browser.tabs.length == 7, "Total number of tabs is correct.");
while (browser.tabs.length > 1) {
browser.removeTab(browser.tabs[1]);
}
return ctx.registration.unregister().then(function(result) {
ctx.registration = null;
ok(result, "Unregister was successful.");
@ -92,7 +88,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1172870
// click event, so the order here is important.
.then(testPopupNotAllowed)
.then(testPopupAllowed)
.then(checkNumberOfWindows)
.then(clear)
.catch(function(e) {
ok(false, "Some test failed with error " + e);