From 0de6b076271b673d0e1dcc2b74b2ddd1646bf08e Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 31 May 2015 16:35:09 +0100 Subject: Rewrite settings as a tight wrapper around Settings, tweaks for tests --- content_scripts/vimium_frontend.coffee | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index c8c83029..c603e15f 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -65,37 +65,18 @@ settings = searchEngines: null init: -> - @port = chrome.runtime.connect name: "settings" - @port.onMessage.addListener (response) => @receiveMessage response + @port = true + Settings.init() - # If the port is closed, the background page has gone away (since we never close it ourselves). Stub the - # settings object so we don't keep trying to connect to the extension even though it's gone away. - @port.onDisconnect.addListener => - @port = null - for own property, value of this - # @get doesn't depend on @port, so we can continue to support it to try and reduce errors. - @[property] = (->) if "function" == typeof value and property != "get" - - get: (key) -> @values[key] + get: Settings.get.bind Settings set: (key, value) -> @init() unless @port + Settings.set key, value - @values[key] = value - @port.postMessage operation: "set", key: key, value: value - - load: -> - @init() unless @port - @port.postMessage operation: "fetch", values: @values - - receiveMessage: (response) -> - @values = response.values if response.values? - @values[response.key] = response.value if response.key? and response.value? - @isLoaded = true - listener() while listener = @eventListeners.load?.pop() + load: -> @init() unless @port - addEventListener: (eventName, callback) -> - (@eventListeners[eventName] ||= []).push callback + addEventListener: Settings.addEventListener.bind Settings # # Give this frame a unique (non-zero) id. -- cgit v1.2.3 From 4b420fe89502ce910d4cc13fda51e0a8ad06fed9 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 31 May 2015 17:55:32 +0100 Subject: Replace settings.get with Settings.get in the frontend --- content_scripts/hud.coffee | 2 +- content_scripts/link_hints.coffee | 10 +++++----- content_scripts/scroller.coffee | 4 ++-- content_scripts/vimium_frontend.coffee | 20 +++++++++----------- content_scripts/vomnibar.coffee | 2 +- 5 files changed, 18 insertions(+), 20 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/hud.coffee b/content_scripts/hud.coffee index f38d6b45..84b8abeb 100644 --- a/content_scripts/hud.coffee +++ b/content_scripts/hud.coffee @@ -48,7 +48,7 @@ HUD = -> ready and document.body != null # A preference which can be toggled in the Options page. */ - enabled: -> !settings.get("hideHud") + enabled: -> !Settings.get("hideHud") class Tween opacity: 0 diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 3cebac4c..daf738a3 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -29,7 +29,7 @@ LinkHints = # Handle the link hinting marker generation and matching. Must be initialized after settings have been # loaded, so that we can retrieve the option setting. getMarkerMatcher: -> - if settings.get("filterLinkHints") then filterHints else alphabetHints + if Settings.get("filterLinkHints") then filterHints else alphabetHints # lock to ensure only one instance runs at a time isActive: false # Call this function on exit (if defined). @@ -60,7 +60,7 @@ LinkHints = # For these modes, we filter out those elements which don't have an HREF (since there's nothing we can do # with them). elements = (el for el in elements when el.element.href?) if mode in [ COPY_LINK_URL, OPEN_INCOGNITO ] - if settings.get "filterLinkHints" + if Settings.get "filterLinkHints" # When using text filtering, we sort the elements such that we visit descendants before their ancestors. # This allows us to exclude the text used for matching descendants from that used for matching their # ancestors. @@ -389,7 +389,7 @@ alphabetHints = # may be of different lengths. # hintStrings: (linkCount) -> - linkHintCharacters = settings.get("linkHintCharacters") + linkHintCharacters = Settings.get("linkHintCharacters") # Determine how many digits the link hints will require in the worst case. Usually we do not need # all of these digits for every link single hint, so we can show shorter hints for a few of the links. digitsNeeded = Math.ceil(@logXOfBase(linkCount, linkHintCharacters.length)) @@ -460,7 +460,7 @@ filterHints = @labelMap[forElement] = labelText generateHintString: (linkHintNumber) -> - (numberToHintString linkHintNumber + 1, settings.get "linkHintNumbers").toUpperCase() + (numberToHintString linkHintNumber + 1, Settings.get "linkHintNumbers").toUpperCase() generateLinkText: (element) -> linkText = "" @@ -519,7 +519,7 @@ filterHints = if (!@hintKeystrokeQueue.pop() && !@linkTextKeystrokeQueue.pop()) return { linksMatched: [] } else if (keyChar) - if (settings.get("linkHintNumbers").indexOf(keyChar) >= 0) + if (Settings.get("linkHintNumbers").indexOf(keyChar) >= 0) @hintKeystrokeQueue.push(keyChar) else # since we might renumber the hints, the current hintKeyStrokeQueue diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee index 27fc9cdc..29142064 100644 --- a/content_scripts/scroller.coffee +++ b/content_scripts/scroller.coffee @@ -139,7 +139,7 @@ CoreScroller = @time += 1 # Return true if CoreScroller would not initiate a new scroll right now. - wouldNotInitiateScroll: -> @lastEvent?.repeat and @settings.get "smoothScroll" + wouldNotInitiateScroll: -> @lastEvent?.repeat and Settings.get "smoothScroll" # Calibration fudge factors for continuous scrolling. The calibration value starts at 1.0. We then # increase it (until it exceeds @maxCalibration) if we guess that the scroll is too slow, or decrease it @@ -153,7 +153,7 @@ CoreScroller = scroll: (element, direction, amount, continuous = true) -> return unless amount - unless @settings.get "smoothScroll" + unless Settings.get "smoothScroll" # Jump scrolling. performScroll element, direction, amount checkVisibility element diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index c603e15f..23b725e4 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -68,8 +68,6 @@ settings = @port = true Settings.init() - get: Settings.get.bind Settings - set: (key, value) -> @init() unless @port Settings.set key, value @@ -101,7 +99,7 @@ class GrabBackFocus extends Mode mousedown: => @alwaysContinueBubbling => @exit() activate = => - return @exit() unless settings.get "grabBackFocus" + return @exit() unless Settings.get "grabBackFocus" @push _name: "grab-back-focus-focus" focus: (event) => @grabBackFocus event.target @@ -345,14 +343,14 @@ extend window, scrollToTop: -> Scroller.scrollTo "y", 0 scrollToLeft: -> Scroller.scrollTo "x", 0 scrollToRight: -> Scroller.scrollTo "x", "max" - scrollUp: -> Scroller.scrollBy "y", -1 * settings.get("scrollStepSize") - scrollDown: -> Scroller.scrollBy "y", settings.get("scrollStepSize") + scrollUp: -> Scroller.scrollBy "y", -1 * Settings.get("scrollStepSize") + scrollDown: -> Scroller.scrollBy "y", Settings.get("scrollStepSize") scrollPageUp: -> Scroller.scrollBy "y", "viewSize", -1/2 scrollPageDown: -> Scroller.scrollBy "y", "viewSize", 1/2 scrollFullPageUp: -> Scroller.scrollBy "y", "viewSize", -1 scrollFullPageDown: -> Scroller.scrollBy "y", "viewSize" - scrollLeft: -> Scroller.scrollBy "x", -1 * settings.get("scrollStepSize") - scrollRight: -> Scroller.scrollBy "x", settings.get("scrollStepSize") + scrollLeft: -> Scroller.scrollBy "x", -1 * Settings.get("scrollStepSize") + scrollRight: -> Scroller.scrollBy "x", Settings.get("scrollStepSize") extend window, reload: -> window.location.reload() @@ -698,7 +696,7 @@ updateFindModeQuery = -> # the query can be treated differently (e.g. as a plain string versus regex depending on the presence of # escape sequences. '\' is the escape character and needs to be escaped itself to be used as a normal # character. here we grep for the relevant escape sequences. - findModeQuery.isRegex = settings.get 'regexFindMode' + findModeQuery.isRegex = Settings.get 'regexFindMode' hasNoIgnoreCaseFlag = false findModeQuery.parsedQuery = findModeQuery.rawQuery.replace /(\\{1,2})([rRI]?)/g, (match, slashes, flag) -> return match if flag == "" or slashes.length != 1 @@ -1010,12 +1008,12 @@ findAndFollowRel = (value) -> return true window.goPrevious = -> - previousPatterns = settings.get("previousPatterns") || "" + previousPatterns = Settings.get("previousPatterns") || "" previousStrings = previousPatterns.split(",").filter( (s) -> s.trim().length ) findAndFollowRel("prev") || findAndFollowLink(previousStrings) window.goNext = -> - nextPatterns = settings.get("nextPatterns") || "" + nextPatterns = Settings.get("nextPatterns") || "" nextStrings = nextPatterns.split(",").filter( (s) -> s.trim().length ) findAndFollowRel("next") || findAndFollowLink(nextStrings) @@ -1070,7 +1068,7 @@ window.showHelpDialog = (html, fid) -> VimiumHelpDialog = # This setting is pulled out of local storage. It's false by default. - getShowAdvancedCommands: -> settings.get("helpDialog_showAdvancedCommands") + getShowAdvancedCommands: -> Settings.get("helpDialog_showAdvancedCommands") init: () -> this.dialogElement = document.getElementById("vimiumHelpDialog") diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 4bd8e8fd..6c08ce92 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -8,7 +8,7 @@ Vomnibar = # the form "keyword=X", for direct activation of a custom search engine. parseRegistryEntry: (registryEntry = { options: [] }, callback = null) -> options = {} - searchEngines = settings.get("searchEngines") ? "" + searchEngines = Settings.get("searchEngines") ? "" SearchEngines.refreshAndUse searchEngines, (engines) -> for option in registryEntry.options [ key, value ] = option.split "=" -- cgit v1.2.3 From 2929935c1ebb093797c2b5d02153ec18e63a2c24 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 31 May 2015 17:56:32 +0100 Subject: Replace settings.set with Settings.set in the frontend --- content_scripts/vimium_frontend.coffee | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 23b725e4..90c2b09d 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -68,10 +68,6 @@ settings = @port = true Settings.init() - set: (key, value) -> - @init() unless @port - Settings.set key, value - load: -> @init() unless @port addEventListener: Settings.addEventListener.bind Settings @@ -1084,7 +1080,7 @@ window.showHelpDialog = (html, fid) -> event.preventDefault() showAdvanced = VimiumHelpDialog.getShowAdvancedCommands() VimiumHelpDialog.showAdvancedCommands(!showAdvanced) - settings.set("helpDialog_showAdvancedCommands", !showAdvanced) + Settings.set("helpDialog_showAdvancedCommands", !showAdvanced) showAdvancedCommands: (visible) -> VimiumHelpDialog.dialogElement.getElementsByClassName("toggleAdvancedCommands")[0].innerHTML = -- cgit v1.2.3 From c17914f59a27779d102a80ccee27f08298b7c015 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 31 May 2015 17:59:27 +0100 Subject: Replace settings.addEventListener with Settings.addEventListener in the frontend --- content_scripts/vimium_frontend.coffee | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 90c2b09d..17922659 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -70,8 +70,6 @@ settings = load: -> @init() unless @port - addEventListener: Settings.addEventListener.bind Settings - # # Give this frame a unique (non-zero) id. # @@ -102,7 +100,7 @@ class GrabBackFocus extends Mode # An input may already be focused. If so, grab back the focus. @grabBackFocus document.activeElement if document.activeElement - if settings.isLoaded then activate() else settings.addEventListener "load", activate + if settings.isLoaded then activate() else Settings.addEventListener "load", activate grabBackFocus: (element) -> return @continueBubbling unless DomUtils.isEditable element @@ -157,7 +155,7 @@ window.initializeModes = -> # Complete initialization work that sould be done prior to DOMReady. # initializePreDomReady = -> - settings.addEventListener("load", LinkHints.init.bind(LinkHints)) + Settings.addEventListener "load", LinkHints.init.bind LinkHints settings.load() initializeModes() -- cgit v1.2.3 From 7e67c3d36b47641b21ec24be5d8f7af11ad08756 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 31 May 2015 18:01:42 +0100 Subject: Init Settings directly instead of via settings.load, and only do it once --- content_scripts/vimium_frontend.coffee | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 17922659..5655ef61 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -68,8 +68,6 @@ settings = @port = true Settings.init() - load: -> @init() unless @port - # # Give this frame a unique (non-zero) id. # @@ -156,7 +154,7 @@ window.initializeModes = -> # initializePreDomReady = -> Settings.addEventListener "load", LinkHints.init.bind LinkHints - settings.load() + Settings.init() initializeModes() checkIfEnabledForUrl() @@ -240,7 +238,6 @@ window.installListeners = -> # onFocus = (event) -> if event.target == window - settings.load() chrome.runtime.sendMessage handler: "frameFocused", frameId: frameId checkIfEnabledForUrl true -- cgit v1.2.3 From f09f65c53cddf05544c8fa417bb0d92438c98a63 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 31 May 2015 18:10:01 +0100 Subject: Remove all remaining references to frontend settings --- content_scripts/scroller.coffee | 7 +++---- content_scripts/vimium_frontend.coffee | 11 ++--------- 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee index 29142064..81c71fcd 100644 --- a/content_scripts/scroller.coffee +++ b/content_scripts/scroller.coffee @@ -117,8 +117,7 @@ checkVisibility = (element) -> # CoreScroller contains the core function (scroll) and logic for relative scrolls. All scrolls are ultimately # translated to relative scrolls. CoreScroller is not exported. CoreScroller = - init: (frontendSettings) -> - @settings = frontendSettings + init: -> @time = 0 @lastEvent = null @keyIsDown = false @@ -215,11 +214,11 @@ CoreScroller = # Scroller contains the two main scroll functions which are used by clients. Scroller = - init: (frontendSettings) -> + init: -> handlerStack.push _name: 'scroller/active-element' DOMActivate: (event) -> handlerStack.alwaysContinueBubbling -> activatedElement = event.target - CoreScroller.init frontendSettings + CoreScroller.init() # scroll the active element in :direction by :amount * :factor. # :factor is needed because :amount can take on string values, which scrollBy converts to element dimensions. diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 5655ef61..b6c61c04 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -46,9 +46,6 @@ textInputXPath = (-> # must be called beforehand to ensure get() will return up-to-date values. # settings = - isLoaded: false - port: null - eventListeners: {} values: scrollStepSize: null linkHintCharacters: null @@ -64,10 +61,6 @@ settings = grabBackFocus: null searchEngines: null - init: -> - @port = true - Settings.init() - # # Give this frame a unique (non-zero) id. # @@ -98,7 +91,7 @@ class GrabBackFocus extends Mode # An input may already be focused. If so, grab back the focus. @grabBackFocus document.activeElement if document.activeElement - if settings.isLoaded then activate() else Settings.addEventListener "load", activate + if Settings.isLoaded then activate() else Settings.addEventListener "load", activate grabBackFocus: (element) -> return @continueBubbling unless DomUtils.isEditable element @@ -147,7 +140,7 @@ window.initializeModes = -> new NormalMode new PassKeysMode new InsertMode permanent: true - Scroller.init settings + Scroller.init() # # Complete initialization work that sould be done prior to DOMReady. -- cgit v1.2.3 From c62bee9036c05beb7945a0a9088e848617960f26 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 31 May 2015 18:14:29 +0100 Subject: Update the comment by the settings object in the frontend --- content_scripts/vimium_frontend.coffee | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index b6c61c04..47ee9e68 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -41,10 +41,9 @@ textInputXPath = (-> DomUtils.makeXPath(inputElements) )() -# -# settings provides a browser-global localStorage-backed dict. get() and set() are synchronous, but load() -# must be called beforehand to ensure get() will return up-to-date values. -# +# NOTE(mrmr1993): we use Settings everywhere instead of the dedicated implementation that was here. +# Previously, only the values listed below would be loaded. If the space used by settings across all of our +# content scripts is becoming an issue, then we can restrict the values we load to the list below. settings = values: scrollStepSize: null -- cgit v1.2.3 From c62ffa33ad5230b89f44cb8f3268e6a4e48afd52 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Mon, 1 Jun 2015 07:04:43 +0100 Subject: Re-work unified settings. This is a minor re-working of #1705 from @mrmr1993. The main changes are: - Simplify initialisation logic. - Always initialise Settings immediately and automatically (ie. don't initialise Settings separately and manually in the background, content scripts, options and tests). - Get rid of addEventListener (it's only being used for on "load"). - Add Settings.use() in its place. --- content_scripts/link_hints.coffee | 2 +- content_scripts/vimium_frontend.coffee | 42 ++++++++-------------------------- 2 files changed, 11 insertions(+), 33 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index daf738a3..0ea40bd3 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -26,7 +26,7 @@ LinkHints = linkActivator: undefined # While in delayMode, all keypresses have no effect. delayMode: false - # Handle the link hinting marker generation and matching. Must be initialized after settings have been + # Handle the link hinting marker generation and matching. Must be initialized after Settings have been # loaded, so that we can retrieve the option setting. getMarkerMatcher: -> if Settings.get("filterLinkHints") then filterHints else alphabetHints diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 47ee9e68..bb1e971f 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -41,25 +41,6 @@ textInputXPath = (-> DomUtils.makeXPath(inputElements) )() -# NOTE(mrmr1993): we use Settings everywhere instead of the dedicated implementation that was here. -# Previously, only the values listed below would be loaded. If the space used by settings across all of our -# content scripts is becoming an issue, then we can restrict the values we load to the list below. -settings = - values: - scrollStepSize: null - linkHintCharacters: null - linkHintNumbers: null - filterLinkHints: null - hideHud: null - previousPatterns: null - nextPatterns: null - regexFindMode: null - userDefinedLinkHintCss: null - helpDialog_showAdvancedCommands: null - smoothScroll: null - grabBackFocus: null - searchEngines: null - # # Give this frame a unique (non-zero) id. # @@ -82,15 +63,15 @@ class GrabBackFocus extends Mode _name: "grab-back-focus-mousedown" mousedown: => @alwaysContinueBubbling => @exit() - activate = => - return @exit() unless Settings.get "grabBackFocus" - @push - _name: "grab-back-focus-focus" - focus: (event) => @grabBackFocus event.target - # An input may already be focused. If so, grab back the focus. - @grabBackFocus document.activeElement if document.activeElement - - if Settings.isLoaded then activate() else Settings.addEventListener "load", activate + Settings.use "grabBackFocus", (grabBackFocus) => + if grabBackFocus + @push + _name: "grab-back-focus-focus" + focus: (event) => @grabBackFocus event.target + # An input may already be focused. If so, grab back the focus. + @grabBackFocus document.activeElement if document.activeElement + else + @exit() grabBackFocus: (element) -> return @continueBubbling unless DomUtils.isEditable element @@ -145,8 +126,7 @@ window.initializeModes = -> # Complete initialization work that sould be done prior to DOMReady. # initializePreDomReady = -> - Settings.addEventListener "load", LinkHints.init.bind LinkHints - Settings.init() + Settings.use "theKeyHereDoesNotMatter", LinkHints.init.bind LinkHints initializeModes() checkIfEnabledForUrl() @@ -224,7 +204,6 @@ window.installListeners = -> # # Whenever we get the focus: -# - Reload settings (they may have changed). # - Tell the background page this frame's URL. # - Check if we should be enabled. # @@ -1146,7 +1125,6 @@ window.onbeforeunload = -> scrollY: window.scrollY) root = exports ? window -root.settings = settings root.handlerStack = handlerStack root.frameId = frameId root.windowIsFocused = windowIsFocused -- cgit v1.2.3 From e8476682362b9648aba874e8581fe9076479f734 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Mon, 1 Jun 2015 09:46:41 +0100 Subject: Remove LinkHints.init()... LinkHints.init() isn't doing anything. --- content_scripts/link_hints.coffee | 5 ----- content_scripts/vimium_frontend.coffee | 2 -- 2 files changed, 7 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 0ea40bd3..2bcc7508 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -35,11 +35,6 @@ LinkHints = # Call this function on exit (if defined). onExit: null - # - # To be called after linkHints has been generated from linkHintsBase. - # - init: -> - # We need this as a top-level function because our command system doesn't yet support arguments. activateModeToOpenInNewTab: -> @activateMode(OPEN_IN_NEW_BG_TAB) activateModeToOpenInNewForegroundTab: -> @activateMode(OPEN_IN_NEW_FG_TAB) diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index bb1e971f..8000a9ec 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -126,8 +126,6 @@ window.initializeModes = -> # Complete initialization work that sould be done prior to DOMReady. # initializePreDomReady = -> - Settings.use "theKeyHereDoesNotMatter", LinkHints.init.bind LinkHints - initializeModes() checkIfEnabledForUrl() refreshCompletionKeys() -- cgit v1.2.3