philc / philc/vimium

Firefox: NS_ERROR_NOT_IMPLEMENTED on unsupported movements in Visual & Caret Mode

Open
#4,633 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
27k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Regarding the SyntaxError I've mentioned in #4629

I just realized, that Firefox only returns a SyntaxError on completely invalid values for the granularity, which was triggered by vimword in our case before I added the necessary return statements.

In cases where granularity is set to a value that is defined in the method standard, but isn't implemented in Firefox, it throws NS_ERROR_NOT_IMPLEMENTED instead. So those errors still appear in the Firefox console even after my fix from #4632.

Quote from MDN modify#granularity

Note: Firefox does not implement "sentence", "paragraph", "sentenceboundary", "paragraphboundary", or "documentboundary". WebKit and Blink do.

From VisualMode.prototype.movements defined in content_scripts/mode_visual.js

  ")": "forward sentence",
  "(": "backward sentence",
  "}": "forward paragraph",
  "{": "backward paragraph",
  "G": "forward documentboundary",
  "gg": "backward documentboundary"

So Vimium's bindings for ( ) { } gg G currently fail in Firefox and produce the error in the console.

It might be worth considering catching these cases and adding a warning message to inform the user about this incompatibility. However in those cases the HUD is already occupied showing the Visual Mode or Caret Mode respectively, so I don't know how that would work.

Alternatively, we might also go the extra mile and try to find an implementation to polyfill (some of) this missing behavior to become available in Firefox as well. I feel like documentboundary might be fairly easy to implement - paragraph and sentence might be more tricky.

@philc what do you think we should do? I wanted to discuss this first before going down that rabbit hole on my own. The minimum fix, I would suggest to implement is catching these cases to avoid the console errors.

To Reproduce

Steps to reproduce the behavior:

  1. Use Vimium on Firefox
  2. enter Visual or Caret Mode ('v' or 'v' followed by 'c')
  3. use any of the bindings ( ) { } gg G
  4. selection / caret doesn't change
  5. NS_ERROR_NOT_IMPLEMENTED appears in the browser console

Browser and Vimium version

Firefox 135.0
Vimium 2.1.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in content_scripts/mode_visual.js at VisualMode.prototype.movements, then reproduce the issue in Firefox 135 using Visual or Caret Mode and the ( ) { } gg G bindings. Review the Firefox Selection.modify granularity behavior described in the issue and determine the agreed handling for unsupported movements. Done means these bindings no longer produce NS_ERROR_NOT_IMPLEMENTED in the browser console.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.