Status: New
Owner: ----

New issue 3718 by [email protected]: CallSite.getTypeName() throws TypeError in strict mode
https://code.google.com/p/v8/issues/detail?id=3718

In strict mode, calling CallSite.getTypeName() on a call site that doesn't have a receiver throws a TypeError as shown below. CallSiteGetTypeName should check that the receiver is non-null/undefined before accessing the 'constructor' property.

$ d8 --use_strict
V8 version 3.26.31.6 [console: dumb]

d8> // Use prepareStackTrace to obtain an array of CallSite objects.
d8> Error.prepareStackTrace = function(e, stackTrace) { return stackTrace; };
function (e, stackTrace) { return stackTrace; }
d8>
d8> // Construct the Error inside a function called without a receiver.
d8> function f() { return new Error().stack; }
d8> var stack = f();
d8>
d8> // Restore default stack-trace formatting so we can see the TypeError.
d8> delete Error.prepareStackTrace;
true
d8>
d8> stack[0].getTypeName()
(d8):1: TypeError: Cannot read property 'constructor' of undefined
stack[0].getTypeName()
         ^
TypeError: Cannot read property 'constructor' of undefined
    at CallSiteGetTypeName (native)
    at (d8):1:10

Without --use_strict, the type name is the string "[object global]". Shouldn't it just be the string "global" because that's the value of the global object's [[Class]]?

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to