Open tab with file:// prefix

Avi Steiner asteiner at varonis.com
Mon Oct 23 14:00:10 UTC 2017


Hello
I have an extension that was written as XUL/XPCOM.
As you may know, the extension will be unavailable since next Firefox version (November 2017).
I have the same extension for Chrome which is working. I tried to rename the Chrome extension from *.crx to *.xpi and installed in my Firefox browser.
I also tried to create my new xpi extension.

The extension is running but fails to do what it should do:
Open a new tab with a URL with file:\\ URI scheme.

chrome.tabs.create({ url: "file://///server///folder<file://server/folder>" });
or
browser.tabs.create({ url: "file://///server///folder<file://server/folder>" });

This statement is called within a background script.
It fails with the following error:

Unchecked lastError value: Error: Illegal URL: file://///server///folder<file://server/folder>

This statement works as expected in Chrome browser.

>From documentation of tabs.create():

For security reasons, in Firefox, this may not be a privileged URL. So passing any of the following URLs will fail:
chrome: URLs
javascript: URLs
data: URLs
file: URLs (i.e., files on the filesystem. However, to use a file packaged inside the extension, see below)
privileged about: URLs (for example, about:config, about:addons, about:debugging). Non-privileged URLs (e.g., about:blank) are allowed.
The New Tab page (about:newtab) can be opened if no value for URL is provided.

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/create

Is there any way for work around?


________________________________
This email and any attachments thereto may contain private, confidential, and privileged material for the sole use of the intended recipient. Any review, copying, or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/dev-addons/attachments/20171023/de483f67/attachment.html>


More information about the Dev-addons mailing list