Bug 239491 - Wrong column number in window.onerror handler in code with template literals
Summary: Wrong column number in window.onerror handler in code with template literals
Status: RESOLVED DUPLICATE of bug 235607
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari Technology Preview
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-19 04:31 PDT by Michal Polko
Modified: 2022-04-26 12:40 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Polko 2022-04-19 04:31:19 PDT
Suppose we have the following JavaScript:

const a = `
    query test {
        field1
        field2
        field3
    }
`;const b = f();

If there is an error during call to f() function, Safari reports correct row number (line 7), but the column number is wrong (column 100 does not exist on line 7) - it seems that line breaks inside the template literal are ignored when calculating the column number. Chrome and Firefox both correctly reports the error happened on column 13.

This issue breaks displaying stacktraces in Sentry if the source code contains template literals with line breaks.

Link to reproduction: https://benevolent-hotteok-d24077.netlify.app/

Reproduced in latest Safari Technology Preview (143) and also in Safari 14.
Comment 1 Radar WebKit Bug Importer 2022-04-26 04:32:13 PDT
<rdar://problem/92326939>
Comment 2 Yusuke Suzuki 2022-04-26 12:40:21 PDT
Thanks for your report! It is fixed in bug 235607, which is not included in STP yet.

*** This bug has been marked as a duplicate of bug 235607 ***