Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: src/v8natives.js

Issue 103853006: ES6: Tighten up Object.prototype.__proto__ (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: __proto__ setter should return undefined Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/proto-accessor.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 24b0c51c19f6b2c43a025e09003d9174ef6cb0fd..34f5d903a14d262d33cb1d48fe555e5d36e1938c 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1384,15 +1384,19 @@ function ObjectIs(obj1, obj2) {
}
-// Harmony __proto__ getter.
+// ECMA-262, Edition 6, section B.2.2.1.1
function ObjectGetProto() {
- return %GetPrototype(this);
+ return %GetPrototype(ToObject(this));
}
-// Harmony __proto__ setter.
-function ObjectSetProto(obj) {
- return %SetPrototype(this, obj);
+// ECMA-262, Edition 6, section B.2.2.1.2
+function ObjectSetProto(proto) {
+ CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__");
+
+ if (IS_SPEC_OBJECT(proto) || IS_NULL(proto) && IS_SPEC_OBJECT(this)) {
+ %SetPrototype(this, proto);
+ }
}
« no previous file with comments | « no previous file | test/mjsunit/proto-accessor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698