Bug 1206458 follow-up: Continue to use the LOAD_FLAGS_BYPASS_CACHE flag for the Request Desktop Mode feature
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 24 Sep 2015 07:58:35 -0400
changeset 264230 e15e24b44323bb0f2fae6c22c03f9cc08044bb73
parent 264229 0a5b448cd09ea78e7ef930c3910b488ac27efebc
child 264231 aa7c3ce047ad6fd7b081fccc3c000db1d014820b
push id29431
push userkwierso@gmail.com
push dateThu, 24 Sep 2015 23:46:41 +0000
treeherdermozilla-central@eee426604698 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1206458, 1518
milestone44.0a1
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
Bug 1206458 follow-up: Continue to use the LOAD_FLAGS_BYPASS_CACHE flag for the Request Desktop Mode feature As per the discussion happened on the mailing list: https://mail.mozilla.org/pipermail/mobile-firefox-dev/2015-September/001518.html
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3597,17 +3597,21 @@ Tab.prototype = {
     }
 
     // Only reload the page for http/https schemes
     let currentURI = this.browser.currentURI;
     if (!currentURI.schemeIs("http") && !currentURI.schemeIs("https"))
       return;
 
     let url = currentURI.spec;
-    let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
+    // We need LOAD_FLAGS_BYPASS_CACHE here since we're changing the User-Agent
+    // string, and servers typically don't use the Vary: User-Agent header, so
+    // not doing this means that we'd get some of the previously cached content.
+    let flags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE |
+                Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
     if (this.originalURI && !this.originalURI.equals(currentURI)) {
       // We were redirected; reload the original URL
       url = this.originalURI.spec;
     }
 
     this.browser.docShell.loadURI(url, flags, null, null, null);
   },