Bug 141610

Summary: For many X, X.prototype is an X when it must be a plain object
Product: WebKit Reporter: Mark S. Miller <erights>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: andy, ashvayka, erights, ggaren, joepeck, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: 420+   
Hardware: All   
OS: All   
Bug Depends on: 152574    
Bug Blocks:    

Description Mark S. Miller 2015-02-14 12:25:33 PST
For example, ES6 specifies that Number.prototype should be a plain object, but it is currently an exotic Number object. 

This is especially problematic for Date, as it opens a potential global communications channel that can only be plugged expensively. See https://code.google.com/p/google-caja/issues/detail?id=1362
Comment 1 Radar WebKit Bug Importer 2015-02-16 15:04:34 PST
<rdar://problem/19852587>
Comment 2 Andy VanWagoner 2015-12-26 18:59:44 PST
These are the prototypes I identified that should be plain objects, but are currently instances of their type:

- Boolean
- Date
- Error
- Number
- RegExp
- String

Are there any others?
Comment 3 Mark S. Miller 2015-12-26 19:23:39 PST
IIRC, according to more recent tc39 decisions, Boolean, Number, and String are no longer included. They join Function and Array. This leaves Date, Error, and RegExp. Error doesn't really matter. Date and RegExp are important, in order to plug a global communications channel.
Comment 4 Andy VanWagoner 2015-12-27 10:07:11 PST
Ok. My first naive pass at making this change resulted in breaking everything. (> 1000 tests) :) I'll see if reverting Boolean, Number, and String make it more manageable.
Comment 5 Alexey Shvayka 2020-09-09 16:18:46 PDT
(In reply to Mark S. Miller from comment #3)
> IIRC, according to more recent tc39 decisions, Boolean, Number, and String
> are no longer included. They join Function and Array. This leaves Date,
> Error, and RegExp. Error doesn't really matter. Date and RegExp are
> important, in order to plug a global communications channel.

Thank you for filing this and the follow-up!

r194636 fixed Date.prototype.
r198469 fixed Error.prototype.
r198447 fixed RegExp.prototype.

test262 coverage is being added in https://github.com/tc39/test262/pull/2760.