diff options
| author | Stephen Blott | 2016-03-05 06:36:16 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-06 11:27:45 +0000 |
| commit | 0822f8244d328233752c7f986a70e805ee238979 (patch) | |
| tree | d0e313d7ccf3d77e50923a195709840610d8f585 /tests/dom_tests | |
| parent | 755c9fb4f837a9f8b80d51610e86c3ba2ea1999f (diff) | |
| download | vimium-0822f8244d328233752c7f986a70e805ee238979.tar.bz2 | |
Initialize UI components only when they're needed.
HUD: Initialize only when the frame receives the focus and Vimium is enabled.
Vomnibar: Initialize in the top frame when Vimium is enabled in *any* frame.
Warning: There may be a race condition here. Specifically, if Vimium
is disabled in the main/top frame (T) but enabled in another frame (A), then the
initialisation could happen in frame A before frame T is listening, so
frame T would miss the initialization message (which is only sent once).
Message listeners are installed early (and probably installed first in
the main/top frame), and the `isEnabledForUrl` messaging takes some
time, so perhaps it's OK. But it *is* a race condition.
Fixes #1838.
Diffstat (limited to 'tests/dom_tests')
| -rw-r--r-- | tests/dom_tests/dom_tests.coffee | 1 | ||||
| -rw-r--r-- | tests/dom_tests/vomnibar_test.coffee | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee index 0745e5b2..3797a37b 100644 --- a/tests/dom_tests/dom_tests.coffee +++ b/tests/dom_tests/dom_tests.coffee @@ -1,6 +1,7 @@ # Install frontend event handlers. installListeners() +HUD.init() installListener = (element, event, callback) -> element.addEventListener event, (-> callback.apply(this, arguments)), true diff --git a/tests/dom_tests/vomnibar_test.coffee b/tests/dom_tests/vomnibar_test.coffee index 3eda6234..0898e33a 100644 --- a/tests/dom_tests/vomnibar_test.coffee +++ b/tests/dom_tests/vomnibar_test.coffee @@ -1,5 +1,6 @@ vomnibarFrame = null SearchEngines.refresh "" +Vomnibar.init() context "Keep selection within bounds", |
