Closed
Bug 1396050
Opened 7 years ago
Closed 7 years ago
Support IndirectEval with NonSyntacticVariablesScope
Categories
(Core :: JavaScript Engine, enhancement, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
WONTFIX
Tracking | Status | |
---|---|---|
firefox57 | --- | fix-optional |
People
(Reporter: tcampbell, Assigned: tcampbell)
References
Details
(Whiteboard: [js:correctness])
Attachments
(2 obsolete files)
Follow-up to Bug 1394490.
If evaluating |(0,eval)("this")| with a NonSyntacticVariblesEnvironment on the chain, we get the global instead of the current lexical this (ie the NonSyntacticVariables itself).
This should be fixed by passing the correct environment to IndirectEval.
(Once this is fixed, the test in js/src/jsapi-tests/testExecuteInNonSyntacticGlobal should be updated)
Assignee | ||
Comment 1•7 years ago
|
||
This also applies to |new Function()|.
One difficulty is finding the environment in the callee context. To deal with this, I propose we move the |Function| and |eval| bindings from the global to the NSVO in these cases. We can then use FunctionExtended slots (or other mechanism) to keep track of the NSVO the binding came from. This would give predictable results similar to the non-shared case where the IndirectEval happens in the context that the binding was read from.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → tcampbell
Status: NEW → ASSIGNED
Comment hidden (mozreview-request) |
Assignee | ||
Comment 4•7 years ago
|
||
Comment on attachment 8907411 [details]
Bug 1396050 - Support IndirectEval per-JSMEnvironment
Here is a rough prototype for supporting IndirectEval per-JSMEnvironment/NSVO. Similar would be done for |new Function| constructor.
I'm wondering what parts of this worry you the most and if you have ideas of other mechanisms to achieve the same.
This could form a stop-gap until we are able to remove eval/new Function usage entirely from JSMs. So this will be a game of balancing risks of this change versus changing all the code/tests that use eval.
Attachment #8907411 -
Flags: feedback?(jorendorff)
Updated•7 years ago
|
Assignee | ||
Updated•7 years ago
|
Attachment #8907411 -
Flags: feedback?(jorendorff)
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 7•7 years ago
|
||
I put together this experiment and it seems to work but is hacky. Since Bug 1399997 is on track to unblock this, I'm closing this as WONTFIX and recommending we do Bug 1399997, and then eventually disable eval/Function altogether via CSP.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Assignee | ||
Updated•7 years ago
|
Attachment #8907411 -
Attachment is obsolete: true
Assignee | ||
Updated•7 years ago
|
Attachment #8908341 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•