Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
FPIIM-449
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/test/mjsunit/es6/object-tostring.js b/test/mjsunit/es6/object-tostring.js
index 26dff14..4d6090f 100644
--- a/test/mjsunit/es6/object-tostring.js
+++ b/test/mjsunit/es6/object-tostring.js
@@ -1,8 +1,8 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
+// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-tostring
+// Flags: --harmony-tostring --harmony-proxies
var global = this;
@@ -33,7 +33,7 @@
// Using builtin toStringTags
var obj = {};
obj[Symbol.toStringTag] = className;
- assertEquals("[object ~" + className + "]",
+ assertEquals("[object " + className + "]",
Object.prototype.toString.call(obj));
// Getter throws
@@ -41,7 +41,7 @@
Object.defineProperty(obj, Symbol.toStringTag, {
get: function() { throw className; }
});
- assertThrows(function() {
+ assertThrowsEquals(function() {
Object.prototype.toString.call(obj);
}, className);
@@ -50,7 +50,7 @@
Object.defineProperty(obj, Symbol.toStringTag, {
get: function() { return className; }
});
- assertEquals("[object ~" + className + "]",
+ assertEquals("[object " + className + "]",
Object.prototype.toString.call(obj));
// Custom, non-builtin toStringTags
@@ -99,14 +99,14 @@
function testToStringTagNonString(value) {
var obj = {};
obj[Symbol.toStringTag] = value;
- assertEquals("[object ???]", Object.prototype.toString.call(obj));
+ assertEquals("[object Object]", Object.prototype.toString.call(obj));
// With getter
obj = {};
Object.defineProperty(obj, Symbol.toStringTag, {
get: function() { return value; }
});
- assertEquals("[object ???]", Object.prototype.toString.call(obj));
+ assertEquals("[object Object]", Object.prototype.toString.call(obj));
}
[
@@ -131,3 +131,31 @@
assertTrue(desc.configurable);
}
testObjectToStringPropertyDesc();
+
+function testObjectToStringOwnNonStringValue() {
+ var obj = Object.defineProperty({}, Symbol.toStringTag, { value: 1 });
+ assertEquals("[object Object]", ({}).toString.call(obj));
+}
+testObjectToStringOwnNonStringValue();
+
+
+// Proxies
+
+function assertTag(tag, obj) {
+ assertEquals("[object " + tag + "]", Object.prototype.toString.call(obj));
+}
+
+assertTag("Object", new Proxy({}, {}));
+assertTag("Array", new Proxy([], {}));
+assertTag("Function", new Proxy(() => 42, {}));
+assertTag("Foo", new Proxy(() => 42, {get() {return "Foo"}}));
+assertTag("Function", new Proxy(() => 42, {get() {return 666}}));
+
+revocable = Proxy.revocable([], {});
+revocable.revoke();
+assertThrows(() => Object.prototype.toString.call(revocable.proxy), TypeError);
+
+handler = {};
+revocable = Proxy.revocable([], handler);
+handler.get = () => revocable.revoke();
+assertThrows(() => Object.prototype.toString.call(revocable.proxy), TypeError);