Bug 22556 - console.assert should include stack trace with line numbers.
Summary: console.assert should include stack trace with line numbers.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Yury Semikhatsky
URL:
Keywords:
Depends on: 21180
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-29 11:55 PST by Rib Rdb
Modified: 2010-08-27 16:13 PDT (History)
7 users (show)

See Also:


Attachments
Patch (6.85 KB, patch)
2010-07-20 06:06 PDT, Yury Semikhatsky
no flags Details | Formatted Diff | Diff
Patch (16.44 KB, patch)
2010-07-20 08:26 PDT, Yury Semikhatsky
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rib Rdb 2008-11-29 11:55:42 PST
console.assert currently shows the line which called assert. In firebug it also includes a stacktrace, which is very useful since often the error is higher in the stack trace. For example a unittest framework might have its own AssertEqual method that does it's own logging and then calls console.assert. The useful line is the one that called AssertEqual, not console.assert.
Comment 1 Yury Semikhatsky 2010-07-20 06:02:26 PDT
It's not resolved yet.
Comment 2 Yury Semikhatsky 2010-07-20 06:06:10 PDT
Created attachment 62062 [details]
Patch
Comment 3 Yury Semikhatsky 2010-07-20 08:26:16 PDT
Created attachment 62079 [details]
Patch
Comment 4 Pavel Feldman 2010-07-20 08:33:19 PDT
Comment on attachment 62079 [details]
Patch

WebCore/bindings/v8/ScriptCallStack.cpp:56
 +      if (stackTrace->GetFrameCount() <= 0) {
<=? Should it be == 0?

WebCore/bindings/v8/ScriptCallStack.cpp:59
 +          *sourceName = toWebCoreString(v8::Undefined());
"undefined"?

WebCore/bindings/v8/ScriptCallStack.cpp:61
 +          *functionName = toWebCoreString(v8::Undefined());
"undefined"?
Comment 5 Yury Semikhatsky 2010-07-20 23:22:52 PDT
(In reply to comment #4)
> (From update of attachment 62079 [details])
> WebCore/bindings/v8/ScriptCallStack.cpp:56
>  +      if (stackTrace->GetFrameCount() <= 0) {
> <=? Should it be == 0?
> 
No, GetFrameCount may return -1 if v8's IsDeadCheck fails.

> WebCore/bindings/v8/ScriptCallStack.cpp:59
>  +          *sourceName = toWebCoreString(v8::Undefined());
> "undefined"?
> 
Done.


> WebCore/bindings/v8/ScriptCallStack.cpp:61
>  +          *functionName = toWebCoreString(v8::Undefined());
> "undefined"?
Done.
Comment 6 Yury Semikhatsky 2010-07-20 23:54:06 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	LayoutTests/ChangeLog
	A	LayoutTests/inspector/console-assert-expected.txt
	A	LayoutTests/inspector/console-assert.html
	M	WebCore/ChangeLog
	M	WebCore/bindings/v8/ScriptCallStack.cpp
	M	WebCore/bindings/v8/ScriptCallStack.h
	M	WebCore/bindings/v8/ScriptController.cpp
	M	WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
	M	WebCore/inspector/ConsoleMessage.cpp
	M	WebCore/inspector/InspectorController.cpp
	M	WebCore/inspector/front-end/ConsoleView.js
	M	WebCore/page/Console.cpp
	M	WebCore/page/Console.idl
Committed r63805
Comment 7 Simon Hausmann 2010-08-25 01:18:21 PDT
Revision r63805 cherry-picked into qtwebkit-2.1 with commit 5b9f8cc6831808b61fdd8ecdd2885fc64a7785de
Comment 8 Ademar Reis 2010-08-26 11:04:23 PDT
This bug is marked as RESOLVED/FIXED but it depends on an open-bug: #13646

Should the dependency be removed? Maybe bug #13646 should block the qtwebkit-2.1 release bug instead? (bug #39121)