aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2016-04-14Merge pull request #2097 from smblott-github/ui-component-init-sequenceStephen Blott
Rework UI component init sequence.
2016-04-14Merge pull request #2093 from smblott-github/c-y-c-e-for-visual-modeStephen Blott
Add <c-y> and <c-e> for visual mode.
2016-04-14Rework UI component init sequence.Stephen Blott
In testing global link hints, it seems that UI components can be opened before they're actually ready, and Vimium hangs with a broken UI component displayed. This issue seems to be in 1.54 too. It's not clear what's causing this -- and it's hard to reproduce systematically. However, it only seems to happen on navigation. Therefore, it seems likely that there is an issue with the initialization sequence. Here, we wait for: - the DOM content to be ready, and - the port to be provided before registering the UI component as ready.
2016-04-13Add <c-y> and <c-e> for visual mode.Stephen Blott
Fixes #2092.
2016-04-12Set the mode indicator last.Stephen Blott
Similarly to the previous commit: 454f5272c71388c53665d7505aa6832566284e2b. This is intended to mitigate some CSP violations we're seeing. In some circumstances - as yet not fully pinned down - messages to the HUD trigger CSP violations. Until we track that down, we move all HUD operations (in link hints) to the end of their execution slice. So, if HUD operations fail, then they won't affect any other operation. The error message for offending HUD operations is: ui_component.js:55: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('chrome-extension://hiihfcebjbnoniicphblpiekhfmbdmog') does not match the recipient window's origin ('null').
2016-04-12Make rects absolute in window earlier.Stephen Blott
This is part of an effort (as yet incomplete) to track down some CSP violations we're getting, in this case related to global link hints. Prior to this, we were seeing CSP violations when accessing the window subsequently to collecting the hints, specifically when accessing window.scrollX/Y. Here, we collect the window position immediately, when initially harvesting the hints.
2016-04-11Better visual-mode selection handling.Stephen Blott
Assume there is an existing range selection. Consider `v`, `Escape`. Previously, this had the side effect of clearing the selection. That behaviour seems odd and wrong. Here, we retain the selection if there was an existing range selection when visual mode was launched. Arguably, this removes a "feature" whereby `v`, `Escape` clears the selection. Here, we take it that the oddity above outweighs the loss of this arguably unintentional "feature".
2016-04-11Only add find-mode HUD text if there is any.Stephen Blott
This applies to when find mode is launched. When the text was empty (which is always), we were triggering a console error message (selection range isn't in document). However, when the text is empty, we don't actually need to add it to the input. So, here we don't.
2016-04-11Revert always initialize help dialog.Stephen Blott
Here's the trade off... We either *always* initialize the help dialog in every frame of every tab, or we initialize it only when needed. The help dialog is rarely used by anybody except beginners, so the latter seems like the better approach. However, on busy/slow loading pages, the help dialog can fail to load on page start up. (We need to fix this, but I don't know how right now). In the meantime, the better compromise seems to be to initialize the help dialog only when needed. This was the status quo prior to 6e12e005a4261711583571be23018481a4a23230 and 09e119db8d8c3ad2077ac509f73fefb76a08fac0.
2016-04-10Always init() the help dialog.Stephen Blott
2016-04-10Fix Vomnibar initialization issue.Stephen Blott
On a slow loading page, as the page is loading, hit `o` repeatedly. Eventually, Vimium hangs. We seem to have had this problem for quite some time (e.g. it's in 1.54). This fixes the problem by ensuring that the Vomnibar is initialized before launching it. Also fix the same issue for the help dialog.
2016-04-09Simplify javascript: URLs in vomnibar.Stephen Blott
Show "javascript:" URLs as "javascript:...". Fixes #961.
2016-04-09A UI component isn't ready until it's ready.Stephen Blott
1. Do not initialize UI components until the DOm is ready. 2. Do not register UI components as ready (specifically the HUD) until the full initialization sequence is complete. This goes some way towards fixing the issue described in this comment: https://github.com/philc/vimium/issues/2081#issuecomment-205758102 It relates to link-hints mode hanging when launched during a navigation. This problem exists in 1.54, but emerged during testing of global link hints. "Some way toeards fixing..." because it is still possible to trigger issues.
2016-04-09Minor performance tweak.Stephen Blott
Two minor tweaks: 1. Do not use ".indexOf()" three times for each comparison; do it just once. 2. Check the common case (no match) first. These are very minor performance tweaks; but, with global link hints, we pay this cost n times (for n frames).
2016-04-08Trim linkText when it's collected, not repreatedly.Stephen Blott
There's no need to repeatedly trim linkText. Instead, just trim it when it's first collected, then we can assume from there on that it's trimmed.
2016-04-08Filtered hints; do not accept split characters.Stephen Blott
There is no point accepting characters which are used for splitting the link text in the query string, since such characters cannot appear in link text words.
2016-04-08Simplify filtered hint matching.Stephen Blott
- Reduce the number of passes over hint markers from two to one. - Filter out non-matching hints before sorting. - Do not trim the search string twice.
2016-04-08Merge pull request #2088 from ↵Stephen Blott
smblott-github/filtered-hints-better-typed-text-matching Filtered hints: better typed text handling.
2016-04-08Refactor setModeIndicator().Stephen Blott
Previously this had two independent functions: set the @mode and update the indicator. We don't always do those two things at the same time. So this refactors things into two separate functions.
2016-04-08Show filtered characters in mode indicator.Stephen Blott
2016-04-08Filtered hints; ignore unmatched text.Stephen Blott
When the user is typing a link's text, any mistyped character exits link hints mode. This makes little sense. In practice, this usually happens because the user mis-typed something. Here, we ignore typed characters which do not match any hints. (Also, add a test for this.)
2016-04-08Reinstate necessary test.Stephen Blott
Reinstate test removed incorrectly in d1c230cabb051a5429242c98e67d37b65edc58b8.
2016-04-08Do not post hint descriptors back to the frame itself.Stephen Blott
When distributing hint descriptors, do not post a frame's own hint descriptors back to the frame itself. It already has them. With regard to the message-passing cost only, this represents a speedup of approximately 3/2 for link-busy sites like reddit -- several tens of milliseconds for me. There are other costs too (such as processing the hint descriptors) bu these are not affected.
2016-04-05Frame Ids must be integers.Stephen Blott
2016-04-05Unregister frame when postMessage fails.Stephen Blott
2016-04-05Better close-down for global link hints.Stephen Blott
- Unregister frames with the background-page hint coordinator. - Better page cleanup in the content scripts. - Require documentReady before harvesting hints. There is still an issue in some cases when link-hints are activated as a page is transitioning, but that problem case seems to have existed in 1.54. I'll continue to investigate.
2016-04-05Unregister frame on "unload".Stephen Blott
It seems we cannot rely on the port being disconnected to unregister a frame. So we need to unregister it on "unload".
2016-04-05Check for document.activeElement.Stephen Blott
When DomUtils.isFocusable() is called from GrabBackFocus-pushState-monitor it is possible that document.activeElement is not ready. So we should check. Here, we check in DomUtils.isFocusable(), because we always need element to be defined for this test, not just in GrabBackFocus-pushState-monitor.
2016-04-04Remove keyboard-suppressing mode when necessary.Stephen Blott
2016-04-04Only send required link-hint properties.Stephen Blott
There's other stuff (ports, frameIds) in @tabState[tabId] that we don't need in the front end. Here, we only send the three properties which we do need.
2016-04-04Add backstop for global link hints.Stephen Blott
This is not at all satisfactory. I've seen cases where global link hints hangs, apparently because we do not hear back from a frame. The issue is repeatable when it happens, but not repeatable in general (if you reload the page, then it goes away). This suggests that there may be something fundamentally wrong with the global link-hints logic. However, what? In the interim, this adds a timer to trigger link-hints mode activation with whataver hints we do have after a short period of time. Ideally, we'll be able to get rid of this soon.
2016-04-04Better indicator message.Stephen Blott
2016-04-04Shorten link text.Stephen Blott
When a link's text is particularly long, displaying all of its text makes the hint look weird - so shorten it. We still use the full text for matching.
2016-04-04Do not offer activated element as scrollable.Stephen Blott
Scrollable divs are offered via link hints. It makes no sense to offer the current activated element for selection - so don't. On a "normal" page where there's just one scrollable thing, document.body, this means that we no longer offer the unnecessary "Scroll." hint.
2016-04-04Better handling of port failures.Stephen Blott
If we lose contact with a frame (it's goine away) while still awaiting hints from that frame, then post a dummy/empty list of hints instead. This seems very unlikely to come up, but we should guard against it anyway. We use "nextTick()" so that we finish sending the current message before sending the dummy hints.
2016-04-04Handle all frames the same (for frames/ports).Stephen Blott
This is experimental, and may be reverted. I suspect that the special treatment of the top frame may actually be causing problems for global link hints (rather than solving them!).
2016-04-04Handle requireHref for link hints locally.Stephen Blott
The check that an element as an href (for certain hint modes) can be done earlier, thereby avoid the need to pass that information between frames.
2016-04-04Document hint descriptors.Stephen Blott
2016-04-04Keep showLinkText local for link hints.Stephen Blott
We only need showLinkText in the hint's local frame, so do not transmit it to remote frames.
2016-04-04Keep reason local for link hints.Stephen Blott
The "reason" a hint is available is only ever needed in the hint's own frame, so there's no need to pass it to other frames.
2016-04-04Keep rects local for link hints.Stephen Blott
Previously, we passed each hints rect to every other frame. However, the rect is only actually needed in its own frame. Here, we instead keep (and use) each hint's rect locally only.
2016-04-04Do not render link hints in remote frames.Stephen Blott
Previously, we were rendering hints in all frames, but displaying only in their own frame With n frames and m hints, we rendered n*m hints. With this, hints are only rendered in their own frame, so we only render m hints.
2016-04-03Freeze frame state on link-hint activation.Stephen Blott
We take a copy of the frame Ids and ports at the point which link-hints mode is launched, and use that subsequently. Therefore, a newly created frame cannot cause the hint coordinator to become confused. Also: add debugging code.
2016-04-03Remove blocking mode when no hints found.Stephen Blott
This fixes an error in 39adee9090fc5aadfd5dd681f91b80025084858a. Specifically, if there are no hints to select from, or no documentElement, then link-hints mode exits without initiating an actual mode (i.e. without calling its super() constructor). With 39adee9090fc5aadfd5dd681f91b80025084858a, that leaves a mode in place which blocks all keyboard events, thereby rendering Vimium entirely hung. See this line: https://github.com/philc/vimium/commit/39adee9090fc5aadfd5dd681f91b80025084858a#diff-e9abcb9ebcdb5af8e9f33651364673a1R59. Here: - we explicitly remove the keyboard-blocking mode - we add exitOnEscape (so that the situation is at least recoverable), and - we add an indicator (so that we can see what's going on). It is proposed that the indicator is a temporary feature, while the global link hints feature is in shake down.
2016-04-02Simplify UI component initialisation.Stephen Blott
There's no need for the previous complicated approach to UI component initialialisation, in particular for the Vomnibar. We only initialise the Vomnibar in the top frame. However, if for some reason it hasn't been initialised by the time it's needed, then we can just initialise it then. We are only initialising it early to avoid flicker, so it's not a correctness issue. And the only reason it wouldn't be initialised is if Vimium is disabled in the top frame, but enabled in some other frame -- which is not a common case.
2016-04-02Revert previous tweak.Stephen Blott
We need to wait for documentReady() here to ensure that the document is ready in the top frame.
2016-04-02Make stableSortCount per instance.Stephen Blott
I've not observed this, but it could possily happen... If the stableSortCount gets out of sync in different frames, then different frames might make different decisions about the ordering of the hints. Ti avoid this potentially happening, we initialise the stableSortCount every time link-hints mode is activated.
2016-04-02Make document.body selectable as scrollable.Stephen Blott
Previously, we could select divs, uls, and ols for scrolling, but we couldn't get back to scrolling the document body. This makes it possible to select document.body for scrolling. Unfortunately, sometimes the hint appears in a rather odd place (because it's "on top of" something else which is clickable.
2016-04-02Refactor DomUtils.documentReady.Stephen Blott
We do not need to install separate event listeners for every callback. Just install one listener and keep track of the callbacks ourself. This is clearer, and also determines the order in which callbacks are called. (Although, we don't rely on that currently.) This also adds a tests.
2016-04-02Rework DomUtils.documentReady().Stephen Blott
There seems to be an issue on this page: - http://i.imgur.com/PdmUjij.jpg whereby "DOMContentLoaded" isn't firing. The page structure is unusual (involving a shadow-DOM element), which might be the source of the problem. What happens is that the "DOMContentLoaded" event fires as required, but the document state is still "loading". Here, we just say that if the "DOMContentLoaded" handler has fired once, then we're good to go.