Backout a3f5b011f665 for Android bustage
authorBrian Nicholson <bnicholson@mozilla.com>
Tue, 26 Jun 2012 18:07:15 -0700
changeset 97746 fee840205f5bf006b0e63b41e73a45b7306688db
parent 97745 a4dc234066d25b32889a5b63de4252164d5108aa
child 97747 c9126626a41b58e37f675b344f67455ab9401f2f
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)
milestone16.0a1
backs outa3f5b011f665977d9c15d94820b8b147cb851d2b
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
Backout a3f5b011f665 for Android bustage
mobile/android/chrome/content/HelperApps.js
mobile/android/chrome/content/browser.js
mobile/android/chrome/jar.mn
mobile/android/locales/en-US/chrome/browser.properties
deleted file mode 100644
--- a/mobile/android/chrome/content/HelperApps.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-
-var HelperApps =  {
-  get defaultHttpHandlers() {
-    let protoHandlers = this.getAppsForProtocol("http");
-
-    var results = {};
-    for (var i = 0; i < protoHandlers.length; i++) {
-      try {
-        let protoApp = protoHandlers.queryElementAt(i, Ci.nsIHandlerApp);
-        results[protoApp.name] = protoApp;
-      } catch(e) {}
-    }
-
-    delete this.defaultHttpHandlers;
-    return this.defaultHttpHandlers = results;
-  },
-
-  get protoSvc() {
-    delete this.protoSvc;
-    return this.protoSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(Ci.nsIExternalProtocolService);
-  },
-
-  get urlHandlerService() {
-    delete this.urlHandlerService;
-    return this.urlHandlerService = Cc["@mozilla.org/uriloader/external-url-handler-service;1"].getService(Ci.nsIExternalURLHandlerService);
-  },
-
-  getAppsForProtocol: function getAppsForProtocol(uri) {
-    let handlerInfoProto = this.protoSvc.getProtocolHandlerInfoFromOS(uri, {});
-    return handlerInfoProto.possibleApplicationHandlers;
-  },
-  
-  getAppsForUri: function getAppsFor(uri) {
-    let found = [];
-    let handlerInfoProto = this.urlHandlerService.getURLHandlerInfoFromOS(uri, {});
-    let urlHandlers = handlerInfoProto.possibleApplicationHandlers;
-    for (var i = 0; i < urlHandlers.length; i++) {
-      let urlApp = urlHandlers.queryElementAt(i, Ci.nsIHandlerApp);
-      if (!this.defaultHttpHandlers[urlApp.name]) {
-        found.push(urlApp);
-      }
-    }
-    return found;
-  },
-  
-  openUriInApp: function openUriInApp(uri) { 
-    var possibleHandlers = this.getAppsForUri(uri);
-    if (possibleHandlers.length == 1) {
-      possibleHandlers[0].launchWithURI(uri);
-    } else if (possibleHandlers.length > 0) {
-      let handlerInfoProto = this.urlHandlerService.getURLHandlerInfoFromOS(uri, {});
-      handlerInfoProto.preferredApplicationHandler.launchWithURI(uri);
-    }
-  }
-};
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -24,17 +24,16 @@ XPCOMUtils.defineLazyGetter(this, "Plura
 
 XPCOMUtils.defineLazyGetter(this, "DebuggerServer", function() {
   Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
   return DebuggerServer;
 });
 
 // Lazily-loaded browser scripts:
 [
-  ["HelperApps", "chrome://browser/content/HelperApps.js"],
   ["SelectHelper", "chrome://browser/content/SelectHelper.js"],
   ["Readability", "chrome://browser/content/Readability.js"],
 ].forEach(function (aScript) {
   let [name, script] = aScript;
   XPCOMUtils.defineLazyGetter(window, name, function() {
     let sandbox = {};
     Services.scriptloader.loadSubScript(script, sandbox);
     return sandbox[name];
@@ -1821,36 +1820,29 @@ 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);
+        // Send XUL UA to YouTube; temporary hack to make videos play
+        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() {
 }
@@ -5046,17 +5038,17 @@ var PermissionsHelper = {
           // Get the key to look up the appropriate string entity
           let valueKey = value == Services.perms.ALLOW_ACTION ?
                          "allowed" : "denied";
           let valueString = Strings.browser.GetStringFromName(typeStrings[valueKey]);
 
           // If we implement a two-line UI, we will need to pass the label and
           // value individually and let java handle the formatting
           let setting = Strings.browser.formatStringFromName("siteSettings.labelToValue",
-                                                             [ label, valueString ], 2);
+                                                             [ label, valueString ], 2)
           permissions.push({
             type: type,
             setting: setting
           });
         }
 
         // Keep track of permissions, so we know which ones to clear
         this._currentPermissions = permissions; 
--- a/mobile/android/chrome/jar.mn
+++ b/mobile/android/chrome/jar.mn
@@ -31,14 +31,13 @@ chrome.jar:
   content/bindings/settings.xml        (content/bindings/settings.xml)
   content/cursor.css                   (content/cursor.css)
 % content branding %content/branding/
   content/sanitize.js                  (content/sanitize.js)
   content/exceptions.js                (content/exceptions.js)
 * content/downloads.js                 (content/downloads.js)
   content/netError.xhtml               (content/netError.xhtml)
   content/SelectHelper.js              (content/SelectHelper.js)
-  content/HelperApps.js                (content/HelperApps.js)
   content/dbg-browser-actors.js        (content/dbg-browser-actors.js)
 
 % override chrome://global/content/config.xul chrome://browser/content/config.xhtml
 % override chrome://global/content/netError.xhtml chrome://browser/content/netError.xhtml
 % override chrome://mozapps/content/extensions/extensions.xul chrome://browser/content/aboutAddons.xhtml
--- a/mobile/android/locales/en-US/chrome/browser.properties
+++ b/mobile/android/locales/en-US/chrome/browser.properties
@@ -259,14 +259,8 @@ masterPassword.incorrect=Incorrect passw
 # Debugger
 # LOCALIZATION NOTE (remoteIncomingPromptTitle): The title displayed on the
 # dialog that prompts the user to allow the incoming connection.
 remoteIncomingPromptTitle=Incoming Connection
 # LOCALIZATION NOTE (remoteIncomingPromptMessage): The message displayed on the
 # dialog that prompts the user to allow the incoming connection.
 remoteIncomingPromptMessage=An incoming request to permit remote debugging connection was detected. A remote client can take complete control over your browser! Allow connection?
 remoteIncomingPromptDisable=Disable
-
-# Helper apps
-helperapps.openWithApp=The %S App can open this link.
-helperapps.openWithList=You have apps installed that can open this link.
-helperapps.open=Open with App
-helperapps.cancel=Cancel