Bug 653833 - Add back some code that should not have been removed. r=mfinkle
☠☠ backed out by 115d48a4ce0c ☠ ☠
authorWes Johnston <wjohnston@mozilla.com>
Tue, 26 Jun 2012 15:09:55 -0700
changeset 97732 5ab2723fc0e02fd706cdce07051cc6b80195c275
parent 97731 f6a23947fc337daba23d71ed4a14e66f8c298012
child 97733 56ccb1deb91d32bef937cc51a76f28e8d2ed31d7
push id22993
push useremorley@mozilla.com
push dateWed, 27 Jun 2012 10:31:27 +0000
treeherdermozilla-central@1a56f1f011c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs653833
milestone16.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 653833 - Add back some code that should not have been removed. r=mfinkle
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -1821,37 +1821,42 @@ var UserAgent = {
       }
       case "http-on-modify-request": {
         let channel = aSubject.QueryInterface(Ci.nsIHttpChannel);
         let channelWindow = this._getWindowForRequest(channel);
         let tab = BrowserApp.getTabForWindow(channelWindow);
         if (tab == null)
           break;
 
-      let apps = HelperApps.getAppsForUri(channel.URI);
-      if (apps.length > 0) {
-        let message = apps.length == 1 ? Strings.browser.formatStringFromName("helperapps.openWithApp", [apps[0].name], 1) :
-                                         Strings.browser.GetStringFromName("helperapps.openWithList");
-        let buttons = [{
-            label: Strings.browser.GetStringFromName("helperapps.open"),
-            callback: function() {
-              aSubject.QueryInterface(Ci.nsIRequest).cancel(Components.results.NS_ERROR_ABORT);
-              HelperApps.openUriInApp(channel.URI);
-            }
-          },
-          {
-            label: Strings.browser.GetStringFromName("helperapps.cancel"),
-            callback: function() { }
-        }];
-        // Persist this over page loads. Pages that expect to open in helper apps often redirect
-        // Youtube redirects twice, so I've forced this to two for now
-        let options = { persistence: 2 };
-        let name = "helperapps-" + (apps.length > 1 ? "list" : apps[0].name);
-        NativeWindow.doorhanger.show(message, name, buttons, self.id, options);
-      }
+        let apps = HelperApps.getAppsForUri(channel.URI);
+        if (apps.length > 0) {
+          let message = apps.length == 1 ? Strings.browser.formatStringFromName("helperapps.openWithApp", [apps[0].name], 1) :
+                                           Strings.browser.GetStringFromName("helperapps.openWithList");
+          let buttons = [{
+              label: Strings.browser.GetStringFromName("helperapps.open"),
+              callback: function() {
+                aSubject.QueryInterface(Ci.nsIRequest).cancel(Components.results.NS_ERROR_ABORT);
+                HelperApps.openUriInApp(channel.URI);
+              }
+            },
+            {
+              label: Strings.browser.GetStringFromName("helperapps.cancel"),
+              callback: function() { }
+          }];
+          // Persist this over page loads. Pages that expect to open in helper apps often redirect
+          // Youtube redirects twice, so I've forced this to two for now
+          let options = { persistence: 2 };
+          let name = "helperapps-" + (apps.length > 1 ? "list" : apps[0].name);
+          NativeWindow.doorhanger.show(message, name, buttons, self.id, options);
+        }
+
+        // Send desktop UA if "Request Desktop Site" is enabled
+        if (tab.desktopMode && (channel.loadFlags & Ci.nsIChannel.LOAD_DOCUMENT_URI))
+          channel.setRequestHeader("User-Agent", this.DESKTOP_UA, false);
+        break;
     }
   }
 };
 
 
 function nsBrowserAccess() {
 }