mirror of
https://github.com/zen-browser/desktop.git
synced 2025-11-10 04:25:12 +00:00
feat: Close tab and switch to recent tab when going back with no history, p=#11190
Co-authored-by: mr. m <91018726+mr-cheffy@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
|
||||
index b4b79e7fb3228ba91bd8afa08659be0d88883725..9e1d59b6a736107e55bda73686a4a627e4c0ba7c 100644
|
||||
index b4b79e7fb3228ba91bd8afa08659be0d88883725..b4801e2a3076139622d58f81943e61cd61ee1828 100644
|
||||
--- a/browser/base/content/browser.js
|
||||
+++ b/browser/base/content/browser.js
|
||||
@@ -31,6 +31,7 @@ ChromeUtils.defineESModuleGetters(this, {
|
||||
@@ -10,7 +10,21 @@ index b4b79e7fb3228ba91bd8afa08659be0d88883725..9e1d59b6a736107e55bda73686a4a627
|
||||
DevToolsSocketStatus:
|
||||
"resource://devtools/shared/security/DevToolsSocketStatus.sys.mjs",
|
||||
DownloadUtils: "resource://gre/modules/DownloadUtils.sys.mjs",
|
||||
@@ -2298,6 +2299,8 @@ var XULBrowserWindow = {
|
||||
@@ -822,7 +823,12 @@ function UpdateBackForwardCommands(aWebNavigation) {
|
||||
|
||||
var backDisabled = backCommand.hasAttribute("disabled");
|
||||
var forwardDisabled = forwardCommand.hasAttribute("disabled");
|
||||
- if (backDisabled == aWebNavigation.canGoBack) {
|
||||
+ var canGoBack = aWebNavigation.canGoBack;
|
||||
+ if (!canGoBack) {
|
||||
+ canGoBack = gZenCommonActions.shouldCloseTabOnBack();
|
||||
+ }
|
||||
+
|
||||
+ if (backDisabled == canGoBack) {
|
||||
if (backDisabled) {
|
||||
backCommand.removeAttribute("disabled");
|
||||
} else {
|
||||
@@ -2298,6 +2304,8 @@ var XULBrowserWindow = {
|
||||
AboutReaderParent.updateReaderButton(gBrowser.selectedBrowser);
|
||||
TranslationsParent.onLocationChange(gBrowser.selectedBrowser);
|
||||
|
||||
@@ -19,7 +33,7 @@ index b4b79e7fb3228ba91bd8afa08659be0d88883725..9e1d59b6a736107e55bda73686a4a627
|
||||
PictureInPicture.updateUrlbarToggle(gBrowser.selectedBrowser);
|
||||
|
||||
if (!gMultiProcessBrowser) {
|
||||
@@ -3809,7 +3812,7 @@ function warnAboutClosingWindow() {
|
||||
@@ -3809,7 +3817,7 @@ function warnAboutClosingWindow() {
|
||||
|
||||
if (!isPBWindow && !toolbar.visible) {
|
||||
return gBrowser.warnAboutClosingTabs(
|
||||
@@ -28,7 +42,7 @@ index b4b79e7fb3228ba91bd8afa08659be0d88883725..9e1d59b6a736107e55bda73686a4a627
|
||||
gBrowser.closingTabsEnum.ALL
|
||||
);
|
||||
}
|
||||
@@ -3849,7 +3852,7 @@ function warnAboutClosingWindow() {
|
||||
@@ -3849,7 +3857,7 @@ function warnAboutClosingWindow() {
|
||||
return (
|
||||
isPBWindow ||
|
||||
gBrowser.warnAboutClosingTabs(
|
||||
@@ -37,7 +51,7 @@ index b4b79e7fb3228ba91bd8afa08659be0d88883725..9e1d59b6a736107e55bda73686a4a627
|
||||
gBrowser.closingTabsEnum.ALL
|
||||
)
|
||||
);
|
||||
@@ -3874,7 +3877,7 @@ function warnAboutClosingWindow() {
|
||||
@@ -3874,7 +3882,7 @@ function warnAboutClosingWindow() {
|
||||
AppConstants.platform != "macosx" ||
|
||||
isPBWindow ||
|
||||
gBrowser.warnAboutClosingTabs(
|
||||
@@ -46,7 +60,7 @@ index b4b79e7fb3228ba91bd8afa08659be0d88883725..9e1d59b6a736107e55bda73686a4a627
|
||||
gBrowser.closingTabsEnum.ALL
|
||||
)
|
||||
);
|
||||
@@ -4796,6 +4799,9 @@ var ConfirmationHint = {
|
||||
@@ -4796,6 +4804,9 @@ var ConfirmationHint = {
|
||||
MozXULElement.insertFTLIfNeeded("toolkit/branding/brandings.ftl");
|
||||
MozXULElement.insertFTLIfNeeded("browser/confirmationHints.ftl");
|
||||
document.l10n.setAttributes(this._message, messageId, options.l10nArgs);
|
||||
|
||||
Reference in New Issue
Block a user