WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
149405
Web Inspector: Clicking on a stack trace link does not navigate to the corresponding line
https://bugs.webkit.org/show_bug.cgi?id=149405
Summary
Web Inspector: Clicking on a stack trace link does not navigate to the corres...
Nikita Vasilyev
Reported
2015-09-21 07:39:13 PDT
Created
attachment 261654
[details]
[HTML] Reduction Steps: 1. Open attached stacktrace2.html 2. Open the console 3. Click on the first link, ".../stacktrace2.html:12:13" Expected: Debugger opened with the right line scrolled to the viewport and highlighted Actual: No lines are highlighted Notes: Possibly a regression.
Attachments
[HTML] Reduction
(349 bytes, text/html)
2015-09-21 07:39 PDT
,
Nikita Vasilyev
no flags
Details
[Animated GIF] Bug
(554.32 KB, image/gif)
2015-10-04 18:57 PDT
,
Nikita Vasilyev
no flags
Details
Patch
(2.11 KB, patch)
2015-10-04 20:01 PDT
,
Nikita Vasilyev
no flags
Details
Formatted Diff
Diff
Patch
(2.50 KB, patch)
2015-10-05 04:16 PDT
,
Nikita Vasilyev
no flags
Details
Formatted Diff
Diff
Patch
(2.41 KB, patch)
2015-10-05 12:25 PDT
,
Nikita Vasilyev
no flags
Details
Formatted Diff
Diff
Patch
(2.42 KB, patch)
2015-10-05 12:33 PDT
,
Nikita Vasilyev
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2015-09-21 07:39:44 PDT
<
rdar://problem/22781191
>
Nikita Vasilyev
Comment 2
2015-10-04 18:57:13 PDT
Created
attachment 262412
[details]
[Animated GIF] Bug
Nikita Vasilyev
Comment 3
2015-10-04 20:01:51 PDT
Created
attachment 262413
[details]
Patch
Devin Rousso
Comment 4
2015-10-04 23:54:33 PDT
Comment on
attachment 262413
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=262413&action=review
> Source/WebInspectorUI/UserInterface/Base/Main.js:2042 > + var lineNumber;
I think that for clarity's sake you may want to add a comment here as to why you don't have a default value on lineNumber. I was originally confused, but once I did some digging I understood that you wanted lineNumber to be undefined if lineColumnMatch was false (hopefully).
Nikita Vasilyev
Comment 5
2015-10-05 04:16:59 PDT
Created
attachment 262427
[details]
Patch
Joseph Pecoraro
Comment 6
2015-10-05 11:37:47 PDT
Comment on
attachment 262427
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=262427&action=review
> Source/WebInspectorUI/UserInterface/Base/Main.js:672 > + if (typeof lineNumber !== "number") > + lineNumber = parseInt(lineNumber); > + > + console.assert(!isNaN(lineNumber), "lineNumber isn't a number.");
How asserting: console.assert(typeof lineNumber === "undefined" || typeof lineNumber === "number", "lineNumber should be a number."); Or just asserting a number and giving lineNumber a default argument value of `0`. I don't think it makes sense to call openURL with a string line number, we should find and fix that instance, not cover it up.
Joseph Pecoraro
Comment 7
2015-10-05 11:38:11 PDT
> How asserting:
How *about* asserting.
Nikita Vasilyev
Comment 8
2015-10-05 11:44:58 PDT
(In reply to
comment #6
)
> Comment on
attachment 262427
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=262427&action=review
> > > Source/WebInspectorUI/UserInterface/Base/Main.js:672 > > + if (typeof lineNumber !== "number") > > + lineNumber = parseInt(lineNumber); > > + > > + console.assert(!isNaN(lineNumber), "lineNumber isn't a number."); > > How asserting: > > console.assert(typeof lineNumber === "undefined" || typeof lineNumber > === "number", "lineNumber should be a number.");
Nit: typeof NaN == "number", so this assert wouldn't catch NaN.
Nikita Vasilyev
Comment 9
2015-10-05 11:48:41 PDT
(In reply to
comment #8
)
> (In reply to
comment #6
) > > Comment on
attachment 262427
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=262427&action=review
> > > > > Source/WebInspectorUI/UserInterface/Base/Main.js:672 > > > + if (typeof lineNumber !== "number") > > > + lineNumber = parseInt(lineNumber); > > > + > > > + console.assert(!isNaN(lineNumber), "lineNumber isn't a number."); > > > > How asserting: > > > > console.assert(typeof lineNumber === "undefined" || typeof lineNumber > > === "number", "lineNumber should be a number."); > > Nit: typeof NaN == "number", so this assert wouldn't catch NaN.
How about: if (typeof lineNumber !== "undefined") console.assert(typeof lineNumber === "number" && !isNaN(lineNumber), "lineNumber should be a number.");
Joseph Pecoraro
Comment 10
2015-10-05 12:09:47 PDT
> Nit: typeof NaN == "number", so this assert wouldn't catch NaN.
I don't think we need to be asserting !NaN everywhere we expect a number, but it seems NaN would end up behaving like 0 here when passed down to SourceCodePosition's constructor.
> if (typeof lineNumber !== "undefined") > console.assert(typeof lineNumber === "number" && !isNaN(lineNumber), "lineNumber should be a number.");
We strip console.assert lines in Production builds. This style of code (assert inside non-brace condition block) would present problems when the assert statement is stripped an suddenly the next statement is inside the if instead of running always. This: if (A) assert(...); B; C; Suddenly becomes: if (A) B; C; So while the code is logically correct, our processing of the scripts would change the logic. So we tend to avoid this style of code (asserts inside conditionals).
Nikita Vasilyev
Comment 11
2015-10-05 12:25:01 PDT
Created
attachment 262454
[details]
Patch
Joseph Pecoraro
Comment 12
2015-10-05 12:26:23 PDT
> We strip console.assert lines in Production builds. This style of code > (assert inside non-brace condition block) would present problems when the > assert statement is stripped an suddenly the next statement is inside the if > instead of running always.
In fact, Source/WebInspectorUI/Scripts/remove-console-asserts.pl would warn:
> # Warn about console.assert in control flow statement without braces. Can change logic when stripped. > if (/console\.assert/) { > if ($previousLine =~ /^\s*(for|if|else|while|do)\b/ && $previousLine !~ /\{\s*$/) { > print "WARNING: console.assert inside control flow statement without braces on line: $.: $_"; > } > }
Joseph Pecoraro
Comment 13
2015-10-05 12:28:48 PDT
Comment on
attachment 262454
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=262454&action=review
> Source/WebInspectorUI/UserInterface/Base/Main.js:2041 > + var lineNumber; > + if (lineColumnMatch) > + lineNumber = lineColumnMatch[1] - 1;
Shouldn't this be using parseInt?
Nikita Vasilyev
Comment 14
2015-10-05 12:31:50 PDT
(In reply to
comment #13
)
> Comment on
attachment 262454
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=262454&action=review
> > > Source/WebInspectorUI/UserInterface/Base/Main.js:2041 > > + var lineNumber; > > + if (lineColumnMatch) > > + lineNumber = lineColumnMatch[1] - 1; > > Shouldn't this be using parseInt?
`- 1` implicitly causes parseInt. Should I use parseInt for consistency?
Nikita Vasilyev
Comment 15
2015-10-05 12:33:57 PDT
Created
attachment 262456
[details]
Patch
Blaze Burg
Comment 16
2015-10-05 12:35:33 PDT
(In reply to
comment #14
)
> (In reply to
comment #13
) > > Comment on
attachment 262454
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=262454&action=review
> > > > > Source/WebInspectorUI/UserInterface/Base/Main.js:2041 > > > + var lineNumber; > > > + if (lineColumnMatch) > > > + lineNumber = lineColumnMatch[1] - 1; > > > > Shouldn't this be using parseInt? > > `- 1` implicitly causes parseInt. Should I use parseInt for consistency?
Please do.
Nikita Vasilyev
Comment 17
2015-10-05 20:17:05 PDT
(In reply to
comment #16
)
> (In reply to
comment #14
) > > (In reply to
comment #13
) > > > Comment on
attachment 262454
[details]
> > > Patch > > > > > > View in context: > > >
https://bugs.webkit.org/attachment.cgi?id=262454&action=review
> > > > > > > Source/WebInspectorUI/UserInterface/Base/Main.js:2041 > > > > + var lineNumber; > > > > + if (lineColumnMatch) > > > > + lineNumber = lineColumnMatch[1] - 1; > > > > > > Shouldn't this be using parseInt? > > > > `- 1` implicitly causes parseInt. Should I use parseInt for consistency? > > Please do.
Fixed in the last patch.
WebKit Commit Bot
Comment 18
2015-10-06 16:23:11 PDT
Comment on
attachment 262456
[details]
Patch Clearing flags on attachment: 262456 Committed
r190651
: <
http://trac.webkit.org/changeset/190651
>
WebKit Commit Bot
Comment 19
2015-10-06 16:23:19 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug