New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 677529 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

error in stacktrace API documentation

Reported by potoms....@gmail.com, Dec 29 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36

Steps to reproduce the problem:
execute:
Error.prepareStackTrace = function (error, structStackTrace) { return typeof structStackTrace[0].getEvalOrigin() }
eval('new Error().stack')

What is the expected behavior?
getEvalOrigin returns CallSite object according to https://github.com/v8/v8/wiki/Stack-Trace-API#customizing-stack-traces

What went wrong?
it returns a string

Did this work before? N/A 

Chrome version: 55.0.2883.95  Channel: stable
OS Version: OS X 10.12.2
Flash Version: Shockwave Flash 24.0 r0
 
Components: Blink>JavaScript>API
Labels: M-57 OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)
Able to reproduce this issue on Windows-10, Ubuntu 14.04 and Mac OS 10.12 using chrome latest stable M55-55.0.2883.95 by following steps mentioned in the original comment. 

This is a non-regression issue seen from past M35-35.0.1849.0, Hence marking it as untriaged.

Thanks! 
Cc: kozyatinskiy@chromium.org yangguo@chromium.org
Status: Available (was: Untriaged)
Project Member

Comment 3 by sheriffbot@chromium.org, Feb 15 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 4 by adamk@chromium.org, Feb 15 2018

Cc: jgruber@chromium.org
Labels: -OS-Linux -OS-Windows -Pri-2 -OS-Mac -M-57 Pri-3
Status: Available (was: Untriaged)
Cc: -jgruber@chromium.org
Owner: jgruber@chromium.org
Status: Fixed (was: Available)
Thanks for reporting, updated the wiki.
I'd say this is rather an error in the API than in the documentation, since it would be more useful to have the CallSite in a structured form than a string that has to be parsed. It also would allow for to be called recursively in the case of nested eval's
I'm not sure I understand what you want to achieve, do you have an extended code example?


With nested evals, information about the caller is in the next CallSite object. For example:

d8> eval("eval(\"throw new Error();\");")
Error
    at eval (eval at <anonymous> (eval at <anonymous> ((d8):1:1)), <anonymous>:1:7)
    at eval (eval at <anonymous> ((d8):1:1), <anonymous>:1:1)
    at (d8):1:1

structuredStackTrace[0] shows the top frame, structuredStackTrace[1] its caller.


But the eval origin doesn't necessarily have to be on the call stack:

d8> eval("g = function() { throw new Error(); }");
d8> g()
Error
    at g (eval at <anonymous> ((d8):1:1), <anonymous>:1:24)
    at (d8):1:1


CallSite objects are intended to give information about a function on the call stack.
Returning a String for the eval origin seems reasonable to me since the eval origin
may not be on the call stack.
No, that makes sense

Sign in to add a comment