Bug 70605
Summary: | First stack frame when evaluating a script is missing | ||
---|---|---|---|
Product: | WebKit | Reporter: | Michael Schneider <michschn> |
Component: | WebCore JavaScript | Assignee: | Nobody <webkit-unassigned> |
Status: | UNCONFIRMED | ||
Severity: | Normal | ||
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://poshnet.ch/stack_test.html |
Michael Schneider
To reproduce
1) Open Safari on http://poshnet.ch/stack_test.html. It contains the script
function foo() {
console.trace();
}
console.trace();
foo();
2) Open the console
observe: the output is
console.trace()
(anonymous function)
console.trace()
foo
Note that the second trace is missing the bottom frame, the anonymous evaluate script. This is very confusing as it looks as if the browser invoked foo directly. Chrome shows the (anonymous function) stack frame in both cases.
This seems to be due to ScriptCallStackFactory.cpp:73
if (function)
functionName = asFunction(function)->name(exec);
else {
// Caller is unknown, but if frames is empty we should still add the frame, because
// something called us, and gave us arguments.
if (!frames.isEmpty())
break;
}
where anonymous frames (such as the script eval) are dropped if other stack frames are on top of it. What is the exact purpose of that "if"? If we can change that, ie. drop the else, I'm more than happy to provide a patch.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |