Backed out 3 changesets (bug 1172884, bug 1169819) for OS X timeouts in browser_force_refresh.js in bc3

CLOSED TREE

Backed out changeset 7b23ff6ac3a2 (bug 1169819)
Backed out changeset 1434730c0e19 (bug 1172884)
Backed out changeset 17d6ecf1b4ec (bug 1172884)
This commit is contained in:
Phil Ringnalda 2015-06-11 20:57:24 -07:00
parent bc144efbe5
commit de099ff5ab
13 changed files with 4 additions and 289 deletions

View File

@ -122,10 +122,6 @@ MOCHITEST_CHROME_MANIFESTS += [
'test/serviceworkers/chrome.ini'
]
BROWSER_CHROME_MANIFESTS += [
'test/serviceworkers/browser.ini',
]
XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

View File

@ -1,7 +0,0 @@
[DEFAULT]
support-files =
browser_base_force_refresh.html
browser_cached_force_refresh.html
force_refresh_browser_worker.js
[browser_force_refresh.js]

View File

@ -1,30 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<script type="text/javascript">
addEventListener('load', function(event) {
navigator.serviceWorker.register('force_refresh_browser_worker.js').then(function(swr) {
if (!swr) {
return;
}
var custom = new Event('base-register', { bubbles: true });
document.dispatchEvent(custom);
});
navigator.serviceWorker.ready.then(function() {
var custom = new Event('base-sw-ready', { bubbles: true });
document.dispatchEvent(custom);
});
var custom = new Event('base-load', { bubbles: true });
document.dispatchEvent(custom);
});
</script>
</body>
</html>

View File

@ -1,17 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<script type="text/javascript">
addEventListener('load', function(event) {
var custom = new Event('cached-load', { bubbles: true });
document.dispatchEvent(custom);
});
</script>
</body>
</html>

View File

@ -1,54 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/",
"http://mochi.test:8888/")
function refresh() {
EventUtils.synthesizeKey('R', { ctrlKey: true });
}
function forceRefresh() {
EventUtils.synthesizeKey('R', { ctrlKey: true, shiftKey: true });
}
function test() {
waitForExplicitFinish();
SpecialPowers.pushPrefEnv({'set': [['dom.serviceWorkers.enabled', true],
['dom.serviceWorkers.exemptFromPerDomainMax', true],
['dom.serviceWorkers.testing.enabled', true],
['dom.caches.enabled', true]]},
function() {
var url = gTestRoot + 'browser_base_force_refresh.html';
var tab = gBrowser.addTab(url);
gBrowser.selectedTab = tab;
var cachedLoad = false;
function eventHandler(event) {
if (event.type === 'base-load') {
if (cachedLoad) {
gBrowser.removeTab(tab);
executeSoon(finish);
}
} else if (event.type === 'base-register') {
ok(!cachedLoad, 'cached load should not occur before base register');
refresh();
} else if (event.type === 'base-sw-ready') {
ok(!cachedLoad, 'cached load should not occur before base ready');
refresh();
} else if (event.type === 'cached-load') {
ok(!cachedLoad, 'cached load should not occur twice');
cachedLoad = true;
forceRefresh();
}
return;
}
addEventListener('base-load', eventHandler, true, true);
addEventListener('base-register', eventHandler, true, true);
addEventListener('base-sw-ready', eventHandler, true, true);
addEventListener('cached-load', eventHandler, true, true);
});
}

View File

@ -1,22 +0,0 @@
var name = 'browserRefresherCache';
self.addEventListener('install', function(event) {
event.waitUntil(
Promise.all([caches.open(name),
fetch('./browser_cached_force_refresh.html')]).then(function(results) {
var cache = results[0];
var response = results[1];
return cache.put('./browser_base_force_refresh.html', response);
})
);
});
self.addEventListener('fetch', function (event) {
event.respondWith(
caches.open(name).then(function(cache) {
return cache.match(event.request);
}).then(function(response) {
return response || fetch(event.request);
})
);
});

View File

@ -1,13 +0,0 @@
self.addEventListener('fetch', function (event) {
if (!event.request.url.endsWith('sw_clients/does_not_exist.html')) {
return;
}
event.respondWith(new Response('', {
status: 301,
statusText: 'Moved Permanently',
headers: {
'Location': 'refresher_compressed.html'
}
}));
});

View File

@ -134,8 +134,6 @@ support-files =
thirdparty/register.html
thirdparty/unregister.html
thirdparty/sw.js
gzip_redirect_worker.js
sw_clients/navigator.html
[test_unregister.html]
[test_installation_simple.html]
@ -186,5 +184,4 @@ support-files =
[test_origin_after_redirect_to_https_cached.html]
[test_https_origin_after_redirect.html]
[test_https_origin_after_redirect_cached.html]
[test_gzip_redirect.html]
[test_register_base.html]

View File

@ -1,35 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>Bug 982726 - test match_all not crashing</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<script class="testbody" type="text/javascript">
if (!parent) {
dump("sw_clients/navigator.html shouldn't be launched directly!\n");
}
window.addEventListener("message", function(event) {
if (event.data.type === "NAVIGATE") {
window.location = event.data.url;
}
});
navigator.serviceWorker.ready.then(function() {
parent.postMessage("NAVIGATOR_READY", "*");
});
</script>
</pre>
</body>
</html>

View File

@ -1,84 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>Bug 982726 - Test service worker post message </title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<script class="testbody" type="text/javascript">
var registration;
function start() {
return navigator.serviceWorker.register("gzip_redirect_worker.js",
{ scope: "./sw_clients/" })
.then((swr) => registration = swr);
}
function unregister() {
return registration.unregister().then(function(result) {
ok(result, "Unregister should return true.");
}, function(e) {
dump("Unregistering the SW failed with " + e + "\n");
});
}
function testGzipRedirect(swr) {
var p = new Promise(function(res, rej) {
var navigatorReady = false;
var finalReady = false;
window.onmessage = function(e) {
if (e.data === "NAVIGATOR_READY") {
ok(!navigatorReady, "should only get navigator ready message once");
ok(!finalReady, "should get navigator ready before final redirect ready message");
navigatorReady = true;
iframe.contentWindow.postMessage({
type: "NAVIGATE",
url: "does_not_exist.html"
}, "*");
} else if (e.data === "READY") {
ok(navigatorReady, "should only get navigator ready message once");
ok(!finalReady, "should get final ready message only once");
finalReady = true;
res();
}
}
});
var content = document.getElementById("content");
ok(content, "Parent exists.");
iframe = document.createElement("iframe");
iframe.setAttribute('src', "sw_clients/navigator.html");
content.appendChild(iframe);
return p.then(() => content.removeChild(iframe));
}
function runTest() {
start()
.then(testGzipRedirect)
.then(unregister)
.catch(function(e) {
ok(false, "Some test failed with error " + e);
}).then(SimpleTest.finish);
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true]
]}, runTest);
</script>
</pre>
</body>
</html>

View File

@ -44,9 +44,6 @@ using namespace mozilla::ipc;
namespace mozilla {
namespace net {
extern bool
WillRedirect(const nsHttpResponseHead * response);
namespace {
const uint32_t kMaxFileDescriptorsPerMessage = 250;
@ -2189,11 +2186,8 @@ HttpChannelChild::OverrideWithSynthesizedResponse(nsAutoPtr<nsHttpResponseHead>&
nsIInputStream* aSynthesizedInput,
nsIStreamListener* aStreamListener)
{
// Intercepted responses should already be decoded. If its a redirect,
// however, we want to respect the encoding of the final result instead.
if (!WillRedirect(aResponseHead)) {
SetApplyConversion(false);
}
// Intercepted responses should already be decoded.
SetApplyConversion(false);
mResponseHead = aResponseHead;
mSynthesizedResponse = true;

View File

@ -18,9 +18,6 @@
namespace mozilla {
namespace net {
extern bool
WillRedirect(const nsHttpResponseHead * response);
extern nsresult
DoAddCacheEntryHeaders(nsHttpChannel *self,
nsICacheEntry *entry,
@ -187,13 +184,6 @@ InterceptedChannelChrome::FinishSynthesizedResponse()
EnsureSynthesizedResponse();
// If the synthesized response is a redirect, then we want to respect
// the encoding of whatever is loaded as a result.
if (WillRedirect(mSynthesizedResponseHead.ref())) {
nsresult rv = mChannel->SetApplyConversion(mOldApplyConversion);
NS_ENSURE_SUCCESS(rv, rv);
}
mChannel->MarkIntercepted();
// First we ensure the appropriate metadata is set on the synthesized cache entry

View File

@ -157,8 +157,6 @@ bool IsRedirectStatus(uint32_t status)
status == 307 || status == 308;
}
} // unnamed namespace
// We only treat 3xx responses as redirects if they have a Location header and
// the status code is in a whitelist.
bool
@ -168,6 +166,8 @@ WillRedirect(const nsHttpResponseHead * response)
response->PeekHeader(nsHttp::Location);
}
} // unnamed namespace
nsresult
StoreAuthorizationMetaData(nsICacheEntry *entry, nsHttpRequestHead *requestHead);