Open Bug 1722608 Opened 5 years ago Updated 2 years ago

JS Error Stack contains incorrect line and column numbers in DOM handlers

Categories

(Core :: DOM: Core & HTML, defect)

Firefox 91
defect

Tracking

()

UNCONFIRMED

People

(Reporter: louis.dellorto, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36

Steps to reproduce:

https://jsfiddle.net/krogjfud/

Throw an error within a DOM element handler. i.e.) a button's onclick, or the body tag's onload.

The sample provided above demonstrates an error that gets thrown within an onclick handler when clicking on the button "Click me to throw an error". The handler catches the error and prints the stack to the DOM so you can see the value easily.

Actual results:

The line and column numbers are always ":1:1" on the root cause of the stack trace.

Expected results:

The line and column numbers should represent the actual location of the function call. In the jsfiddle provided for instance, the line and column for the onclick handler should be ":106:39" (as it is in all other browsers).

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

Parser would need to pass the information to DOM

Flags: needinfo?(hsivonen)
Severity: -- → S3

Currently, we transport the line and column on a per-element basis. It would be possible to record it on a per-attribute basis.

Flags: needinfo?(hsivonen)
You need to log in before you can comment on or make changes to this bug.