Revision: 19666
Author:   [email protected]
Date:     Wed Mar  5 08:58:38 2014 UTC
Log:      Fix issue with setting __proto__ on a value

LOG=N
BUG=v8:3172
[email protected]

Review URL: https://codereview.chromium.org/174113003

Patch from Erik Arvidsson <[email protected]>.
http://code.google.com/p/v8/source/detail?r=19666

Modified:
 /branches/bleeding_edge/src/v8natives.js
 /branches/bleeding_edge/test/mjsunit/proto-accessor.js

=======================================
--- /branches/bleeding_edge/src/v8natives.js    Wed Feb 19 11:59:05 2014 UTC
+++ /branches/bleeding_edge/src/v8natives.js    Wed Mar  5 08:58:38 2014 UTC
@@ -1394,7 +1394,7 @@
 function ObjectSetProto(proto) {
   CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__");

-  if (IS_SPEC_OBJECT(proto) || IS_NULL(proto) && IS_SPEC_OBJECT(this)) {
+  if ((IS_SPEC_OBJECT(proto) || IS_NULL(proto)) && IS_SPEC_OBJECT(this)) {
     %SetPrototype(this, proto);
   }
 }
=======================================
--- /branches/bleeding_edge/test/mjsunit/proto-accessor.js Fri Feb 28 14:26:32 2014 UTC +++ /branches/bleeding_edge/test/mjsunit/proto-accessor.js Wed Mar 5 08:58:38 2014 UTC
@@ -102,12 +102,13 @@


 function TestSetProtoOfValues() {
+  var proto = {};
   for (var i = 0; i < values.length; i++) {
-    assertEquals(setProto.call(values[i], i), undefined);
+    assertEquals(setProto.call(values[i], proto), undefined);
   }

-  assertThrows(function() { setProto.call(null, 7); }, TypeError);
-  assertThrows(function() { setProto.call(undefined, 8); }, TypeError);
+  assertThrows(function() { setProto.call(null, proto); }, TypeError);
+  assertThrows(function() { setProto.call(undefined, proto); }, TypeError);
 }
 TestSetProtoOfValues();

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to