Open tab with file:// prefix

YF yfdyh000 at gmail.com
Mon Oct 23 23:24:34 UTC 2017


https://bugzilla.mozilla.org/show_bug.cgi?id=1266960
https://discourse.mozilla.org/t/opening-links-to-local-files-file/16449/6

Avi Steiner <asteiner at varonis.com>于2017年10月23日周一 下午10:00写道:

>
>
> 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" });
>
> or
>
> browser.tabs.create({ url: "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
>
>
>
> 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.
> _______________________________________________
> Dev-addons mailing list
> Dev-addons at mozilla.org
> https://mail.mozilla.org/listinfo/dev-addons
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/dev-addons/attachments/20171023/8778b6f2/attachment.html>


More information about the Dev-addons mailing list