Closed
Bug 893193
Opened 11 years ago
Closed 10 years ago
Strict Errors in SDK by default
Categories
(Add-on SDK Graveyard :: General, defect, P2)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: choudhary.abhishek12, Unassigned)
References
Details
User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36
Steps to reproduce:
The code I use is at https://github.com/abhishekchoudhary/fx-statistics -- and use the cfx tool from the Jetpack SDK to test the code.
Actual results:
There are multiple strict warnings, even when there are no instances of explicitly invoking the strict environment in the code. There are reports of errors like "function does not always return a value", and "test for equality (==) mistyped as assignment (=)" errors, which are reported as TypeErrors and SyntaxErrors respectively.
Also, the errors are shown when I use 'cfx run', but when I make a test build using 'cfx xpi', the errors disappear, but there is still no output from the code.
Expected results:
The D3 library should work the way it does everywhere else, and there should be a circle on a blue background in a new tab on the browser.
Updated•11 years ago
|
Component: Untriaged → General
Product: Firefox → Add-on SDK
Version: 22 Branch → unspecified
Jordan, can you take a look at this and see what's going on?
Flags: needinfo?(jsantell)
Reporter | ||
Comment 2•11 years ago
|
||
The repository code has changed.
The code referenced here is: https://github.com/abhishekchoudhary/fx-statistics/tree/b5c1ac72aecb4c1b1e13e975b62dbb7c508a46fe
I think it was down to the code scope. JS content inside / referenced by html is subjected to the 'strict' environment. But I did manage to get the library running by embedding it via contentScriptFile.
Comment 3•11 years ago
|
||
Abhishek, looks like you're correct -- seems that JS loaded in the HTML content pages are running in strict mode by default. Checking out the latest repo, looks like a pretty cool addon!
Also of note, I got a dependency error when running it because 'about' was in a dependency, but it's a file in ./lib -- if you want to use it as a dependency, Erik Vold moved it to his Pathfinder module: https://github.com/erikvold/addon-pathfinder/blob/master/lib/scheme/about.js
Otherwise, removing it from the dependency worked fine for me!
Irakli, do you know if this is intentional? Should all JS in content pages be running in strict mode?
Flags: needinfo?(jsantell) → needinfo?(rFobic)
Comment 4•11 years ago
|
||
Nope it's not intentional & I have no idea how did it end up that way :( It could be inheriting mode from the web page it's attached to though...
Flags: needinfo?(rFobic)
Jordan, any chance you can look into this?
Assignee: nobody → jsantell
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Comment 6•10 years ago
|
||
Unassigning myself from bugs I haven't gotten around to
Assignee: jsantell → nobody
Comment 7•10 years ago
|
||
Sorry we won't be releasing any new versions of cfx, jpm is the replacement https://www.npmjs.com/package/jpm
You need to log in
before you can comment on or make changes to this bug.
Description
•