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

Fix createTab incognito and createTab window commands with no URLs on Firefox #3675

Closed

Conversation

nsunderland1
Copy link

Description

Currently, user-defined mappings for createTab incognito and createTab window with no URL parameters fail on Firefox, e.g.:

map X createTab incognito
map X createTab window

This is because these commands try to call chrome.windows.create with about:newtab as a URL parameter, which is illegal in Firefox. The solution is to instead call chrome.windows.create with the URL parameter omitted, which makes it default to the Firefox's home page (for createTab window) or about:privatebrowsing (for createTab incognito). A similar solution is already in place for the basic createTab command:

// Firefox does not support "about:newtab" in chrome.tabs.create.
if (winConfig["url"] === Settings.defaults.newTabUrl)
delete winConfig["url"];

gdh1995 added a commit to gdh1995/vimium-c that referenced this pull request Sep 28, 2020
@philc philc closed this in 31f1332 Sep 17, 2023
@philc
Copy link
Owner

philc commented Sep 17, 2023

Thank you @nsunderland1 for writing up a clear solution. I've adapted your PR to the latest code base and this is now fixed. It will ship with Vimium v2.0.

incognito: request.registryEntry.options.incognito || false
};
if (windowConfig.url.length === 0) {
delete windowConfig.url;
Copy link
Owner

@philc philc Sep 17, 2023

Choose a reason for hiding this comment

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

In my testing, this step was unnecessary -- if windowConfig.url was an empty array, the new window still opened as expected.

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.

2 participants