Revert "Convert `obj` ToObject in Object.keys()"
authordslomov@chromium.org <dslomov@chromium.org>
Mon, 29 Sep 2014 07:30:41 +0000 (07:30 +0000)
committerdslomov@chromium.org <dslomov@chromium.org>
Mon, 29 Sep 2014 07:30:41 +0000 (07:30 +0000)
This reverts commit r24260 for breaking test262 tests.

TBR=arv@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24264 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

AUTHORS
src/v8natives.js
test/mjsunit/third_party/object-keys.js

diff --git a/AUTHORS b/AUTHORS
index 9fdab44764cfc6278861541fc9b3131bc92fd2fd..f18761e4baef15a3cee1c574c6dd5a3ae5e1ad3b 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -24,7 +24,6 @@ Andreas Anyuru <andreas.anyuru@gmail.com>
 Baptiste Afsa <baptiste.afsa@arm.com>
 Bert Belder <bertbelder@gmail.com>
 Burcu Dogan <burcujdogan@gmail.com>
-Caitlin Potter <caitpotter88@gmail.com>
 Craig Schlenter <craig.schlenter@gmail.com>
 Chunyang Dai <chunyang.dai@intel.com>
 Daniel Andersson <kodandersson@gmail.com>
index bc6a375d7513050c004de62ba3fd9f91a7fd00ba..782b953ea9763edf0dadbc32511d32a6deef0463 100644 (file)
@@ -325,7 +325,9 @@ function ObjectLookupSetter(name) {
 
 
 function ObjectKeys(obj) {
-  obj = ToObject(obj);
+  if (!IS_SPEC_OBJECT(obj)) {
+    throw MakeTypeError("called_on_non_object", ["Object.keys"]);
+  }
   if (%IsJSProxy(obj)) {
     var handler = %GetHandler(obj);
     var names = CallTrap0(handler, "keys", DerivedKeysTrap);
index c8003745c4b1c5ccfb4b2b04e0f9eca72594f3f7..d09265c6f738a3729bd8b75ad80a1b304408e6c9 100644 (file)
@@ -31,8 +31,8 @@
 
 // Based on LayoutTests/fast/js/Object-keys.html
 
-assertEquals(Object.keys(2), []);
-assertEquals(Object.keys("foo"), ["0", "1", "2"]);
+assertThrows(function () { Object.keys(2) }, TypeError);
+assertThrows(function () { Object.keys("foo") }, TypeError);
 assertThrows(function () { Object.keys(null) }, TypeError);
 assertThrows(function () { Object.keys(undefined) }, TypeError);