From b204c03f7eb3bcc36213eb68b920829a018001e1 Mon Sep 17 00:00:00 2001 From: girst Date: Sun, 1 Dec 2019 18:57:09 +0100 Subject: [PATCH] Remove misuse of isXULDocument() A new isXULElement() has been introduced as a replacement for improper use of isXULDocument() (where the latter was used to indirectly check the former). isXULDocument() only works if the xul-xmlns is attached to the document as its main namespace, which is not the case e.g. on fx72's about:preferences#sync (the test for which now uses isXULElement). The test in isProperLink() actually wants to know if an element belongs to the XUL namespace, not if it is embedded in a document of that NS (to treat element equivalent to ). The blurring condition in events-frame.coffee was introduced in e881629 for about:config, but that does not work any more and is also annoying on :prefs (and was again an indirect test for what was actually wanted). In commands-frame.coffee's commands.follow(), two of the three uses of isXULDocument have been replaced by the proper isXULElement, the third one is likely to be correct (as there isn't a on xul-s). This leaves us with 1 remaining unclean use, in commands-frame.coffee's helper_follow(). It is used to catch all the xul elements that have html equivalents with different tag names. Replacing that with something proper will not be attempted in this change, as it would probably require changing its callers to pass in different arguments when ran in the XUL namespace. --- extension/lib/commands-frame.coffee | 14 +++++++------- extension/lib/events-frame.coffee | 6 ++---- extension/lib/utils.coffee | 11 ++++++++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/extension/lib/commands-frame.coffee b/extension/lib/commands-frame.coffee index ab943b0..9746788 100644 --- a/extension/lib/commands-frame.coffee +++ b/extension/lib/commands-frame.coffee @@ -240,7 +240,6 @@ commands.follow = helper_follow.bind( null, {id: 'normal'}, ({vim, element, getElementShape}) -> document = element.ownerDocument - isXUL = utils.isXULDocument(document) type = null switch # Bootstrap. Match these before regular links, because especially slider @@ -292,14 +291,16 @@ commands.follow = helper_follow.bind( # its `` gets one. However, some sites hide the actual `` # but keeps the `