Closed Bug 1647169 Opened 4 years ago Closed 4 years ago

Optional call of eval (e.g. `eval?.(code)`) should be indirect eval

Categories

(Core :: JavaScript Engine, defect)

77 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla79
Tracking Status
firefox79 --- verified

People

(Reporter: public, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36

Steps to reproduce:

var a = "global";
(a => eval?.("console.log(a)"))("local");

Actual results:

Printed local in console.

Expected results:

Prints global in console.

The direct eval is only step 6.a.vi in 12.3.6.1 Runtime Semantics: Evaluation.
But optional chaining is 12.3.9.2 Runtime Semantics: ChainEvaluation.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → JavaScript Engine
Product: Firefox → Core

Test case will be added through the next test262 sync:

Assignee: nobody → andrebargull
Pushed by ncsoregi@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/583323d35563 Optional call can't be a direct eval. r=yulia
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
QA Whiteboard: [qa-79b-p2]

Reproduced the issue using Firefox 79.0a1 (20200621093846) on Ubuntu 18.04.
The issue is verified with Firefox 79.0b9 (20200717001501) on Windows 10x64, macOS 10.12 and Ubuntu 18.04. global string is presented in the console after using:

var a = "global";
(a => eval?.("console.log(a)"))("local");
Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-79b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: