Backed out 2 changesets (bug 1801954, bug 1863980) for bc failures on browser_setDefaultBrowser.js. CLOSED TREE
Backed out changeset b96506a6d950 (bug 1801954) Backed out changeset 306a649fcc00 (bug 1863980)
This commit is contained in:
@@ -613,13 +613,7 @@ nsBrowserContentHandler.prototype = {
|
||||
}
|
||||
}
|
||||
if (cmdLine.handleFlag("setDefaultBrowser", false)) {
|
||||
// Note that setDefaultBrowser is an async function, but "handle" (the method being executed)
|
||||
// is an implementation of an interface method and changing it to be async would be complicated
|
||||
// and ultimately nothing here needs the result of setDefaultBrowser, so we do not bother doing
|
||||
// an await.
|
||||
lazy.ShellService.setDefaultBrowser(true).catch(e => {
|
||||
console.error("setDefaultBrowser failed:", e);
|
||||
});
|
||||
lazy.ShellService.setDefaultBrowser(true);
|
||||
}
|
||||
|
||||
if (cmdLine.handleFlag("first-startup", false)) {
|
||||
|
||||
@@ -5488,12 +5488,7 @@ export var DefaultBrowserCheck = {
|
||||
let buttonNumClicked = rv.get("buttonNumClicked");
|
||||
let checkboxState = rv.get("checked");
|
||||
if (buttonNumClicked == 0) {
|
||||
try {
|
||||
await shellService.setAsDefault();
|
||||
} catch (e) {
|
||||
this.log.error("Failed to set the default browser", e);
|
||||
}
|
||||
|
||||
shellService.setAsDefault();
|
||||
shellService.pinToTaskbar();
|
||||
}
|
||||
if (checkboxState) {
|
||||
|
||||
@@ -1734,7 +1734,7 @@ var gMainPane = {
|
||||
/**
|
||||
* Set browser as the operating system default browser.
|
||||
*/
|
||||
async setDefaultBrowser() {
|
||||
setDefaultBrowser() {
|
||||
if (AppConstants.HAVE_SHELL_SERVICE) {
|
||||
let alwaysCheckPref = Preferences.get(
|
||||
"browser.shell.checkDefaultBrowser"
|
||||
@@ -1748,20 +1748,11 @@ var gMainPane = {
|
||||
if (!shellSvc) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable the set default button, so that the user doesn't try to hit it again
|
||||
// while awaiting on setDefaultBrowser
|
||||
let setDefaultButton = document.getElementById("setDefaultButton");
|
||||
setDefaultButton.disabled = true;
|
||||
|
||||
try {
|
||||
await shellSvc.setDefaultBrowser(false);
|
||||
shellSvc.setDefaultBrowser(false);
|
||||
} catch (ex) {
|
||||
console.error(ex);
|
||||
return;
|
||||
} finally {
|
||||
// Make sure to re-enable the default button when we're finished, regardless of the outcome
|
||||
setDefaultButton.disabled = false;
|
||||
}
|
||||
|
||||
let isDefault = shellSvc.isDefaultBrowser(false, true);
|
||||
|
||||
@@ -164,7 +164,7 @@ async function test_with_mock_shellservice(options, testFn) {
|
||||
isDefaultBrowser() {
|
||||
return this._isDefault;
|
||||
},
|
||||
async setDefaultBrowser() {
|
||||
setDefaultBrowser() {
|
||||
this._isDefault = true;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -253,7 +253,7 @@ let ShellServiceInternal = {
|
||||
}
|
||||
}
|
||||
try {
|
||||
await this.defaultAgent.setDefaultBrowserUserChoiceAsync(
|
||||
this.defaultAgent.setDefaultBrowserUserChoice(
|
||||
aumi,
|
||||
extraFileExtensions
|
||||
);
|
||||
@@ -314,7 +314,7 @@ let ShellServiceInternal = {
|
||||
},
|
||||
|
||||
// override nsIShellService.setDefaultBrowser() on the ShellService proxy.
|
||||
async setDefaultBrowser(forAllUsers) {
|
||||
setDefaultBrowser(forAllUsers) {
|
||||
// On Windows, our best chance is to set UserChoice, so try that first.
|
||||
if (
|
||||
AppConstants.platform == "win" &&
|
||||
@@ -322,26 +322,24 @@ let ShellServiceInternal = {
|
||||
"setDefaultBrowserUserChoice"
|
||||
)
|
||||
) {
|
||||
try {
|
||||
await this.setAsDefaultUserChoice();
|
||||
return;
|
||||
} catch (err) {
|
||||
lazy.log.warn(
|
||||
"Error thrown during setAsDefaultUserChoice. Full exception:",
|
||||
err
|
||||
);
|
||||
|
||||
// intentionally fall through to setting via the non-user choice pathway on error
|
||||
}
|
||||
// nsWindowsShellService::SetDefaultBrowser() kicks off several
|
||||
// operations, but doesn't wait for their result. So we don't need to
|
||||
// await the result of setAsDefaultUserChoice() here, either, we just need
|
||||
// to fall back in case it fails.
|
||||
this.setAsDefaultUserChoice().catch(err => {
|
||||
console.error(err);
|
||||
this.shellService.setDefaultBrowser(forAllUsers);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.shellService.setDefaultBrowser(forAllUsers);
|
||||
},
|
||||
|
||||
async setAsDefault() {
|
||||
setAsDefault() {
|
||||
let setAsDefaultError = false;
|
||||
try {
|
||||
await ShellService.setDefaultBrowser(false);
|
||||
ShellService.setDefaultBrowser(false);
|
||||
} catch (ex) {
|
||||
setAsDefaultError = true;
|
||||
console.error(ex);
|
||||
|
||||
@@ -1666,7 +1666,7 @@ export var UITour = {
|
||||
try {
|
||||
let shell = aWindow.getShellService();
|
||||
if (shell) {
|
||||
await shell.setDefaultBrowser(false);
|
||||
shell.setDefaultBrowser(false);
|
||||
}
|
||||
} catch (e) {}
|
||||
break;
|
||||
|
||||
@@ -97,8 +97,8 @@ export const SpecialMessageActions = {
|
||||
*
|
||||
* @param {Window} window Reference to a window object
|
||||
*/
|
||||
async setDefaultBrowser(window) {
|
||||
await window.getShellService().setAsDefault();
|
||||
setDefaultBrowser(window) {
|
||||
window.getShellService().setAsDefault();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -442,10 +442,10 @@ export const SpecialMessageActions = {
|
||||
break;
|
||||
case "PIN_AND_DEFAULT":
|
||||
await this.pinFirefoxToTaskbar(window, action.data?.privatePin);
|
||||
await this.setDefaultBrowser(window);
|
||||
this.setDefaultBrowser(window);
|
||||
break;
|
||||
case "SET_DEFAULT_BROWSER":
|
||||
await this.setDefaultBrowser(window);
|
||||
this.setDefaultBrowser(window);
|
||||
break;
|
||||
case "SET_DEFAULT_PDF_HANDLER":
|
||||
this.setDefaultPDFHandler(
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define DEFAULT_BROWSER_SET_DEFAULT_BROWSER_H__
|
||||
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsArray.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
#include <functional>
|
||||
|
||||
namespace mozilla::default_agent {
|
||||
|
||||
Reference in New Issue
Block a user