-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Object.prototype an Immutable Prototype Exotic Object #308
Conversation
|
||
<emu-clause id="sec-immutable-prototype-exotic-objects"> | ||
<h1>Immutable Prototype Exotic Objects</h1> | ||
<p>An <em>immutable prototype object</em> is an exotic object that disallows mutation of its prototype.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a dfn not an em.
Throughout the document you are inconsistent as to whether it's "immutable prototype exotic object" or "immutable prototype object" or "exotic immutable prototype object".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be fixed in the latest draft.
This patch builds a mechanism to fix the Proxy security issue documented in bug tc39#272 by locking down the prototype chain of the global object, as Firefox has experimented with. Although the global object is provided by the embedding environment, many embedding environments will include Object in the prototype chain; preventing modification of Object.prototype addresses the issue by making it impossible to insert a Proxy in that part of the prototype chain of the global object. Embedding environments that want to prohibit a Proxy from being in the proto chain of their global object can make their global object and associated proto chain Immutable Prototype exotic objects.
7110adb
to
79c88d8
Compare
<p>When the [[SetPrototypeOf]] internal method of a immutable prototype exotic object _O_ is called with argument _V_ the following steps are taken:</p> | ||
<emu-alg> | ||
1. Assert: Either Type(_V_) is Object or Type(_V_) is Null. | ||
1. Return *false*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the following steps should be added before that one:
1. Let _current_ be the value of the [[Prototype]] internal slot of _O_.
1. If SameValue(_V_, _current_), return *true*.
Rationale: it is the behaviour, for ordinary objects, even when they are frozen (9.1.2, steps 3-4).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this. Unless I hear objections in the next few minutes I will spec it!
By the way, I don't mean for this PR to be granted any time soon--the intention is just to open discussion around something more concrete. |
I think we had consensus on this change at the recent TC39 meeting. Merge? |
@littledan it'll need rebasing, it's got conflicts |
Rebase please. |
@@ -22734,7 +22748,7 @@ | |||
<!-- es6num="19.1.3" --> | |||
<emu-clause id="sec-properties-of-the-object-prototype-object"> | |||
<h1>Properties of the Object Prototype Object</h1> | |||
<p>The Object prototype object is the intrinsic object %ObjectPrototype%. The Object prototype object is an ordinary object.</p> | |||
<p>The Object prototype object is the intrinsic object %ObjectPrototype%. The Object prototype object is an <a href="#sec-immutable-prototype-exotic-objects">immutable prototype exotic object</a>.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need the manual xref here (dfn autolinking will take care of it).
Will address the outstanding comments, rebase, and merge. |
Object.prototype is the immutable prototype exotic object Ref tc39/ecma262#308
Object.prototype is extensible and an immutable prototype exotic object, it's [[Prototype]] value is null Ref tc39/ecma262#308
This patch builds a mechanism to fix the Proxy security issue documented
in bug #272 by locking down the prototype chain of the global object, as
Firefox has experimented with. Although the global object is provided by
the embedding environment, many embedding environments will include Object
in the prototype chain; preventing modification of Object.prototype
addresses the issue by making it impossible to insert a Proxy in that part
of the prototype chain of the global object. Embedding environments that
want to prohibit a Proxy from being in the proto chain of their global
object can make their global object and associated proto chain Immutable
Prototype exotic objects.