From 73b82cddaeb5c5422ae222dc1a135424acb94608 Mon Sep 17 00:00:00 2001 From: girst Date: Sun, 3 Mar 2024 14:18:16 +0100 Subject: [PATCH] remove workarounds for legacy browsers --- extension/lib/commands.coffee | 8 ++------ extension/lib/main.coffee | 4 ++-- extension/lib/markable-elements.coffee | 4 +--- extension/lib/utils.coffee | 22 +++++++++------------- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/extension/lib/commands.coffee b/extension/lib/commands.coffee index ee91c29..46e20da 100644 --- a/extension/lib/commands.coffee +++ b/extension/lib/commands.coffee @@ -27,10 +27,7 @@ commands = {} commands.focus_location_bar = ({vim}) -> - try - vim.window.gURLBar.select() # fx76+ - catch - vim.window.focusAndSelectUrlBar() + vim.window.gURLBar.select() commands.focus_search_bar = ({vim, count}) -> # The `.webSearch()` method opens a search engine in a tab if the search bar @@ -757,8 +754,7 @@ commands.click_browser_element = ({vim}) -> }) MarkerContainer.remove(window) # Better safe than sorry. markerContainer.container.classList.add('ui') - mainWindow = window.document.body or - window.document.getElementById('main-window') # fallback ) # check whether Fission is enabled, and warn the user if so. - FISSION_ENABLED_PREF = 'fission.autostart' # fx68+ - FISSION_ISOLATION_PREF = 'fission.webContentIsolationStrategy' # fx94+ + FISSION_ENABLED_PREF = 'fission.autostart' + FISSION_ISOLATION_PREF = 'fission.webContentIsolationStrategy' IGNORE_FISSION_PREF = 'ignore_fission' isFissionWindow = window.docShell.nsILoadContext.useRemoteSubframes isFissionEnabled = prefs.root.get(FISSION_ENABLED_PREF) diff --git a/extension/lib/markable-elements.coffee b/extension/lib/markable-elements.coffee index ebc58fe..4dc5dc3 100644 --- a/extension/lib/markable-elements.coffee +++ b/extension/lib/markable-elements.coffee @@ -291,10 +291,8 @@ tryPoint = (elementData, elementRect, x, dx, y, dy, tryRight = 0) -> # `document.elementFromPoint` but their closest non-anonymous parents are. # The same is true for Web Components (where their hosts are returned), with # the further caveat that they might be nested. -# Note: getBindingParent() has been removed from fx72. normalize = (element) -> - element = e while (e = element.ownerDocument.getBindingParent?(element))? - element = e while (e = element.containingShadowRoot?.host)? # >=fx72 + element = e while (e = element.containingShadowRoot?.host)? element = element.parentNode while element.prefix? return element diff --git a/extension/lib/utils.coffee b/extension/lib/utils.coffee index e7b8837..650e18f 100644 --- a/extension/lib/utils.coffee +++ b/extension/lib/utils.coffee @@ -24,8 +24,8 @@ XULButtonElement = Ci.nsIDOMXULButtonElement XULControlElement = Ci.nsIDOMXULControlElement XULMenuListElement = Ci.nsIDOMXULMenuListElement -# Traverse the DOM upwards until we hit its containing document (most likely an -# HTMLDocument or (<=fx68) XULDocument) or the ShadowRoot. +# Traverse the DOM upwards until we hit its containing document or the +# ShadowRoot. getDocument = (e) -> if e.parentNode? then arguments.callee(e.parentNode) else e isInShadowRoot = (element) -> @@ -99,8 +99,7 @@ isDevtoolsWindow = (window) -> # SecurityError; the `try` around it makes it `undefined` in such a case. return (try window.location?.href) in [ 'about:devtools-toolbox' - 'chrome://devtools/content/framework/toolbox.xul' - 'chrome://devtools/content/framework/toolbox.xhtml' # fx72+ + 'chrome://devtools/content/framework/toolbox.xhtml' ] # Note: this is possibly a bit overzealous, but Works For Now™. @@ -318,19 +317,17 @@ contentAreaClick = (data, browser) -> params = { charset: browser.characterSet, referrerInfo: E10SUtils.deserializeReferrerInfo(data.referrerInfo), - allowMixedContent: data.allowMixedContent, # <=fx88 isContentWindowPrivate: data.isContentWindowPrivate, originPrincipal: data.originPrincipal, originStoragePrincipal: data.originStoragePrincipal, triggeringPrincipal: data.triggeringPrincipal, csp: if data.csp then E10SUtils.deserializeCSP(data.csp) else null, - frameOuterWindowID: data.frameOuterWindowID, # <=fx79 - frameID: data.frameID, # >=fx80 + frameID: data.frameID, allowInheritPrincipal: true, - openerBrowser: browser, # >=fx98 - hasValidUserGestureActivation: true, # >=fx103 + openerBrowser: browser, + hasValidUserGestureActivation: true, triggeringRemoteType: browser.browsingContext.currentWindowGlobal - .domProcess?.remoteType, # >=fx109 + .domProcess?.remoteType, } if data.originAttributes.userContextId @@ -400,9 +397,8 @@ simulateMouseEvents = (element, sequence, browserOffset) -> element.dispatchEvent(mouseEvent) else try - (window.windowUtils.dispatchDOMEventViaPresShellForTesting or - window.windowUtils.dispatchDOMEventViaPresShell # < fx73 - )(element, mouseEvent) + window.windowUtils + .dispatchDOMEventViaPresShellForTesting(element, mouseEvent) catch error if error.result != Cr.NS_ERROR_UNEXPECTED throw error -- 2.39.3