From 529cd72e91242815e7bfd436bd8c2a437da0dc99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=A0tamcar?= Date: Thu, 26 Sep 2024 13:45:33 +0200 Subject: [PATCH] Fix compatibility with Firefox 131 --- .../profile/chrome/pwa/content/browser.css | 6 +++++ .../profile/chrome/pwa/content/browser.jsm | 24 ++++++------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/native/userchrome/profile/chrome/pwa/content/browser.css b/native/userchrome/profile/chrome/pwa/content/browser.css index a88aa00b..0c759f86 100644 --- a/native/userchrome/profile/chrome/pwa/content/browser.css +++ b/native/userchrome/profile/chrome/pwa/content/browser.css @@ -176,6 +176,12 @@ height: 30px; } + .site-info > .tab-throbber, + .site-info > .tab-icon-pending, + .site-info > .tab-icon-image { + margin-inline-end: 5.5px; + } + .tab-icon-image { flex-shrink: 0; } diff --git a/native/userchrome/profile/chrome/pwa/content/browser.jsm b/native/userchrome/profile/chrome/pwa/content/browser.jsm index 35e5259a..7ad1a07a 100644 --- a/native/userchrome/profile/chrome/pwa/content/browser.jsm +++ b/native/userchrome/profile/chrome/pwa/content/browser.jsm @@ -186,16 +186,16 @@ class PwaBrowser { const menuItem = this.createElement(document, 'menuitem', { id: 'contextmenu-openlinkdefault', 'data-l10n-id': 'context-menu-open-link-default-browser', oncommand: 'gContextMenu.openLinkInDefaultBrowser()' }); document.getElementById('context-sep-open').before(menuItem) - hookFunction(window, 'openContextMenu', null, () => { + // Handle clicking on it and open link in default browser + nsContextMenu.prototype.openLinkInDefaultBrowser = function () { + MailIntegration._launchExternalUrl(makeURI(this.linkURL)); + }; + + hookFunction(nsContextMenu.prototype, 'initOpenItems', null, function () { // Display it only when clicked on links - const shouldShow = window.gContextMenu.onSaveableLink || window.gContextMenu.onPlainTextLink; + const shouldShow = this.onSaveableLink || this.onPlainTextLink; document.getElementById('context-sep-open').hidden = !shouldShow; menuItem.hidden = !shouldShow; - - // Handle clicking on it and open link in default browser - window.gContextMenu.openLinkInDefaultBrowser = function () { - MailIntegration._launchExternalUrl(makeURI(this.linkURL)); - }; }); } @@ -576,16 +576,6 @@ class PwaBrowser { return BrowserWindowTracker._openWindow(options); } } - - // Handle opening new window from context menus - hookFunction(window, 'openContextMenu', null, () => { - gContextMenu.openLink = function () { - return window.openDialog(AppConstants.BROWSER_CHROME_URL, '_blank', 'chrome,all,dialog=no,non-private', this.linkURL); - }; - gContextMenu.openLinkInPrivateWindow = function () { - return window.openDialog(AppConstants.BROWSER_CHROME_URL, '_blank', 'chrome,all,dialog=no,private', this.linkURL); - }; - }); } handleDisablingShortcuts () {