Backed out 3 changesets (bug 1172884, bug 1169819) for OS X timeouts in browser_force_refresh.js in bc3
authorPhil Ringnalda <philringnalda@gmail.com>
Thu, 11 Jun 2015 20:57:24 -0700
changeset 248499 91a848ffec69d05d58635cb2f3a555dd8218771d
parent 248498 62934f4d92c8557382a3bde83e4880c3a50f9f02
child 248500 c1afb1408755ad1794c5055a595eed8dce9e73ef
push id60972
push userphilringnalda@gmail.com
push dateFri, 12 Jun 2015 03:57:39 +0000
treeherdermozilla-inbound@91a848ffec69 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1172884, 1169819
milestone41.0a1
backs out7b23ff6ac3a2d7e3efe17a27d0263fc3ab9f2a9f
1434730c0e1989f3028e11cae5056f9bad3860df
17d6ecf1b4ec0ad968271cbba2def8900ff009e1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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)
dom/workers/moz.build
dom/workers/test/serviceworkers/browser.ini
dom/workers/test/serviceworkers/browser_base_force_refresh.html
dom/workers/test/serviceworkers/browser_cached_force_refresh.html
dom/workers/test/serviceworkers/browser_force_refresh.js
dom/workers/test/serviceworkers/force_refresh_browser_worker.js
dom/workers/test/serviceworkers/gzip_redirect_worker.js
dom/workers/test/serviceworkers/mochitest.ini
dom/workers/test/serviceworkers/sw_clients/navigator.html
dom/workers/test/serviceworkers/test_gzip_redirect.html
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/InterceptedChannel.cpp
netwerk/protocol/http/nsHttpChannel.cpp
--- a/dom/workers/moz.build
+++ b/dom/workers/moz.build
@@ -117,17 +117,13 @@ MOCHITEST_MANIFESTS += [
     'test/serviceworkers/mochitest.ini',
 ]
 
 MOCHITEST_CHROME_MANIFESTS += [
     'test/chrome.ini',
     'test/serviceworkers/chrome.ini'
 ]
 
-BROWSER_CHROME_MANIFESTS += [
-    'test/serviceworkers/browser.ini',
-]
-
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
 
 BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
 
 TEST_DIRS += ['test/gtest']
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/browser.ini
+++ /dev/null
@@ -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]
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/browser_base_force_refresh.html
+++ /dev/null
@@ -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>
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/browser_cached_force_refresh.html
+++ /dev/null
@@ -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>
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/browser_force_refresh.js
+++ /dev/null
@@ -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);
-  });
-}
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/force_refresh_browser_worker.js
+++ /dev/null
@@ -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);
-    })
-  );
-});
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/gzip_redirect_worker.js
+++ /dev/null
@@ -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'
-    }
-  }));
-});
--- a/dom/workers/test/serviceworkers/mochitest.ini
+++ b/dom/workers/test/serviceworkers/mochitest.ini
@@ -129,18 +129,16 @@ support-files =
   strict_mode_error.js
   skip_waiting_installed_worker.js
   skip_waiting_scope/index.html
   thirdparty/iframe1.html
   thirdparty/iframe2.html
   thirdparty/register.html
   thirdparty/unregister.html
   thirdparty/sw.js
-  gzip_redirect_worker.js
-  sw_clients/navigator.html
 
 [test_unregister.html]
 [test_installation_simple.html]
 [test_fetch_event.html]
 [test_https_fetch.html]
 [test_https_fetch_cloned_response.html]
 [test_https_synth_fetch_from_cached_sw.html]
 [test_match_all.html]
@@ -181,10 +179,9 @@ support-files =
 [test_strict_mode_error.html]
 [test_cross_origin_url_after_redirect.html]
 [test_origin_after_redirect.html]
 [test_origin_after_redirect_cached.html]
 [test_origin_after_redirect_to_https.html]
 [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]
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/sw_clients/navigator.html
+++ /dev/null
@@ -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>
-
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/test_gzip_redirect.html
+++ /dev/null
@@ -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>
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -39,19 +39,16 @@
 #endif
 
 using namespace mozilla::dom;
 using namespace mozilla::ipc;
 
 namespace mozilla {
 namespace net {
 
-extern bool
-WillRedirect(const nsHttpResponseHead * response);
-
 namespace {
 
 const uint32_t kMaxFileDescriptorsPerMessage = 250;
 
 #ifdef OS_POSIX
 // Keep this in sync with other platforms.
 static_assert(FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE == 250,
               "MAX_DESCRIPTORS_PER_MESSAGE mismatch!");
@@ -2184,21 +2181,18 @@ HttpChannelChild::ResetInterception()
   NS_ENSURE_SUCCESS_VOID(rv);
 }
 
 void
 HttpChannelChild::OverrideWithSynthesizedResponse(nsAutoPtr<nsHttpResponseHead>& aResponseHead,
                                                   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;
 
   uint16_t status = mResponseHead->Status();
   if (status != 200 && status != 404) {
     // Continue with the original cross-process request
     nsresult rv = ContinueAsyncOpen();
--- a/netwerk/protocol/http/InterceptedChannel.cpp
+++ b/netwerk/protocol/http/InterceptedChannel.cpp
@@ -13,19 +13,16 @@
 #include "nsHttpChannel.h"
 #include "HttpChannelChild.h"
 #include "nsHttpResponseHead.h"
 #include "mozilla/dom/ChannelInfo.h"
 
 namespace mozilla {
 namespace net {
 
-extern bool
-WillRedirect(const nsHttpResponseHead * response);
-
 extern nsresult
 DoAddCacheEntryHeaders(nsHttpChannel *self,
                        nsICacheEntry *entry,
                        nsHttpRequestHead *requestHead,
                        nsHttpResponseHead *responseHead,
                        nsISupports *securityInfo);
 
 NS_IMPL_ISUPPORTS(InterceptedChannelBase, nsIInterceptedChannel)
@@ -182,23 +179,16 @@ NS_IMETHODIMP
 InterceptedChannelChrome::FinishSynthesizedResponse()
 {
   if (!mChannel) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   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
   // (i.e. the flattened response head)
 
   nsCOMPtr<nsISupports> securityInfo;
   nsresult rv = mChannel->GetSecurityInfo(getter_AddRefs(securityInfo));
   NS_ENSURE_SUCCESS(rv, rv);
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -152,27 +152,27 @@ Hash(const char *buf, nsACString &hash)
 
 bool IsRedirectStatus(uint32_t status)
 {
     // 305 disabled as a security measure (see bug 187996).
     return status == 300 || status == 301 || status == 302 || status == 303 ||
            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
 WillRedirect(const nsHttpResponseHead * response)
 {
     return IsRedirectStatus(response->Status()) &&
            response->PeekHeader(nsHttp::Location);
 }
 
+} // unnamed namespace
+
 nsresult
 StoreAuthorizationMetaData(nsICacheEntry *entry, nsHttpRequestHead *requestHead);
 
 class AutoRedirectVetoNotifier
 {
 public:
     explicit AutoRedirectVetoNotifier(nsHttpChannel* channel) : mChannel(channel)
     {