Bug 769454 - Turn off helper app prompts. r=mfinkle
authorWes Johnston <wjohnston@mozilla.com>
Mon, 09 Jul 2012 10:02:25 -0700
changeset 98704 f1502bb466347a03a8657eec122866967c09a8d3
parent 98703 142b9df4d0212d15400d1afcd7fd25d953afd29a
child 98705 a516a86f854da9a92976566878010c820458b22d
push id11613
push userwjohnston@mozilla.com
push dateMon, 09 Jul 2012 17:02:52 +0000
treeherdermozilla-inbound@f1502bb46634 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs769454
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 769454 - Turn off helper app prompts. r=mfinkle
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -1946,41 +1946,27 @@ 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);
+        if (channel.URI.host.indexOf("youtube") != -1) {
+          let ua = Cc["@mozilla.org/network/protocol;1?name=http"].getService(Ci.nsIHttpProtocolHandler).userAgent;
+#expand let version = "__MOZ_APP_VERSION__";
+          ua += " Fennec/" + version;
+          channel.setRequestHeader("User-Agent", ua, false);
         }
 
         // 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() {