summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/prototype/toString/symbol-tag-non-str-proxy-function.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/prototype/toString/symbol-tag-non-str-proxy-function.js')
-rw-r--r--js/src/tests/test262/built-ins/Object/prototype/toString/symbol-tag-non-str-proxy-function.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/prototype/toString/symbol-tag-non-str-proxy-function.js b/js/src/tests/test262/built-ins/Object/prototype/toString/symbol-tag-non-str-proxy-function.js
new file mode 100644
index 0000000000..9ede801177
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/prototype/toString/symbol-tag-non-str-proxy-function.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-object.prototype.tostring
+description: >
+ Non-string values of `Symbol.toStringTag` property are ignored.
+info: |
+ ProxyCreate ( target, handler )
+
+ [...]
+ 7. If IsCallable(target) is true, then
+ a. Set P.[[Call]] as specified in 9.5.12.
+
+ Object.prototype.toString ( )
+
+ [...]
+ 7. Else if O has a [[Call]] internal method, let builtinTag be "Function".
+ [...]
+ 15. Let tag be ? Get(O, @@toStringTag).
+ 16. If Type(tag) is not String, set tag to builtinTag.
+ 17. Return the string-concatenation of "[object ", tag, and "]".
+features: [generators, async-functions, Proxy, Symbol.toStringTag]
+---*/
+
+var generatorProxy = new Proxy(function* () {}, {});
+var generatorProxyProxy = new Proxy(generatorProxy, {});
+delete generatorProxy.constructor.prototype[Symbol.toStringTag];
+
+assert.sameValue(
+ Object.prototype.toString.call(generatorProxy),
+ '[object Function]',
+ 'generator function proxy without Symbol.toStringTag'
+);
+assert.sameValue(
+ Object.prototype.toString.call(generatorProxyProxy),
+ '[object Function]',
+ 'proxy for generator function proxy without Symbol.toStringTag'
+);
+
+var asyncProxy = new Proxy(async function() {}, {});
+var asyncProxyProxy = new Proxy(asyncProxy, {});
+Object.defineProperty(asyncProxy.constructor.prototype, Symbol.toStringTag, {
+ value: undefined,
+});
+
+assert.sameValue(
+ Object.prototype.toString.call(asyncProxy),
+ '[object Function]',
+ 'async function proxy without Symbol.toStringTag'
+);
+assert.sameValue(
+ Object.prototype.toString.call(asyncProxyProxy),
+ '[object Function]',
+ 'proxy for async function proxy without Symbol.toStringTag'
+);
+
+reportCompare(0, 0);