Bug 165227 - Introduce the concept of Immutable Prototype Exotic Objects to comply with the spec.
Summary: Introduce the concept of Immutable Prototype Exotic Objects to comply with th...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-11-30 16:14 PST by Mark Lam
Modified: 2016-12-06 14:44 PST (History)
14 users (show)

See Also:


Attachments
proposed patch. (49.43 KB, patch)
2016-12-05 20:01 PST, Mark Lam
saam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Mark Lam 2016-11-30 16:16:27 PST
<rdar://problem/29442665>
Comment 2 Mark Lam 2016-12-05 12:29:58 PST
Spec excerpts of relevance:

https://tc39.github.io/ecma262/#sec-properties-of-the-object-prototype-object
"The Object prototype object is an immutable prototype exotic object."

https://html.spec.whatwg.org/#the-windowproxy-exotic-object
https://html.spec.whatwg.org/#windowproxy-setprototypeof
https://html.spec.whatwg.org/#the-location-interface
https://html.spec.whatwg.org/#location-setprototypeof
- Based on these WindowProxy and Location both have their [[SetPrototypeOf]] functions unconditionally return false.  This differs from the immutable prototype exotic object which allows [[SetPrototypeOf]] to return true if the set value is the same as the existing prototype value.
Comment 3 Mark Lam 2016-12-05 20:01:06 PST
Created attachment 296251 [details]
proposed patch.
Comment 4 Saam Barati 2016-12-06 14:37:41 PST
Comment on attachment 296251 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=296251&action=review

r=me

> LayoutTests/js/script-tests/prototype-assignment.js:36
> +    let userAgent = navigator.userAgent;
> +    if (userAgent.match(/ Chrome\/[0-9]+/)) engine = "chrome";
> +    else if (userAgent.match(/ Firefox\/[0-9]+/)) engine = "default";
> +    else engine = "safari";

What's the point of this? Don't we already know the answer?
Comment 5 Mark Lam 2016-12-06 14:39:43 PST
Comment on attachment 296251 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=296251&action=review

>> LayoutTests/js/script-tests/prototype-assignment.js:36
>> +    else engine = "safari";
> 
> What's the point of this? Don't we already know the answer?

This is so I can run this test on Chrome and Firefox to compare results.  The test configures the error messages to check below based on the browser it is running on.
Comment 6 Mark Lam 2016-12-06 14:44:20 PST
Thanks for the review.  Landed in r209424: <http://trac.webkit.org/r209424>.