Closed Bug 1818128 Opened 3 years ago Closed 3 years ago

Add logging code of `Selection` change for debugging complicated editable applications

Categories

(Core :: DOM: Selection, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

Details

Attachments

(1 file)

I'm sometimes blocked to debug our editor bug reports by Selection changes outside editor. However, adding break point to there is hard to debug due to Selection changes may occur at preparation. Therefore, it's really helpful for me if debug information is printed into the terminal.

It's hard to check Selection API calls from both JS and internals when we debug
web apps which has complicated contenteditable editor. Therefore, I'd like to
add an ability to log Selection API calls.

This patch needs to stop some methods inlined. Therefore, this could affect to
the performance in release builds, though. If so, perhaps, there should be
logging method for each inline method and define them in Selection.cpp.

For minimizing the impact for performance, this patch also makes them to check
the logging level before calling logging methods. It's currently redundant
for LogLevel::Debug case. However, this avoids any performance impact from
changes of MOZ_LOG implementation.

Attachment #9319156 - Attachment description: WIP: Bug 1818128 - Add logging code for Selection API calls → Bug 1818128 - Add logging code for Selection API calls r=smaug!
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/4d1b0a03d303 Add logging code for Selection API calls r=smaug
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch

Might be worthwhile to add this as a preset in about:logging for better visibility of this feature.

Well, I didn't know it has the UI. However, I'm not sure the rules of adding a log to it...

Masayuki, I think this is worth being mentioned in release note. Could you please nominate relnote-firefox? Thanks.

Flags: needinfo?(masayuki)

(In reply to Hsin-Yi Tsai (she/her) [:hsinyi] from comment #6)

Masayuki, I think this is worth being mentioned in release note. Could you please nominate relnote-firefox? Thanks.

Oh, really? What scenarios do you expect? This is useful for Gecko developers to get hints of what minified JS code does, however, I'm not sure whether this is useful for web developers to debug their products because the other information is also required for example, DOM mutation, etc. Once the logging is enabled, breaking in the debugger of devtools shows the last Selection API call though.

Flags: needinfo?(masayuki) → needinfo?(htsai)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #5)

Well, I didn't know it has the UI. However, I'm not sure the rules of adding a log to it...

According to this about:logging introduction I don't see particular rules that we should concern too much .

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #7)

(In reply to Hsin-Yi Tsai (she/her) [:hsinyi] from comment #6)

Masayuki, I think this is worth being mentioned in release note. Could you please nominate relnote-firefox? Thanks.

Oh, really? What scenarios do you expect? This is useful for Gecko developers to get hints of what minified JS code does, however, I'm not sure whether this is useful for web developers to debug their products because the other information is also required for example, DOM mutation, etc. Once the logging is enabled, breaking in the debugger of devtools shows the last Selection API call though.

I agreed that the audience for this logging improvement may be restricted to a certain group of people. However, I was thinking it's worthwhile promoting this enhancement, because it could be helpful to some extent when users, especially web developers, are reproducing editor issues and they know they can have the much better logs for us. Did I misunderstand something?

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

Attachment

General

Created:
Updated:
Size: