Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Orion Browser #3610 #4432

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tyirvine
Copy link

@tyirvine tyirvine commented Mar 3, 2024

Description

This pull request has some reference to issue #3610. But mainly this pull request is so we can run Vimium in Orion. For those that don't know, Orion is a WebKit based browser that is attempting to support both Chrome and Firefox extensions alike.

I believe Vimium was working previously for the most part but then something to do with settings parsing broke it I believe. The issue I found was that WebKit's support for JSON.parse() seems to have a few issues.

  1. There was a ^ symbol in vimium.css that WebKit's JSON.parse() didn't know how to handle when iterating and parsing through the settings keys in settings.js: migrateSettingsIfNecessary(settings).

  2. WebKit's JSON.parse() struggled again in the same iterator when given an item that was not a stringified JSON object. So a simple validation was added in so only stringified JSON objects would be parsed.

After these fixes were made I tested it with Orion Version 0.99.126.4.1-beta (WebKit 618.1.2).

A small formatting fix was also made.

@tyirvine
Copy link
Author

tyirvine commented Mar 3, 2024

Hang on, sorry I just found an additional bug when using the / search command of Vimium. I'll work on fixing this.

TypeError: node.checkVisibility is not a function. (In 'node.checkVisibility()', 'node.checkVisibility' is undefined)

@brunoti
Copy link

brunoti commented Feb 6, 2025

Any news on this one? I want to help! I think I have some more bugs and I want to see if I can contribute.

// Migration for v2.0.0: decode all values so that they're not JSON string encoded.
const newSettings = {};
for (const [k, v] of Object.entries(settings)) {
// Most pre-2.0 settings were strings, but the global marks were stored as native values. See
// #4323. So check the setting value's type before migrating.
if (typeof v === "string") {
if (typeof v === "string" && isValidJSON(v)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code will call JSON.parse(str) twice on every successful call instead of putting the try-catch directly where it's necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants