Closed
Bug 1337564
Opened 9 years ago
Closed 6 years ago
{ "__proto__": null } in an eval'ed string fails to create an object without prototype in some situations
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla71
Tracking | Status | |
---|---|---|
firefox71 | --- | fixed |
People
(Reporter: claude.pache, Assigned: evilpies)
References
Details
(Keywords: triage-deferred)
Attachments
(2 files)
3.16 KB,
patch
|
Details | Diff | Splinter Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
Testcase
var x = eval(' ({ "__proto__" : null })');
Object.getPrototypeOf(x) === null; // true
({}).hasOwnProperty.call(x, '__proto__'); // false
var y = eval('({ "__proto__" : null })');
Object.getPrototypeOf(y) === Object.prototype; // true
({}).hasOwnProperty.call(y, '__proto__'); // true
This is a interesting side-effect of Bug 578216.
Comment 1•9 years ago
|
||
And a related parser issue:
---
js> eval('({ "__proto__" : null, "__proto__" : null })');
({__proto__:null})
js> eval(' ({ "__proto__" : null, "__proto__" : null })');
typein:1:25 SyntaxError: property name __proto__ appears more than once in object literal:
typein:1:25 ({ "__proto__" : null, "__proto__" : null })
typein:1:25 .........................^
Stack:
@typein:2:1
---
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 2•9 years ago
|
||
Huhu what a curious bug! I wonder if there are any other differences lurking somewhere. We need to test the performance objects with a lot of properties before landing this.
Updated•8 years ago
|
Keywords: triage-deferred
Priority: -- → P3
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → evilpies
Assignee | ||
Comment 3•6 years ago
|
||
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f64d18fe9b93
Don't use JSON behavior for __proto__ with eval. r=jwalden
Comment 5•6 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox71:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
You need to log in
before you can comment on or make changes to this bug.
Description
•