WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 221548
comment blocks cause incorrect reporting of column numbers in stack traces
https://bugs.webkit.org/show_bug.cgi?id=221548
Summary
comment blocks cause incorrect reporting of column numbers in stack traces
dan
Reported
2021-02-08 05:55:34 PST
Consider this JavaScript executing on a webpage, imported as an external script file: window.onload = () => { console.log('something unrelated');const e = new Error("new error");console.log(e.stack);console.log('something unrelated'); } The output of `console.log(e.stack)` in the Safari console is:
http://127.0.0.1:8081/build/main.js:2:57
Note the column number. 57 is between the "r" and the "(" in new Error("new error"). This looks good. Now consider this: window.onload = () => {/* something about this comment means the line number gets reported incorrectly in the stack */console.log('something unrelated');const e = new Error("new error");console.log(e.stack);console.log('something unrelated'); } The relevant output is then:
http://127.0.0.1:8081/build/main.js:3:161
Now the stack trace is reporting the error occurred at column 161, which does not exist.
Attachments
Patch
(1.76 KB, patch)
2022-03-24 17:38 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-02-15 05:56:12 PST
<
rdar://problem/74347565
>
Andrew Swan
Comment 2
2022-03-17 19:00:05 PDT
In addition to the original report, this also happens with multi-line strings: window.onload = () => { let s = ` multi line string `;console.log('something unrelated');const e = new Error("new error");console.log(e.stack);console.log('something unrelated'); } This is creating problems for us as we use source maps to translate the locations of javascript errors, but the incorrect column numbers are causing this translation to break.
Andrew Swan
Comment 3
2022-03-17 19:03:06 PDT
And fwiw, I think
https://bugs.webkit.org/show_bug.cgi?id=213873
is probably due to the same underlying issue.
Yusuke Suzuki
Comment 4
2022-03-24 17:28:35 PDT
Thanks! This is fixed in
bug 235607
:) Let us add some more test cases to ensure this. *** This bug has been marked as a duplicate of
bug 235607
***
Yusuke Suzuki
Comment 5
2022-03-24 17:38:42 PDT
Reopening to attach new patch.
Yusuke Suzuki
Comment 6
2022-03-24 17:38:44 PDT
Created
attachment 455712
[details]
Patch
EWS
Comment 7
2022-03-24 21:15:42 PDT
Committed
r291847
(
248859@main
): <
https://commits.webkit.org/248859@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 455712
[details]
.
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