Open tab with file:// prefix

Hello / Sector One hellosct1 at gmail.com
Mon Oct 23 16:47:52 UTC 2017


hi,



Regarding the porting of Chrome to Firefox, there is this tutorial

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Porting_a_Google_Chrome_extension

Concerning your problem, to create new tab, you have to use

function openMyPage() {
   browser.tabs.create({
     url: "file://///server///folder"
   });
}

browser.browserAction.onClicked.addListener(openMyPage);


you have an example with "open-my-page-button" in
https://github.com/mdn/webextensions-examples

best regard

Chrsitophe






2017-10-22 16:28 GMT+02:00 Avi Steiner <asteiner at varonis.com>:

> 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
>
>


-- 

Christophe Villeneuve (aka Hello)
--------------------------------------------------------
* Mes derniers livres :"Drupal avancé" aux Editions Eyrolles //
"Construisez votre application : PHP & MySQL - MySQLi - PDO" aux Editions
ENI
* Membre : PHP (AFUP) - MariaDB (LeMug) - Drupal - MozillaReps - Libre at toi
* Rédacteur pour Programmez, Linux pratique, ...
* blog : http://blog.hello-design.fr
* Consultant/Integrateur : http://www.hello-design.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/dev-addons/attachments/20171023/6e9d8435/attachment-0001.html>


More information about the Dev-addons mailing list