can't attach stylesheet from file

RESOLVED INCOMPLETE

Status

Add-on SDK
General
RESOLVED INCOMPLETE
3 years ago
9 months ago

People

(Reporter: u539522, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
Build ID: 20150513174244

Steps to reproduce:

const tabs = require("sdk/tabs");
const Style = require("sdk/stylesheet/style").Style;
var style = Style({
  uri: filePref // got from simple-prefs ("type": "file")
  // example: "C:/someStyleSheet.css"
});
attach(style, tabs.activeTab);


Actual results:

console throws error: "...uri must be a local uri"


Expected results:

The stylesheet should have got attached.
You might need to have the file in your add-on's "data" directory.

See: https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs#Attaching_stylesheets
Flags: needinfo?(AMO.ilaita)
(Reporter)

Comment 2

3 years ago
(In reply to Aaron Raimist [:aaronraimist] from comment #1)
> You might need to have the file in your add-on's "data" directory.
> 
> See:
> https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/
> tabs#Attaching_stylesheets

why? is there no way to attach a stylesheet from example C:\path\to\file\stylesheet.css ?
Flags: needinfo?(AMO.ilaita)
See this for more detailed info: https://developer.mozilla.org/en-US/Add-ons/Code_snippets/File_I_O

I would assume you can't attach a file from anywhere on your hard drive because you can't expect everyone who downloads you add-on to have that same file in the same location.
(Reporter)

Comment 4

3 years ago
"because you can't expect everyone who downloads you add-on to have that same file in the same location."
- the user can choose the file via simple-prefs type file....
(Reporter)

Comment 6

3 years ago
Ok, but please look at this: https://bugzilla.mozilla.org/show_bug.cgi?id=1166509
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.