Backed out 4 changesets (bug 1167808) for mulet mochitest-4 permafail in test_fetch_cors_sw_reroute.html

Backed out changeset 1c9c72d93973 (bug 1167808)
Backed out changeset 9c94c759a0fb (bug 1167808)
Backed out changeset e8ac89eafb1d (bug 1167808)
Backed out changeset 48abf470ef5b (bug 1167808)
This commit is contained in:
Wes Kocher 2015-07-02 15:30:29 -07:00
parent 489a109db4
commit c444dc2a0d
11 changed files with 7 additions and 154 deletions

View File

@ -165,7 +165,6 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
#define PREF_SERVICEWORKERS_ENABLED "dom.serviceWorkers.enabled"
#define PREF_SERVICEWORKERS_TESTING_ENABLED "dom.serviceWorkers.testing.enabled"
#define PREF_INTERCEPTION_ENABLED "dom.serviceWorkers.interception.enabled"
#define PREF_INTERCEPTION_OPAQUE_ENABLED "dom.serviceWorkers.interception.opaque.enabled"
namespace {
@ -1933,10 +1932,6 @@ RuntimeService::Init()
WorkerPrefChanged,
PREF_INTERCEPTION_ENABLED,
reinterpret_cast<void *>(WORKERPREF_INTERCEPTION_ENABLED))) ||
NS_FAILED(Preferences::RegisterCallbackAndCall(
WorkerPrefChanged,
PREF_INTERCEPTION_OPAQUE_ENABLED,
reinterpret_cast<void *>(WORKERPREF_INTERCEPTION_OPAQUE_ENABLED))) ||
NS_FAILED(Preferences::RegisterCallbackAndCall(
WorkerPrefChanged,
PREF_DOM_CACHES_TESTING_ENABLED,
@ -2148,10 +2143,6 @@ RuntimeService::Cleanup()
WorkerPrefChanged,
PREF_DOM_CACHES_TESTING_ENABLED,
reinterpret_cast<void *>(WORKERPREF_DOM_CACHES_TESTING))) ||
NS_FAILED(Preferences::UnregisterCallback(
WorkerPrefChanged,
PREF_INTERCEPTION_OPAQUE_ENABLED,
reinterpret_cast<void *>(WORKERPREF_INTERCEPTION_OPAQUE_ENABLED))) ||
NS_FAILED(Preferences::UnregisterCallback(
WorkerPrefChanged,
PREF_INTERCEPTION_ENABLED,
@ -2713,7 +2704,6 @@ RuntimeService::WorkerPrefChanged(const char* aPrefName, void* aClosure)
case WORKERPREF_DUMP:
#endif
case WORKERPREF_INTERCEPTION_ENABLED:
case WORKERPREF_INTERCEPTION_OPAQUE_ENABLED:
case WORKERPREF_SERVICEWORKERS:
case WORKERPREF_SERVICEWORKERS_TESTING:
sDefaultPreferences[key] = Preferences::GetBool(aPrefName, false);

View File

@ -232,17 +232,6 @@ RespondWithHandler::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValu
return;
}
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(worker);
worker->AssertIsOnWorkerThread();
// Allow opaque response interception to be disabled until we can ensure the
// security implications are not a complete disaster.
if (response->Type() == ResponseType::Opaque &&
!worker->OpaqueInterceptionEnabled()) {
return;
}
// Section 4.2, step 2.2 "If either response's type is "opaque" and request's
// mode is not "no-cors" or response's type is error, return a network error."
if (((response->Type() == ResponseType::Opaque) && (mRequestMode != RequestMode::No_cors)) ||
@ -259,10 +248,14 @@ RespondWithHandler::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValu
return;
}
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(worker);
worker->AssertIsOnWorkerThread();
nsAutoPtr<RespondWithClosure> closure(
new RespondWithClosure(mInterceptedChannel, ir, worker->GetChannelInfo()));
nsCOMPtr<nsIInputStream> body;
ir->GetInternalBody(getter_AddRefs(body));
response->GetBody(getter_AddRefs(body));
// Errors and redirects may not have a body.
if (body) {
response->SetBodyUsed();

View File

@ -1291,13 +1291,6 @@ public:
return mPreferences[WORKERPREF_INTERCEPTION_ENABLED];
}
bool
OpaqueInterceptionEnabled() const
{
AssertIsOnWorkerThread();
return mPreferences[WORKERPREF_INTERCEPTION_OPAQUE_ENABLED];
}
bool
DOMWorkerNotificationEnabled() const
{

View File

@ -202,7 +202,6 @@ enum WorkerPreference
WORKERPREF_DOM_WORKERNOTIFICATION, // dom.webnotifications.workers.enabled
WORKERPREF_DOM_CACHES_TESTING, // dom.caches.testing.enabled
WORKERPREF_SERVICEWORKERS_TESTING, // dom.serviceWorkers.testing.enabled
WORKERPREF_INTERCEPTION_OPAQUE_ENABLED, // dom.serviceWorkers.interception.opaque.enabled
WORKERPREF_COUNT
};

View File

@ -144,8 +144,6 @@ support-files =
sw_clients/navigator.html
eval_worker.js
test_eval_not_allowed.html^headers^
opaque_intercept_worker.js
notify_loaded.js
[test_app_protocol.html]
[test_bug1151916.html]
@ -203,4 +201,3 @@ skip-if = toolkit == 'android' # Bug 1163410
[test_workerUnregister.html]
[test_workerUpdate.html]
[test_workerupdatefoundevent.html]
[test_opaque_intercept.html]

View File

@ -1 +0,0 @@
parent.postMessage('SCRIPT_LOADED', '*');

View File

@ -1,25 +0,0 @@
var name = 'opaqueInterceptCache';
// Cross origin request to ensure that an opaque response is used
var prefix = 'http://example.com/tests/dom/workers/test/serviceworkers/'
self.addEventListener('install', function(event) {
var request = new Request(prefix + 'notify_loaded.js', { mode: 'no-cors' });
event.waitUntil(
Promise.all([caches.open(name), fetch(request)]).then(function(results) {
var cache = results[0];
var response = results[1];
return cache.put('./sw_clients/does_not_exist.js', 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

@ -6,9 +6,8 @@
<html>
<head>
<title>Bug 982726 - test match_all not crashing</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<!-- some tests will intercept this bogus script request -->
<script type="text/javascript" src="does_not_exist.js"></script>
</head>
<body>
<p id="display"></p>
@ -17,7 +16,7 @@
<script class="testbody" type="text/javascript">
if (!parent) {
dump("sw_clients/simple.html shouldn't be launched directly!");
info("sw_clients/simple.html shouldn't be launched directly!");
}
window.addEventListener("message", function(event) {

View File

@ -1,86 +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("opaque_intercept_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 testOpaqueIntercept(swr) {
var p = new Promise(function(res, rej) {
var ready = false;
var scriptLoaded = false;
window.onmessage = function(e) {
if (e.data === "READY") {
ok(!ready, "ready message should only be received once");
ok(!scriptLoaded, "ready message should be received before script loaded");
if (ready) {
res();
return;
}
ready = true;
iframe.contentWindow.postMessage("REFRESH", "*");
} else if (e.data === "SCRIPT_LOADED") {
ok(ready, "script loaded should be received after ready");
ok(!scriptLoaded, "script loaded message should be received only once");
scriptLoaded = true;
res();
}
}
});
var content = document.getElementById("content");
ok(content, "Parent exists.");
iframe = document.createElement("iframe");
iframe.setAttribute('src', "sw_clients/refresher.html");
content.appendChild(iframe);
return p.then(() => content.removeChild(iframe));
}
function runTest() {
start()
.then(testOpaqueIntercept)
.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],
["dom.serviceWorkers.interception.opaque.enabled", true],
["dom.caches.enabled", true],
]}, runTest);
</script>
</pre>
</body>
</html>

View File

@ -135,12 +135,6 @@ pref("dom.workers.sharedWorkers.enabled", true);
// Service workers
pref("dom.serviceWorkers.enabled", false);
// Allow service workers to intercept network requests using the fetch event
pref("dom.serviceWorkers.interception.enabled", false);
// Allow service workers to intercept opaque (cross origin) responses
pref("dom.serviceWorkers.interception.opaque.enabled", false);
// Whether nonzero values can be returned from performance.timing.*
pref("dom.enable_performance", true);