DomException column number is always zero
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox146 | --- | fixed |
People
(Reporter: zzjas98, Assigned: zzjas98)
Details
Attachments
(2 files)
Steps to reproduce:
Steps to reproduce:
- Unzip the attached
column_zero.zipfile. - Open the
test_column_zero.htmlwith the latest Firefox
Dear Firefox Developers,
Our static analysis tool reported a potentially unimplemented functionality in DOMException::ColumnNumber()
uint32_t Exception::ColumnNumber() const { return 0; }
Currently, accessing the columnNumber property from a caught DOM exception in JavaScript always returns zero, even though the correct information is available in mLocation. Interestingly, the stack property does include the correct column number.
We were wondering if this behavior is intentional. If not, it appears that fixing it would be straightforward, as shown in the attached column_fix.patch.
Please let us know if we missed any key information or feedback! Thank you!
Actual results:
- The
exception.columnNumberis always 0, contradicting the column number shown byexception.stack - As shown in
before_screenshot.png
Expected results:
- The
exception.columnNumbershould show the correct column where the exception is thrown - As shown in
after_screenshot.png
Comment 1•7 months ago
|
||
Thank you for your investigation and the patch!
Indeed it's strange that we're always returning 0.
The return 0 itself dates back to the older implementation, and at that point there was no column number in JSStackFrame struct.
The column number was added in bug 1069490, as https://hg-edge.mozilla.org/mozilla-central/rev/b0dd65a5d40b6b7031c8a773b03f410159ef3ecd ,
but the DOM exception columnNumber getter implementation wasn't touched at that point, but at the same time I don't see any comment mentions it, so I assume it's not that there was some reason to skip it, but just that DOM exception wasn't the main target of the fix.
Also, given that columnNumber is not a part of the spec https://webidl.spec.whatwg.org/#idl-DOMException , returning non-zero value there would be okay (unless there's some website that relies on the value being zero, which is less likely).
Can you follow the https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html to submit the patch for review?
So that the commit is properly associated with your name/email, and the patch is handled in the review/landing processes.
Also it would be nice if there's an automated testcase that verifies the columnNumber property returns an expected value.
Let me know if there's anything unclear in the patch submission.
| Assignee | ||
Comment 2•7 months ago
|
||
Updated•7 months ago
|
| Assignee | ||
Comment 3•7 months ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #1)
Also, given that
columnNumberis not a part of the spec https://webidl.spec.whatwg.org/#idl-DOMException , returning non-zero value there would be okay (unless there's some website that relies on the value being zero, which is less likely).
Thanks for checking the spec and confirming the behavior!
Can you follow the https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html to submit the patch for review?
So that the commit is properly associated with your name/email, and the patch is handled in the review/landing processes.
Also it would be nice if there's an automated testcase that verifies the columnNumber property returns an expected value.
I submitted the patch with a mochitest that checks for the line number and column number.
Updated•7 months ago
|
Comment 6•7 months ago
|
||
Reverted this because it was causing mochitests-plain failures in test_exception_line_column.html.
- Revert link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | dom/bindings/test/test_exception_line_column.html | appendChild exception should be on line 35 - got 34, expected 35
| Assignee | ||
Comment 7•7 months ago
|
||
(In reply to Serban Stanca [:SerbanS] from comment #6)
Reverted this because it was causing mochitests-plain failures in test_exception_line_column.html.
- Revert link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | dom/bindings/test/test_exception_line_column.html | appendChild exception should be on line 35 - got 34, expected 35
Oh, I removed a line with an unreachable assertion and forgot to update the line number in this later assertion. It should be an easy fix by just changing the expected value. Sorry for missing this change in the beginning.
Should I push the change to the same Phabricator revision?
Comment 8•7 months ago
|
||
Yes, please push to the same revision.
| Assignee | ||
Comment 9•7 months ago
|
||
Thanks for the help! I submitted the fix.
Comment 10•7 months ago
|
||
Comment 11•6 months ago
|
||
| bugherder | ||
Updated•6 months ago
|
Description
•