JSOPTION_ANONFUNFIX should be set in js shell

RESOLVED FIXED in mozilla2.0

Status

()

RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: brendan, Assigned: brendan)

Tracking

Other Branch
mozilla2.0
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 attachment)

(Assignee)

Description

8 years ago
This option makes eval("function(){}") an error, per ECMA-262. The eval is just for example, another example would be (in HTML):

<script>function(){};</script>

An anonymous function expression as the whole expression in an expression statement was allowed in the ancient days, in particular for the eval use-case, and people came to count on it. Other browsers even cloned this extension.

We dropped support by enabling JSOPTION_ANONFUNFIX with bug 377433.

Setting this in the shell will require testsuite and fuzzer adjustments.

/be
(Assignee)

Comment 1

8 years ago
Not taking assignment but I'll help if someone cc'ed can -- anyone?

/be

Comment 2

8 years ago
jsfunfuzz currently calls 'options("anonfunfix");' whenever it detects that it's in a Spidermonkey shell.  Depending on the fix here, this might need to be changed.
(Assignee)

Updated

8 years ago
Assignee: general → brendan
Status: NEW → ASSIGNED
(Assignee)

Comment 3

8 years ago
Created attachment 481231 [details] [diff] [review]
fix (mostly trace-tests)

Need someone with fresh eyes to plug-n-chug per the ASI rules.

/be
Attachment #481231 - Flags: review?(cdleary)
Comment on attachment 481231 [details] [diff] [review]
fix (mostly trace-tests)

Looks like the only interesting one is that last PIC test. (Which has \r\n line endings, blech!)

-s = [function() function() function() function() function() function() {}]
-[function() function() function() function() {}]
-function() { [function() function() {}] }
-function() {}
+s = [function() function() function() function() function() function() {}];
+[function() function() function() function() {}];
+(function() { [function() function() {}] });
+(function() {});

That one is actually different by ASI rules, since the second brackety deal will index into the first in the original, producing s as a result. ASI would occur before the third and fourth lines in the original.
Attachment #481231 - Flags: review?(cdleary) → review+
(Assignee)

Comment 5

8 years ago
http://hg.mozilla.org/tracemonkey/rev/d5eb3c44d131

/be
Whiteboard: fixed-in-tracemonkey
(Assignee)

Comment 6

8 years ago
http://hg.mozilla.org/mozilla-central/rev/d5eb3c44d131

/be
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED

Updated

8 years ago
Duplicate of this bug: 532233
You need to log in before you can comment on or make changes to this bug.