Bug 109427

Summary: Web Inspector: stack trace is cut at native bind if inspector is closed
Product: WebKit Reporter: Yury Semikhatsky <yurys>
Component: Web Inspector (Deprecated)Assignee: Yury Semikhatsky <yurys>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, apavlov, buildbot, haraken, japhet, keishi, loislo, mkwst, mkwst+watchlist, pfeldman, pmuellr, rniwa, vsevik, web-inspector-bugs, webkit.review.bot, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Sample page
none
Patch pfeldman: review+, buildbot: commit-queue-

Description Yury Semikhatsky 2013-02-11 06:52:46 PST
If inspector front-end is closed when uncaught exception is thrown, stack trace will be trimmed at the top bound function. In the attached page top function will be 'b' while there should be 'baz' and 'throwUndefined' above it.
Comment 1 Yury Semikhatsky 2013-02-11 06:58:13 PST
Created attachment 187563 [details]
Patch
Comment 2 Yury Semikhatsky 2013-02-11 07:02:34 PST
There use to be no stack traces if inspector front-end was closed when uncaught exception was thrown. That behavior changed after refactoring of the mechanism how console collects stack traces. Uncaught exception should be rare as they are errors in the applications. I think we it would be a reasonable tradeoff to sacrifice performance for better diagnostic in those cases.
Comment 3 Pavel Feldman 2013-02-11 07:27:56 PST
Why did this work before? This will make js engine run way more code than it used to upon exceptions. It sounds like you are avoiding the problem instead of fixing the regression.
Comment 4 Yury Semikhatsky 2013-02-11 07:32:56 PST
Created attachment 187569 [details]
Sample page
Comment 5 Pavel Feldman 2013-02-11 07:35:30 PST
Comment on attachment 187563 [details]
Patch

I am sorry, but neither from the bug thread nor from the changelog it is clear what the problem is and why this is the right solution to it.
Comment 6 Yury Semikhatsky 2013-02-11 07:37:54 PST
(In reply to comment #3)
> Why did this work before?
It didn't. We used to collect only top stack frame when there was no front-end. After Mike's refactorings the behavior changed and we started to collect stack trace even with closed front-end but since the place where the stack is collected moved the stack collected while front-end is closed will be trimmed in some cases like in the example with native bind.

> This will make js engine run way more code than it used to upon exceptions. It sounds like you are avoiding the problem instead of fixing the regression.

This is a case of uncaught exception which was thrown and not handled by any try catch or global onerror handler so I would assume it to be uncommon one.
Comment 7 Yury Semikhatsky 2013-02-11 08:21:05 PST
Created attachment 187577 [details]
Patch
Comment 8 Build Bot 2013-02-11 11:33:29 PST
Comment on attachment 187577 [details]
Patch

Attachment 187577 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/16495302

New failing tests:
http/tests/inspector-enabled/console-exception-while-no-inspector.html
Comment 9 Yury Semikhatsky 2013-02-12 01:22:31 PST
Committed r142594: <http://trac.webkit.org/changeset/142594>