Backed out changeset 217865622f7a (bug 1521902) for an error in the code that will break telemetry
authorshindli <shindli@mozilla.com>
Tue, 22 Jan 2019 23:28:48 +0200
changeset 514877 c0900754337e0568fd2d9896e950ecf9a77e4351
parent 514876 62947b5b105bb61f1875b98671ddfda082980356
child 514878 60ee07f3171f98b42cd7ab9e134b6147e02b5539
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1521902
milestone66.0a1
backs out217865622f7a145aab2909995002191d729c442a
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
Backed out changeset 217865622f7a (bug 1521902) for an error in the code that will break telemetry
browser/components/shell/ShellService.jsm
browser/components/shell/nsGNOMEShellService.cpp
browser/components/shell/nsIShellService.idl
browser/components/shell/nsMacShellService.cpp
browser/components/shell/nsWindowsShellService.cpp
toolkit/components/telemetry/app/TelemetryEnvironment.jsm
--- a/browser/components/shell/ShellService.jsm
+++ b/browser/components/shell/ShellService.jsm
@@ -81,17 +81,17 @@ let ShellServiceInternal = {
   isDefaultBrowser(startupCheck, forAllTypes) {
     // If this is the first browser window, maintain internal state that we've
     // checked this session (so that subsequent window opens don't show the
     // default browser dialog).
     if (startupCheck) {
       this._checkedThisSession = true;
     }
     if (this.shellService) {
-      return this.shellService.isDefaultBrowser(forAllTypes);
+      return this.shellService.isDefaultBrowser(startupCheck, forAllTypes);
     }
     return false;
   },
 };
 
 XPCOMUtils.defineLazyServiceGetter(ShellServiceInternal, "shellService",
   "@mozilla.org/browser/shell-service;1", Ci.nsIShellService);
 
--- a/browser/components/shell/nsGNOMEShellService.cpp
+++ b/browser/components/shell/nsGNOMEShellService.cpp
@@ -185,17 +185,17 @@ bool nsGNOMEShellService::CheckHandlerMa
 
   if (!KeyMatchesAppName(command.get()))
     return false;  // the handler is set to another app
 
   return true;
 }
 
 NS_IMETHODIMP
-nsGNOMEShellService::IsDefaultBrowser(bool aForAllTypes,
+nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck, bool aForAllTypes,
                                       bool *aIsDefaultBrowser) {
   *aIsDefaultBrowser = false;
 
   if (IsRunningAsASnap()) {
     const gchar *argv[] = {"xdg-settings", "check", "default-web-browser",
                            "firefox.desktop", nullptr};
     GSpawnFlags flags = static_cast<GSpawnFlags>(G_SPAWN_SEARCH_PATH |
                                                  G_SPAWN_STDERR_TO_DEV_NULL);
--- a/browser/components/shell/nsIShellService.idl
+++ b/browser/components/shell/nsIShellService.idl
@@ -12,21 +12,25 @@ webidl Element;
 [scriptable, uuid(2d1a95e4-5bd8-4eeb-b0a8-c1455fd2a357)]
 interface nsIShellService : nsISupports
 {
   /**
    * Determines whether or not Firefox is the "Default Browser."
    * This is simply whether or not Firefox is registered to handle
    * http links.
    *
+   * @param aStartupCheck true if this is the check being performed
+   *                      by the first browser window at startup,
+   *                      false otherwise.
    * @param aForAllTypes  true if the check should be made for HTTP and HTML.
    *                      false if the check should be made for HTTP only.
    *                      This parameter may be ignored on some platforms.
    */
-  boolean isDefaultBrowser([optional] in boolean aForAllTypes);
+  boolean isDefaultBrowser(in boolean aStartupCheck,
+                           [optional] in boolean aForAllTypes);
 
   /**
    * Registers Firefox as the "Default Browser."
    *
    * @param aClaimAllTypes Register Firefox as the handler for 
    *                       additional protocols (ftp, chrome etc)
    *                       and web documents (.html, .xhtml etc).
    * @param aForAllUsers   Whether or not Firefox should attempt
--- a/browser/components/shell/nsMacShellService.cpp
+++ b/browser/components/shell/nsMacShellService.cpp
@@ -35,17 +35,17 @@ using mozilla::dom::Element;
       "/System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane")
 
 #define SAFARI_BUNDLE_IDENTIFIER "com.apple.Safari"
 
 NS_IMPL_ISUPPORTS(nsMacShellService, nsIMacShellService, nsIShellService,
                   nsIWebProgressListener)
 
 NS_IMETHODIMP
-nsMacShellService::IsDefaultBrowser(bool aForAllTypes,
+nsMacShellService::IsDefaultBrowser(bool aStartupCheck, bool aForAllTypes,
                                     bool* aIsDefaultBrowser) {
   *aIsDefaultBrowser = false;
 
   CFStringRef firefoxID = ::CFBundleGetIdentifier(::CFBundleGetMainBundle());
   if (!firefoxID) {
     // CFBundleGetIdentifier is expected to return nullptr only if the specified
     // bundle doesn't have a bundle identifier in its plist. In this case, that
     // means a failure, since our bundle does have an identifier.
--- a/browser/components/shell/nsWindowsShellService.cpp
+++ b/browser/components/shell/nsWindowsShellService.cpp
@@ -194,18 +194,20 @@ static nsresult GetAppRegName(nsAutoStri
                  appDirStr.Length() * sizeof(nsAutoString::char_type));
   aAppRegName.AppendInt((int)(hash >> 32), 16);
   aAppRegName.AppendInt((int)hash, 16);
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsWindowsShellService::IsDefaultBrowser(bool aForAllTypes,
+nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, bool aForAllTypes,
                                         bool* aIsDefaultBrowser) {
+  mozilla::Unused << aStartupCheck;
+
   *aIsDefaultBrowser = false;
 
   RefPtr<IApplicationAssociationRegistration> pAAR;
   HRESULT hr = CoCreateInstance(
       CLSID_ApplicationAssociationRegistration, nullptr, CLSCTX_INPROC,
       IID_IApplicationAssociationRegistration, getter_AddRefs(pAAR));
   if (FAILED(hr)) {
     return NS_OK;
--- a/toolkit/components/telemetry/app/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/app/TelemetryEnvironment.jsm
@@ -1353,45 +1353,45 @@ EnvironmentCache.prototype = {
     return buildData;
   },
 
   /**
    * Determine if we're the default browser.
    * @returns null on error, true if we are the default browser, or false otherwise.
    */
   _isDefaultBrowser() {
-    let isDefault = (service, ...args) => {
-      try {
-        return !!service.isDefaultBrowser(...args);
-      } catch (ex) {
-        this._log.error("_isDefaultBrowser - Could not determine if default browser", ex);
-        return null;
-      }
-    };
-
     if (!("@mozilla.org/browser/shell-service;1" in Cc)) {
       this._log.info("_isDefaultBrowser - Could not obtain browser shell service");
       return null;
     }
 
+    let shellService;
     try {
-      let { shellService } = ChromeUtils.import("resource:///modules/ShellService.jsm", {});
-      // This uses the same set of flags used by the pref pane.
-      return isDefault(shellService, false, true);
+      let scope = {};
+      ChromeUtils.import("resource:///modules/ShellService.jsm", scope);
+      shellService = scope.ShellService;
     } catch (ex) {
       this._log.error("_isDefaultBrowser - Could not obtain shell service JSM");
     }
 
+    if (!shellService) {
+      try {
+        shellService = Cc["@mozilla.org/browser/shell-service;1"]
+                         .getService(Ci.nsIShellService);
+      } catch (ex) {
+        this._log.error("_isDefaultBrowser - Could not obtain shell service", ex);
+        return null;
+      }
+    }
+
     try {
-      let shellService = Cc["@mozilla.org/browser/shell-service;1"]
-                            .getService(Ci.nsIShellService);
-    // This uses the same set of flags used by the pref pane.
-      return isDefault(shellService, true);
+      // This uses the same set of flags used by the pref pane.
+      return !!shellService.isDefaultBrowser(false, true);
     } catch (ex) {
-      this._log.error("_isDefaultBrowser - Could not obtain shell service", ex);
+      this._log.error("_isDefaultBrowser - Could not determine if default browser", ex);
       return null;
     }
   },
 
   _updateDefaultBrowser() {
     if (AppConstants.platform === "android") {
       return;
     }