Cannot open File protocol links in Resource protocol page in Firefox 41

I've made a local file (log.html) in Firefox profile and tried to open it in an add-on page (add-on folder/data/log.html and it's shown as Resource protocol in URL bar).

self.port && self.port.on('add-log-path', function(payLoad) {
  addLogPath(payLoad);
});

function addLogPath(url) {
    // url == "file:///Users/usr/Library/Application Support/Firefox/Profiles/05rhodfg.cfxo/log.html"
    $('#logpath').attr('href', url);
}

I've also tried changing that to JS method window.open

function addLogPath(url) {
    $('#logpath').on("click", function() {
        window.open(url);
    });
}

But the error is

JavaScript error: , line 0: Error: Access to 'file:///Users/usr/Library/Application%20Support/Firefox/Profiles/05rhodfg.cfxo/log.html' from script denied

BTW, before Firefox version 41, it has no problem doing this. Can you suggest other workaround to solve this? Thank you!

edit: added add-on example to reproduce the problem

download and run the following statement in Terminal: $ cd fileProtocolExample && cfx run

Answers


Do self.data.url('filename_here') to get that path to your file.

It will look something like resource://your-extension-id/data/filename_here, then this should load fine. That resource:// in front is important, make sure you get and use that URL.

The file:// won't work, because your addon is packed in a zip. Its not extracted into the system. How did it work in Firefox 41? Was your addon unpacked at that time? This is an Addon-SDK addon right?


Need Your Help

Autofac – Scan and batch register generic types

c# generics inversion-of-control autofac

In my project I’ve got the following base class for all my repositories:

Custom Code and Parameters in SSRS

sql-server-2008 ssrs-2008 reporting-services

I am trying to use the custom code option to pull down the querystring and set the parameters for the report all in the custom code. So I may have a url such as: