diff options
| author | Stephen Blott | 2014-11-02 12:36:00 +0000 |
|---|---|---|
| committer | Stephen Blott | 2014-11-02 12:40:23 +0000 |
| commit | 623befe1a878d04a5d3b5ce57358ab81ee4faac4 (patch) | |
| tree | 9f007f133c8f872515646d4469eca625e16cf5d2 | |
| parent | 3bae8f0f8fc012720001caced69999160d9005fa (diff) | |
| download | vimium-623befe1a878d04a5d3b5ce57358ab81ee4faac4.tar.bz2 | |
Don't skip installing listeners.
Fix listener installation bug. To see bug, do:
- open vimium options page
- use 'b' to select and go to a bookmark
- use <alt-LEFT_ARROW> to return to options page
- vimium key bindings are now *not* installed
Bug was introduced in 28e9c8374bfc7a4fd479dbb958a4a87331fb0857.
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 8f4c0f2a..118f985e 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -135,8 +135,6 @@ initializePreDomReady = -> # Ensure the sendResponse callback is freed. false - installEventListeners() - # Wrapper to install event listeners. Syntactic sugar. installListener = (element, event, callback) -> element.addEventListener(event, -> @@ -144,20 +142,14 @@ installListener = (element, event, callback) -> , true) # -# This is called once the background page has told us that Vimium should be enabled for the current URL. -# We enable/disable Vimium by toggling isEnabledForUrl. -# -initializeWhenEnabled = (newPassKeys) -> - isEnabledForUrl = true - passKeys = newPassKeys - -# # Installing or uninstalling listeners is error prone. Instead we elect to check isEnabledForUrl each time so # we know whether the listener should run or not. # Run this as early as possible, so the page can't register any event handlers before us. # installedListeners = false -installEventListeners = -> +initializeWhenEnabled = (newPassKeys) -> + isEnabledForUrl = true + passKeys = newPassKeys if (!installedListeners) # Key event handlers fire on window before they do on document. Prefer window for key events so the page # can't set handlers to grab the keys before us. @@ -171,9 +163,9 @@ installEventListeners = -> installedListeners = true setState = (request) -> + initializeWhenEnabled(request.passKeys) if request.enabled isEnabledForUrl = request.enabled passKeys = request.passKeys - initializeWhenEnabled(passKeys) if isEnabledForUrl # # The backend needs to know which frame has focus. |
