Bug 1521902: Remove unused argument from nsIShellService.isDefaultBrowser. r=rstrong
☠☠ backed out by c0900754337e ☠ ☠
authorDave Townsend <dtownsend@oxymoronical.com>
Tue, 22 Jan 2019 20:41:41 +0000
changeset 514870 217865622f7a145aab2909995002191d729c442a
parent 514869 f8a289c9c4819cfc9ef35666d54a907398ff6259
child 514871 bf6483db1801dd3c7987bae28d7440501d0770f3
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)
reviewersrstrong
bugs1521902
milestone66.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 1521902: Remove unused argument from nsIShellService.isDefaultBrowser. r=rstrong Differential Revision: https://phabricator.services.mozilla.com/D17281
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(startupCheck, forAllTypes);
+      return this.shellService.isDefaultBrowser(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 aStartupCheck, bool aForAllTypes,
+nsGNOMEShellService::IsDefaultBrowser(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,25 +12,21 @@ 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(in boolean aStartupCheck,
-                           [optional] in boolean aForAllTypes);
+  boolean isDefaultBrowser([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 aStartupCheck, bool aForAllTypes,
+nsMacShellService::IsDefaultBrowser(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,20 +194,18 @@ 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 aStartupCheck, bool aForAllTypes,
+nsWindowsShellService::IsDefaultBrowser(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 scope = {};
-      ChromeUtils.import("resource:///modules/ShellService.jsm", scope);
-      shellService = scope.ShellService;
+      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);
     } 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 {
-      // This uses the same set of flags used by the pref pane.
-      return !!shellService.isDefaultBrowser(false, true);
+      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);
     } catch (ex) {
-      this._log.error("_isDefaultBrowser - Could not determine if default browser", ex);
+      this._log.error("_isDefaultBrowser - Could not obtain shell service", ex);
       return null;
     }
   },
 
   _updateDefaultBrowser() {
     if (AppConstants.platform === "android") {
       return;
     }