Backout 977ee9208065, a405768bd32a, 69a1fb2ddca3, 58d5f1d1443e for Moth orange.
authorMs2ger <ms2ger@gmail.com>
Sat, 14 Jul 2012 11:38:56 +0200
changeset 99286 20a09c21d3d5bd1359a520adb3103ba32e002c54
parent 99284 58d5f1d1443e9ec3f787d6327cc1d6184e833d07
child 99287 6bfce37d7fa494b499b96dfea3ba0a6dce8a58dd
push id23116
push userryanvm@gmail.com
push dateSat, 14 Jul 2012 16:58:48 +0000
treeherdermozilla-central@9046ecf4db8f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone16.0a1
backs out977ee9208065e945aeb2ad85bfeb2eeeed05b515
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 977ee9208065, a405768bd32a, 69a1fb2ddca3, 58d5f1d1443e for Moth orange.
browser/locales/en-US/chrome/browser/browser.properties
browser/modules/webappsUI.jsm
dom/apps/src/Webapps.jsm
dom/tests/mochitest/webapps/Makefile.in
dom/tests/mochitest/webapps/apps/Makefile.in
dom/tests/mochitest/webapps/apps/bug_765063.xul
dom/tests/mochitest/webapps/apps/bug_771294.xul
dom/tests/mochitest/webapps/test_bug_765063.xul
dom/tests/mochitest/webapps/test_bug_771294.xul
toolkit/Makefile.in
toolkit/content/PopupNotifications.jsm
toolkit/themes/gnomestripe/global/alerts/alert.css
toolkit/themes/winstripe/global/alerts/alert.css
toolkit/webapps/Makefile.in
toolkit/webapps/WebappOSUtils.jsm
widget/cocoa/nsMacWebAppUtils.mm
widget/nsIMacWebAppUtils.idl
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -352,17 +352,16 @@ telemetryYesButtonAccessKey = Y
 telemetryNoButtonLabel = No
 telemetryNoButtonAccessKey = N
 
 # Webapps notification popup
 webapps.install = Install
 webapps.install.accesskey = I
 #LOCALIZATION NOTE (webapps.requestInstall) %1$S is the web app name, %2$S is the site from which the web app is installed
 webapps.requestInstall = Do you want to install "%1$S" from this site (%2$S)?
-webapps.install.success = Application Installed
 
 # Telemetry opt-out prompt for Aurora and Nightly
 # LOCALIZATION NOTE (telemetryOptOutPrompt): %1$S and %3$S will be replaced by
 # brandFullName, and %2$S by the value of the toolkit.telemetry.server_owner preference.
 telemetryOptOutPrompt = %1$S sends information about performance, hardware, usage and customizations back to %2$S to help improve %3$S.
 
 # LOCALIZATION NOTE (fullscreen.entered): displayed when we enter HTML5 fullscreen mode, %S is the domain name of the focused website (e.g. mozilla.com).
 fullscreen.entered=%S is now fullscreen.
--- a/browser/modules/webappsUI.jsm
+++ b/browser/modules/webappsUI.jsm
@@ -24,22 +24,20 @@ let webappsUI = {
     Services.obs.removeObserver(this, "webapps-launch");
   },
 
   observe: function webappsUI_observe(aSubject, aTopic, aData) {
     let data = JSON.parse(aData);
 
     switch(aTopic) {
       case "webapps-ask-install":
-        let win = this._getWindowForId(data.oid);
-        if (win && win.location.href == data.from) {
-          this.doInstall(data, win);
-        }
+        let [chromeWin, browser] = this._getBrowserForId(data.oid);
+        if (chromeWin)
+          this.doInstall(data, browser, chromeWin);
         break;
-
       case "webapps-launch":
         DOMApplicationRegistry.getManifestFor(data.origin, (function(aManifest) {
           if (!aManifest)
             return;
           let manifest = new DOMApplicationManifest(aManifest, data.origin);
           this.openURL(manifest.fullLaunchPath(), data.origin);
         }).bind(this));
         break;
@@ -80,79 +78,66 @@ let webappsUI = {
         let tab = browser.addTab(aUrl);
         browser.pinTab(tab);
         browser.selectedTab = tab;
         ss.setTabValue(tab, "appOrigin", aOrigin);
       }
     }
   },
 
