[Webkit-unassigned] [Bug 161111] New: toString called on proxies returns incorrect tag

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 23 15:40:50 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=161111

            Bug ID: 161111
           Summary: toString called on proxies returns incorrect tag
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Macintosh
                OS: OS X 10.11
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: shvaikalesh at gmail.com

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]
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160823/112e14f5/attachment-0001.html>


More information about the webkit-unassigned mailing list