WebExtensions: chrome.tabs.create fails if url is about:newtab

RESOLVED WONTFIX

Status

WebExtensions
Untriaged
RESOLVED WONTFIX
2 years ago
a month ago

People

(Reporter: dw-dev, Unassigned)

Tracking

46 Branch

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0
Build ID: 20160502172042

Steps to reproduce:

I executed the following code:

chrome.tabs.create({ windowId: win.id, url: "about:newtab" },
function(newtab)
{
    ........
});

This code fails and a new tab is not created.

Accordinging to the chrome.tabs.create documentation "about:newtab" is allowed:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/Tabs/create

This issue is not listed in the Chrome incompatibilities page:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities


Actual results:

A new tab is not created. An error message is displayed in the console:
Unchecked lastError value: Error: URL not allowed: about:newtab



Expected results:

A new tab should be created and loaded with "about:newtab".

Updated

2 years ago
Component: Untriaged → WebExtensions
Product: Firefox → Toolkit
This is intentional. If you want to load the new tab page, just don't pass a URL.

Updated

2 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WONTFIX
(Reporter)

Comment 2

2 years ago
Okay, but arguably an incompatibility with Chrome, since passing "chrome//:newtab" works in Chrome.

The documentation needs clarifying.  It says "Defaults to the New Tab Page.", but goes on to say "Non-privileged URLs (about:home, about:newtab, about:blank) are allowed." - which implies that passing "about:newtab" should work. The default for something does not normally mean that the something is not allowed.
I don't see how it's an incompatibility, except to the extent that we don't support chrome://newtab, and don't plan to.

I'll update the documentation.
(Reporter)

Comment 4

2 years ago
My understanding is that the intention is for Firefox and Chrome add-ons to use the same set of APIs.

I can understand that the URL for the New Tab Page is different in different browsers.  However, it seems logical to me that if you can specify Chrome's New Tab Page URL as a parameter to chrome.tabs.create in Chrome, then you should be able to to specify Firefox's New Tab Page URL as a parameter to chrome.tabs.create in Firefox.

Not allowing this behaviour seems an unnecessary incompatibility.
I don't see how it's in any way an incompatibility, given that the URLs for the new tab page are different in both browsers, and calling tabs.create without a URL opens the new tab page in both.

As for whether it's unnecessary, it's not. The "about:newtab" URL is an implementation detail, which isn't exposed to users. It may change (and is in fact likely to change), and it's not the correct new tab URL in all cases (private browsing windows being the most common example).
(Reporter)

Comment 6

2 years ago
Okay. I suspected that there was an implementation constraint. Thanks for the clarifiucation.

Comment 7

a year ago
> This is intentional. If you want to load the new tab page, just don't pass a URL.

This no longer works; opening with no URL loads the extension's generated background page in FF52. In fact, AFAICT, there's currently no way to open the new tab page from an extension.

We're trying to convert the Vimium extension to support Firefox, and "about:newtab" would be an ideal cross-browser solution, since Chrome supports it too.

Comment 8

10 months ago
I tried Vimium as a replacement for the obsolescent VimFX and I also noticed that opening a new tab does not work in Vimium. Firefox 55.0.3

Updated

9 months ago
Duplicate of this bug: 1412498

Updated

9 months ago
Duplicate of this bug: 1412498

Comment 11

6 months ago
Also see bug 1420405.

Updated

a month ago
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.