Compile JSM/component scripts in strict mode by default

RESOLVED FIXED in Firefox 57

Status

()

RESOLVED FIXED
a year ago
a year ago

People

(Reporter: kmag, Assigned: kmag)

Tracking

(Depends on: 1 bug)

unspecified
mozilla57
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox57 fixed)

Details

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(2 attachments)

(Assignee)

Description

a year ago
Bug 1186409 is currently blocked on non-strict `this` boxing issues in some JSMs. At this point, we shouldn't be relying on non-strict-mode behavior, so it's probably time to just enforce strict mode on all JSM/component scripts.
(Assignee)

Updated

a year ago
See Also: → bug 807862
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
(Assignee)

Comment 3

a year ago
mozreview-review
Comment on attachment 8901988 [details]
Bug 1394556: Part 1 - Fix strict mode errors in JSM scripts.

https://reviewboard.mozilla.org/r/173402/#review178782

::: services/common/kinto-offline-client.js:21
(Diff revision 1)
>  
>  /*
>   * This file is generated from kinto.js - do not modify directly.
>   */
>  
> +const global = this;

This also needs to be fixed upstream. I'll file a separate PR for that.
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
(Assignee)

Updated

a year ago
Attachment #8901988 - Flags: review?(ehsan) → review?(dtownsend)
Attachment #8901989 - Flags: review?(ehsan) → review?(dtownsend)

Comment 6

a year ago
mozreview-review
Comment on attachment 8901988 [details]
Bug 1394556: Part 1 - Fix strict mode errors in JSM scripts.

https://reviewboard.mozilla.org/r/173402/#review179246

::: testing/specialpowers/content/SpecialPowersObserver.jsm:258
(Diff revision 2)
>        }
>        let createdFiles = this._createdFiles;
>        try {
>          let promises = [];
>          aMessage.data.forEach(function(request) {
> -          const filePerms = 0666; // eslint-disable-line no-octal
> +          const filePerms = 0o666; // eslint-disable-line no-octal

I think you can get rid of the eslint disable here now.
Attachment #8901988 - Flags: review?(dtownsend) → review+

Comment 7

a year ago
mozreview-review
Comment on attachment 8901989 [details]
Bug 1394556: Part 2 - Compile all JSM/module scripts in strict mode.

https://reviewboard.mozilla.org/r/173404/#review179252
Attachment #8901989 - Flags: review?(dtownsend) → review+
(Assignee)

Comment 9

a year ago
Jörg, there's a good chance this will affect Thunderbird. Look out for errors like "TypeError: this is null", "TypeError: setting a property that has only a getter", and "ReferenceError: assignment to undeclared variable"
Flags: needinfo?(jorgk)

Comment 10

a year ago
Thanks for the heads-up, I love changes to JS (not) ;-(
Flags: needinfo?(jorgk)

Comment 11

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/3a804c720f13
https://hg.mozilla.org/mozilla-central/rev/0ab0630eec0c
Status: NEW → RESOLVED
Last Resolved: a year ago
status-firefox57: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
(For further reference)
It is also possible to enforce strict-mode on the JSContext. We currently didn't do that. One way non-strict may sneak in is horrible stuff through Function(). The shared JSM global work still work in presence of non-strict code, but we should really avoid it to avoid potential problems.

Updated

a year ago
Depends on: 1396303
You need to log in before you can comment on or make changes to this bug.