-  doInstall: function(aData, aWindow) {
-    let browser = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
-                         .getInterface(Ci.nsIWebNavigation)
-                         .QueryInterface(Ci.nsIDocShell)
-                         .chromeEventHandler;
+  _getBrowserForId: function(aId) {
+    let someWindow = Services.wm.getMostRecentWindow(null);
 
-    let chromeWin = browser.ownerDocument.defaultView;
-    let bundle = chromeWin.gNavigatorBundle;
+    if (someWindow) {
+      let windowUtils = someWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+                                  .getInterface(Ci.nsIDOMWindowUtils);
+      let content = windowUtils.getOuterWindowWithId(aId);
+      if (content) {
+        let browser = content.QueryInterface(Ci.nsIInterfaceRequestor)
+                      .getInterface(Ci.nsIWebNavigation)
+                      .QueryInterface(Ci.nsIDocShell).chromeEventHandler;
+        let win = browser.ownerDocument.defaultView;
+        return [win, browser];
+      }
+    }
+
+    return [null, null];
+  },
+
+  doInstall: function(aData, aBrowser, aWindow) {
+    let bundle = aWindow.gNavigatorBundle;
 
     let mainAction = {
       label: bundle.getString("webapps.install"),
       accessKey: bundle.getString("webapps.install.accesskey"),
       callback: function() {
         let app = WebappsInstaller.install(aData);
         if (app) {
           let localDir = null;
           if (app.appcacheDefined && app.appProfile) {
             localDir = app.appProfile.localDir;
           }
 
           DOMApplicationRegistry.confirmInstall(aData, false, localDir);
-          installationSuccessNotification(app, chromeWin);
         } else {
           DOMApplicationRegistry.denyInstall(aData);
         }
       }
     };
 
-    let requestingURI = chromeWin.makeURI(aData.from);
+    let requestingURI = aWindow.makeURI(aData.from);
     let manifest = new DOMApplicationManifest(aData.app.manifest, aData.app.origin);
 
     let host;
     try {
       host = requestingURI.host;
     } catch(e) {
       host = requestingURI.spec;
     }
 
     let message = bundle.getFormattedString("webapps.requestInstall",
-                                            [manifest.name, host]);
-
-    chromeWin.PopupNotifications.show(browser, "webapps-install", message,
-                                      "webapps-notification-icon", mainAction);
-  },
+                                            [manifest.name, host], 2);
 
-  _getWindowForId: function(aId) {
-     let someWindow = Services.wm.getMostRecentWindow(null);
-     return someWindow &&
-            someWindow.QueryInterface(Ci.nsIInterfaceRequestor)
-                      .getInterface(Ci.nsIDOMWindowUtils)
-                      .getOuterWindowWithId(aId);
+    aWindow.PopupNotifications.show(aBrowser, "webapps-install", message,
+                                    "webapps-notification-icon", mainAction);
+
   }
 }
-
-function installationSuccessNotification(app, aWindow) {
-  let bundle = aWindow.gNavigatorBundle;
-
-  if (("@mozilla.org/alerts-service;1" in Cc)) {
-    let notifier;
-    try {
-      notifier = Cc["@mozilla.org/alerts-service;1"].
-                 getService(Ci.nsIAlertsService);
-
-      notifier.showAlertNotification(app.iconURI.spec,
-                                    bundle.getString("webapps.install.success"),
-                                    app.appNameAsFilename,
-                                    false, null, null);
-
-    } catch (ex) {}
-  }
-}
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -9,17 +9,16 @@ const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 
 let EXPORTED_SYMBOLS = ["DOMApplicationRegistry", "DOMApplicationManifest"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
-Cu.import("resource://gre/modules/WebappOSUtils.jsm");
 
 const WEBAPP_RUNTIME = Services.appinfo.ID == "webapprt@mozilla.org";
 
 XPCOMUtils.defineLazyGetter(this, "NetUtil", function() {
   Cu.import("resource://gre/modules/NetUtil.jsm");
   return NetUtil;
 });
 
@@ -167,17 +166,17 @@ let DOMApplicationRegistry = {
         break;
       case "Webapps:GetSelf":
         this.getSelf(msg);
         break;
       case "Webapps:Uninstall":
         this.uninstall(msg);
         break;
       case "Webapps:Launch":
-        WebappOSUtils.launch(msg);
+        Services.obs.notifyObservers(this, "webapps-launch", JSON.stringify(msg));
         break;
       case "Webapps:GetInstalled":
         this.getInstalled(msg);
         break;
       case "Webapps:GetNotInstalled":
         this.getNotInstalled(msg);
         break;
       case "Webapps:GetAll":
--- a/dom/tests/mochitest/webapps/Makefile.in
+++ b/dom/tests/mochitest/webapps/Makefile.in
@@ -11,17 +11,16 @@ relativesrcdir	= dom/tests/mochitest/web
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
     apps \
     $(NULL)
 
 MOCHITEST_CHROME_FILES	= \
     test_bug_765063.xul \
-    test_bug_771294.xul \
     test_install_app.xul \
     test_list_api.xul \
     test_install_errors.xul \
     test_cross_domain.xul \
     test_install_utf8.xul \
     test_install_receipts.xul \
     jshelper.js \
     apphelper.js \
--- a/dom/tests/mochitest/webapps/apps/Makefile.in
+++ b/dom/tests/mochitest/webapps/apps/Makefile.in
@@ -7,17 +7,16 @@ topsrcdir	 = @top_srcdir@
 srcdir	= @srcdir@
 VPATH	 = @srcdir@
 relativesrcdir	= dom/tests/mochitest/webapps/apps
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_CHROME_FILES	= \
     bug_765063.xul \
-    bug_771294.xul \
     include.html \
     wild_crazy.webapp \
     wild_crazy.webapp^headers^ \
     super_crazy.webapp \
     super_crazy.webapp^headers^ \
     missing_required_field.webapp \
     missing_required_field.webapp^headers^ \
     json_syntax_error.webapp \
--- a/dom/tests/mochitest/webapps/apps/bug_765063.xul
+++ b/dom/tests/mochitest/webapps/apps/bug_765063.xul
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 
 <!-- Any copyright is dedicated to the Public Domain.
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script>
     navigator.mozApps.install("http://www.example.com:80/chrome/dom/tests/mochitest/webapps/apps/super_crazy.webapp", null);
-    history.pushState({}, "", "modified-url");
+    document.location = "about:blank";
   </script>
 </window>
deleted file mode 100644
--- a/dom/tests/mochitest/webapps/apps/bug_771294.xul
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- Any copyright is dedicated to the Public Domain.
-   - http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <script>
-    navigator.mozApps.install("http://www.example.com:80/chrome/dom/tests/mochitest/webapps/apps/super_crazy.webapp", null);
-    window.location = "about:blank";
-  </script>
-</window>
--- a/dom/tests/mochitest/webapps/test_bug_765063.xul
+++ b/dom/tests/mochitest/webapps/test_bug_765063.xul
@@ -13,32 +13,29 @@
   <!-- We only need jshelper.js for debug(), which apphelper.js calls.  But
      - since we include it, we also let it call apphelper.js's popup_listener(),
      - which listens for the install doorhanger and presses its main button. -->
   <script type="application/javascript" src="jshelper.js"/>
 
 <script> 
 SimpleTest.waitForExplicitFinish();
 
-var mmListener = {
-  receiveMessage: function(aMessage) {
-    ppmm.removeMessageListener("Webapps:Install", mmListener);
-
-    var msg = aMessage.json;
-    is(msg.from.indexOf("modified-url"), -1, "the install origin didn't change");
-
+// Observe app installation and confirm that the install origin didn't change.
+var observer = {
+  observe: function observe(subject, topic, data) {
+    Services.obs.removeObserver(observer, "webapps-sync-install");
+    ok(JSON.parse(data).installOrigin == "http://www.example.com",
+       "the install origin didn't change");
     tearDown();
     SimpleTest.finish();
   }
 };
 
-var ppmm = Components.classes["@mozilla.org/parentprocessmessagemanager;1"]
-                     .getService(Components.interfaces.nsIFrameMessageManager);
-
-ppmm.addMessageListener("Webapps:Install", mmListener);
+Components.utils.import("resource://gre/modules/Services.jsm");
+Services.obs.addObserver(observer, "webapps-sync-install", false);
 </script> 
 
   <!-- Load a page that initiates an app installation and then immediately
      - redirects to a page at a different origin.  We can't do this directly
      - inside this test page, because that would cause the test to hang. -->
   <iframe src="http://www.example.com:80/chrome/dom/tests/mochitest/webapps/apps/bug_765063.xul"/>
 
 </window>
deleted file mode 100644
--- a/dom/tests/mochitest/webapps/test_bug_771294.xul
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- Any copyright is dedicated to the Public Domain.
-   - http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="Mozilla Bug 771294">
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-  <script type="application/javascript" src="apphelper.js"/>
-  <script type="application/javascript" src="jshelper.js"/>
-
-<script>
-SimpleTest.waitForExplicitFinish();
-
-Components.utils.import('resource://gre/modules/Services.jsm');
-
-var blocked = true;
-
-Services.obs.addObserver(
-  function observeShowing() {
-    Services.obs.removeObserver(observeShowing, "PopupNotifications-showing");
-    blocked = false;
-  },
-  "PopupNotifications-showing",
-  false
-);
-
-Services.obs.addObserver(
-  function observeInstalling() {
-    Services.obs.removeObserver(observeInstalling, "webapps-ask-install");
-    // Spin the event loop before running the test to give the registry time
-    // to process the install request and (hopefully not) show the doorhanger.
-    setTimeout(function verify() {
-      ok(blocked, "Install panel was blocked after immediate redirect");
-      tearDown();
-      SimpleTest.finish();
-    }, 0);
-  },
-  "webapps-ask-install",
-  false
-);
-
-</script>
-
-  <!-- Load a page that initiates an app installation and then immediately
-     - redirects to a page at a different origin.  We can't do this directly
-     - inside this test page, because that would cause the test to hang. -->
-  <iframe src="http://www.example.com:80/chrome/dom/tests/mochitest/webapps/apps/bug_771294.xul"/>
-
-</window>
--- a/toolkit/Makefile.in
+++ b/toolkit/Makefile.in
@@ -19,17 +19,16 @@ PARALLEL_DIRS = \
   mozapps/extensions \
   mozapps/handling \
   mozapps/preferences \
   mozapps/plugins \
   mozapps/shared \
   obsolete \
   profile \
   themes \
-  webapps \
   $(NULL)
 
 DIRS += \
   mozapps/update \
   $(NULL)
 
 ifdef MOZ_MAINTENANCE_SERVICE
 DIRS += \
--- a/toolkit/content/PopupNotifications.jsm
+++ b/toolkit/content/PopupNotifications.jsm
@@ -236,19 +236,16 @@ PopupNotifications.prototype = {
 
     let existingNotification = this.getNotification(id, browser);
     if (existingNotification)
       this._remove(existingNotification);
 
     let notifications = this._getNotificationsForBrowser(browser);
     notifications.push(notification);
 
-    // Notify observers that we're showing the popup (useful for testing)
-    this._notify("showing");
-
     let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
     if (browser == this.tabbrowser.selectedBrowser && fm.activeWindow == this.window) {
       // show panel now
       this._update(notification.anchorElement);
     } else {
       // Otherwise, update() will display the notification the next time the
       // relevant tab/window is selected.
 
--- a/toolkit/themes/gnomestripe/global/alerts/alert.css
+++ b/toolkit/themes/gnomestripe/global/alerts/alert.css
@@ -22,21 +22,16 @@
 }
 
 .alertBox[orient="vertical"] > .alertImageBox {
   margin-top: 6px;
   margin-bottom: 4px;
   min-width: 46px;
 }
 
-#alertImage {
-  max-width: 48px;
-  max-height: 48px;
-}
-
 .alertTitle {
   font-weight: bold;
 }
 
 .alertText {
   -moz-margin-end: 6px;
 }
 
--- a/toolkit/themes/winstripe/global/alerts/alert.css
+++ b/toolkit/themes/winstripe/global/alerts/alert.css
@@ -27,21 +27,16 @@
   margin-bottom: 4px;
   min-width: 46px;
 }
 
 .alertTitle {
   font-weight: bold;
 }
 
-#alertImage {
-  max-width: 48px;
-  max-height: 48px;
-}
-
 .alertText {
   -moz-margin-end: 6px;
 }
 
 #alertNotification[clickable="true"] {
   cursor: pointer;
 }
 
deleted file mode 100644
--- a/toolkit/webapps/Makefile.in
+++ /dev/null
@@ -1,18 +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/.
-
-DEPTH     = ../..
-topsrcdir = @top_srcdir@
-srcdir    = @srcdir@
-VPATH     = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-include $(topsrcdir)/config/config.mk
-
-EXTRA_PP_JS_MODULES = \
-	WebappOSUtils.jsm \
-	$(NULL)
-
-include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/toolkit/webapps/WebappOSUtils.jsm
+++ /dev/null
@@ -1,81 +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/. */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const CC = Components.Constructor;
-
-let EXPORTED_SYMBOLS = ["WebappOSUtils"];
-
-let WebappOSUtils = {
-  launch: function(aData) {
-#ifdef XP_WIN
-    let appRegKey;
-    try {
-      let open = CC("@mozilla.org/windows-registry-key;1",
-                    "nsIWindowsRegKey", "open");
-      let initWithPath = CC("@mozilla.org/file/local;1",
-                            "nsILocalFile", "initWithPath");
-      let initProcess = CC("@mozilla.org/process/util;1",
-                           "nsIProcess", "init");
-
-      appRegKey = open(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
-                       "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\",
-                       aData.origin, Ci.nsIWindowsRegKey.ACCESS_READ);
-
-      let launchTarget = initWithPath(appRegKey.readStringValue("InstallLocation"));
-      launchTarget.append(appRegKey.readStringValue("AppFilename") + ".exe");
-
-      let process = initProcess(launchTarget);
-      process.runwAsync([], 0);
-    } catch (e) {
-      return false;
-    } finally {
-      if (appRegKey) {
-        appRegKey.close();
-      }
-    }
-
-    return true;
-#elifdef XP_MACOSX
-    let mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]
-                    .createInstance(Ci.nsIMacWebAppUtils);
-    let appPath;
-    try {
-      appPath = mwaUtils.pathForAppWithIdentifier(aData.origin);
-    } catch (e) {}
-
-    if (appPath) {
-      mwaUtils.launchAppWithIdentifier(aData.origin);
-      return true;
-    }
-
-    return false;
-#elifdef XP_UNIX
-    let origin = Services.io.newURI(aData.origin, null, null);
-    let installDir = "." + origin.scheme + ";" + origin.host;
-    if (origin.port != -1)
-      installDir += ";" + origin.port;
-
-    let exeFile = Services.dirsvc.get("Home", Ci.nsIFile);
-    exeFile.append(installDir);
-    exeFile.append("webapprt-stub");
-
-    try {
-      if (exeFile.exists()) {
-        let process = Cc["@mozilla.org/process/util;1"]
-                        .createInstance(Ci.nsIProcess);
-        process.init(exeFile);
-        process.runAsync([], 0);
-        return true;
-      }
-    } catch (e) {}
-
-    return false;
-#else
-    Services.obs.notifyObservers(this, "webapps-launch", JSON.stringify(aData));
-    return true;
-#endif
-  }
-}
--- a/widget/cocoa/nsMacWebAppUtils.mm
+++ b/widget/cocoa/nsMacWebAppUtils.mm
@@ -32,27 +32,8 @@ NS_IMETHODIMP nsMacWebAppUtils::PathForA
     nsCocoaUtils::GetStringForNSString(temp, outPath);
   }
 
   [ap release];
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
-
-NS_IMETHODIMP nsMacWebAppUtils::LaunchAppWithIdentifier(const nsAString& bundleIdentifier) {
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
-
-  NSAutoreleasePool* ap = [[NSAutoreleasePool alloc] init];
-
-  // Note this might return false, meaning the app wasnt launched for some reason. 
-  BOOL success = [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:
-                        [NSString stringWithCharacters:((nsString)bundleIdentifier).get() length:((nsString)bundleIdentifier).Length()]
-                        options: nil
-                        additionalEventParamDescriptor: nil
-                        launchIdentifier: NULL];
-
-
-  [ap release];
-  return NS_OK;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
-}
--- a/widget/nsIMacWebAppUtils.idl
+++ b/widget/nsIMacWebAppUtils.idl
@@ -12,14 +12,9 @@ interface nsIMacWebAppUtils;
 
 [scriptable, uuid(e9096367-ddd9-45e4-b762-49c0c18b7119)]
 interface nsIMacWebAppUtils : nsISupports {
   /**
    * Find the path for an app with the given signature.
    */
   AString pathForAppWithIdentifier(in AString bundleIdentifier);
 
-  /**
-   * Launch the app with the given identifier, if it exists.
-   */
-  void launchAppWithIdentifier(in AString bundleIdentifier);
-
 };