<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - toString called on proxies returns incorrect tag"
href="https://bugs.webkit.org/show_bug.cgi?id=161111">161111</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>toString called on proxies returns incorrect tag
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>OS X 10.11
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>shvaikalesh@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>When `Object.prototype.toString` is called on proxy objects with target that has no `@@toStringTag` defined,
it returns `ProxyObject` instead of correct tag:
```js
toString.call(new Proxy(new Map, {})) // [object Map], correct
toString.call(new Proxy(Math, {})) // [object Math], correct
toString.call(new Proxy({ [Symbol.toStringTag]: "Hello" }, {})) // [object Hello], correct
toString.call(new Proxy(new String, {})) // [object ProxyObject], incorrect
// should report [object Object], because proxy is not String exotic object
toString.call(new Proxy(/(?:)/, {})) // [object ProxyObject], incorrect
// should report [object Object], because proxy object does not have [[RegExpMatcher]]
toString.call(new Proxy([], {})) // [object ProxyObject], incorrect
// should report [object Array], because isArray when called on proxy, checks
// its target for arrayness (internal methods)
toString.call(new Proxy(() => {}, {})) // [object ProxyObject], incorrect
// should report [object Function], because toString checks for [[Call]] and
// Proxy constructor creates [[Call]] on proxy if it is present on target
toString.call(new Proxy({}, {})) // [object ProxyObject], incorrect
// should report [object Object]
```</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>