Closed
Bug 640860
Opened 13 years ago
Closed 13 years ago
Validator: Incorrect "Global overwrite"
Categories
(addons.mozilla.org Graveyard :: Admin/Editor Tools, defect)
addons.mozilla.org Graveyard
Admin/Editor Tools
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: nmaier, Assigned: basta)
Details
The "Global overwrite" warning is sometimes incorrect, as it does not take the scope into account. Correct: - Actually overriding window/document in a window scope Incorrect: - Warning about a function-local variable: function initWindow(window) { let document = window.document; } Primary use cases would include js-modules (instead of overlay scripts) as well as bootstrap.js (restartless) add-ons.
Reporter | ||
Updated•13 years ago
|
Assignee: nobody → mbasta
Assignee | ||
Comment 1•13 years ago
|
||
That functionality is intended. The idea was to prevent the developer from masking global variables and functions in a particular scope. If I'm not mistaken, it was designed to prevent things like this: var Components = {interfaces: {"nsISomethingorother": /* ... */}}; The JS engine has come a long way, though, and it catches a hell of a lot more problems than it was originally planned to. I'll have to look into the original spec and do some research on what this was specifically intended to protect against, but I'm fairly certain that it can be removed safely.
Assignee | ||
Comment 2•13 years ago
|
||
Fixed: https://github.com/mattbasta/amo-validator/commit/5a4077f9a69ef89af53e15b7862ab764004cc09a This will be included in the next pull to mozilla/origin.
Assignee | ||
Comment 3•13 years ago
|
||
Done: https://github.com/mozilla/amo-validator/pull/6
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•8 years ago
|
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•