Closed Bug 1275209 Opened 8 years ago Closed 8 years ago

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

Categories

(WebExtensions :: Untriaged, defect)

46 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: dw-dev, Unassigned)

References

Details

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".
Component: Untriaged → WebExtensions
Product: Firefox → Toolkit
This is intentional. If you want to load the new tab page, just don't pass a URL.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
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.
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).
Okay. I suspected that there was an implementation constraint. Thanks for the clarifiucation.
> 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.
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
Also see bug 1420405.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.