Backed out changeset 217865622f7a (bug 1521902) for an error in the code that will break telemetry

This commit is contained in:
shindli 2019-01-22 23:28:48 +02:00
parent a3846471d6
commit 1d09d7bee4
6 changed files with 28 additions and 22 deletions

View File

@ -86,7 +86,7 @@ let ShellServiceInternal = {
this._checkedThisSession = true;
}
if (this.shellService) {
return this.shellService.isDefaultBrowser(forAllTypes);
return this.shellService.isDefaultBrowser(startupCheck, forAllTypes);
}
return false;
},

View File

@ -190,7 +190,7 @@ bool nsGNOMEShellService::CheckHandlerMatchesAppName(
}
NS_IMETHODIMP
nsGNOMEShellService::IsDefaultBrowser(bool aForAllTypes,
nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck, bool aForAllTypes,
bool *aIsDefaultBrowser) {
*aIsDefaultBrowser = false;

View File

@ -17,11 +17,15 @@ interface nsIShellService : nsISupports
* 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."

View File

@ -40,7 +40,7 @@ NS_IMPL_ISUPPORTS(nsMacShellService, nsIMacShellService, nsIShellService,
nsIWebProgressListener)
NS_IMETHODIMP
nsMacShellService::IsDefaultBrowser(bool aForAllTypes,
nsMacShellService::IsDefaultBrowser(bool aStartupCheck, bool aForAllTypes,
bool* aIsDefaultBrowser) {
*aIsDefaultBrowser = false;

View File

@ -199,8 +199,10 @@ static nsresult GetAppRegName(nsAutoString& aAppRegName) {
}
NS_IMETHODIMP
nsWindowsShellService::IsDefaultBrowser(bool aForAllTypes,
nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, bool aForAllTypes,
bool* aIsDefaultBrowser) {
mozilla::Unused << aStartupCheck;
*aIsDefaultBrowser = false;
RefPtr<IApplicationAssociationRegistration> pAAR;

View File

@ -1358,35 +1358,35 @@ EnvironmentCache.prototype = {
* @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;
}
},