Closed Bug 1864168 Opened 10 months ago Closed 10 months ago

Use 1-origin column number for JavaScript locations in console message

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(6 files)

SpiderMonkey had been using 0-origin column number for script location, while using 1-origin column number for errors.
bug 1862814 is about to switch to consistently using 1-origin column numbers everywhere.

There are multiple places in Gecko-side that uses 0-origin column number when reporting to console etc.

nsJSUtils::GetCallingLocation is used mostly for console message and logging,
except for the following:

  • profiler label in TimeoutHandler
  • CC log for TimeoutHandler
  • events in nsIConsoleAPIStorage
  • JSON used by mozilla::dom::SendReports

Depends on D193369

I don't have too strong opinion whether 0 or 1 origin should be used. You may want to ask also for example peterv.

And this all needs review from devtools peers.

Thank you for reviewing!
I've added devtools-reviewers, and also asked peterv in chat.
the main part of the devtools change is handled in bug 1862693, but yeah, it's better getting their review for things that touches console message.

(In reply to Tooru Fujisawa [:arai] from comment #9)

I've added devtools-reviewers, and also asked peterv in chat.

I think this is fine, hopefully nobody is really relying on this detail. I looked at the Reporting API spec for example, and it doesn't specify whether the line/column numbers are 0-based or 1-based. AFAICT Chrome is using 1-based.

Severity: -- → N/A
Priority: -- → P3
See Also: → 1864786
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/f6646771a26a Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb https://hg.mozilla.org/integration/autoland/rev/fa77d852b494 Part 2: Use 1-origin column number in nsJSUtils::GetCallingLocation. r=smaug,anti-tracking-reviewers,devtools-reviewers,ochameau,pbz https://hg.mozilla.org/integration/autoland/rev/8ffec0d83028 Part 3: Use 1-origin column number for Xray-related console message. r=smaug,devtools-reviewers,ochameau https://hg.mozilla.org/integration/autoland/rev/d4db9576559b Part 4: Use 1-origin column number for WebSocket-related console message. r=smaug,devtools-reviewers,ochameau https://hg.mozilla.org/integration/autoland/rev/2c30c4d757fc Part 5: Use 1-origin column number in MOZ_CRASH message in IOUtils. r=smaug https://hg.mozilla.org/integration/autoland/rev/6d4ef1cdfabb Part 6: Use 1-origin column number in ScriptLoader and nsIScriptElement. r=smaug,devtools-reviewers,hsivonen,ochameau
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43306 for changes under testing/web-platform/tests

Backed out along with Bug 1862693, Bug 1864155, Bug 1862814, Bug 1865005 for causing bustage on nsRFPService.cpp.

[task 2023-11-22T11:52:46.461Z] 11:52:46     INFO -  In file included from Unified_cpp_resistfingerprinting0.cpp:11:
[task 2023-11-22T11:52:46.461Z] 11:52:46    ERROR -  /builds/worker/checkouts/gecko/toolkit/components/resistfingerprinting/nsRFPService.cpp:1443:26: error: no member named 'zeroOriginValue' in 'JS::ColumnNumberOneOrigin'; did you mean 'oneOriginValue'?
[task 2023-11-22T11:52:46.462Z] 11:52:46     INFO -   1443 |   aColumnNum = columnNum.zeroOriginValue();
[task 2023-11-22T11:52:46.463Z] 11:52:46     INFO -        |                          ^~~~~~~~~~~~~~~
[task 2023-11-22T11:52:46.463Z] 11:52:46     INFO -        |                          oneOriginValue
[task 2023-11-22T11:52:46.464Z] 11:52:46     INFO -  /builds/worker/workspace/obj-build/dist/include/js/ColumnNumber.h:232:12: note: 'oneOriginValue' declared here
[task 2023-11-22T11:52:46.464Z] 11:52:46     INFO -    232 |   uint32_t oneOriginValue() const {
[task 2023-11-22T11:52:46.465Z] 11:52:46     INFO -        |            ^
[task 2023-11-22T11:52:46.465Z] 11:52:46     INFO -  1 error generated.
[task 2023-11-22T11:52:46.465Z] 11:52:46    ERROR -  gmake[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:690: Unified_cpp_resistfingerprinting0.o] Error 1
[task 2023-11-22T11:52:46.466Z] 11:52:46     INFO -  gmake[4]: Leaving directory '/builds/worker/workspace/obj-build/toolkit/components/resistfingerprinting'
[task 2023-11-22T11:52:46.467Z] 11:52:46     INFO -  gmake[4]: Target 'target-objects' not remade because of errors.
[task 2023-11-22T11:52:46.467Z] 11:52:46    ERROR -  gmake[3]: *** [/builds/worker/checkouts/gecko/config/recurse.mk:72: toolkit/components/resistfingerprinting/target-objects] Error 2
Flags: needinfo?(arai.unmht)

this is an autoland-conflict with bug 1864826 patch
will address it shortly.

Flags: needinfo?(arai.unmht)
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/49d94b91efad Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb https://hg.mozilla.org/integration/autoland/rev/5420aecaffcd Part 2: Use 1-origin column number in nsJSUtils::GetCallingLocation. r=smaug,anti-tracking-reviewers,devtools-reviewers,ochameau,pbz https://hg.mozilla.org/integration/autoland/rev/0fb806d69104 Part 3: Use 1-origin column number for Xray-related console message. r=smaug,devtools-reviewers,ochameau https://hg.mozilla.org/integration/autoland/rev/2f0ce7338b3f Part 4: Use 1-origin column number for WebSocket-related console message. r=smaug,devtools-reviewers,ochameau https://hg.mozilla.org/integration/autoland/rev/a3c471ba10ce Part 5: Use 1-origin column number in MOZ_CRASH message in IOUtils. r=smaug https://hg.mozilla.org/integration/autoland/rev/89f0bd90367b Part 6: Use 1-origin column number in ScriptLoader and nsIScriptElement. r=smaug,devtools-reviewers,hsivonen,ochameau
Upstream PR was closed without merging
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: