Bug 1521902: Remove unused argument from nsIShellService.isDefaultBrowser. r=rstrong,chutten
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 24 Jan 2019 20:08:14 +0000
changeset 515336 63b7e43db7ccc849c3977d487ffd02e55118310e
parent 515335 9a347a546d90d87842ca160c836f8d0305b14b99
child 515337 5b918623055ebf2e2565e2554ad72b1d6f33dc68
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, chutten
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,chutten 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
@@ -1412,45 +1412,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;
     }