Closed Bug 1884732 Opened 1 year ago Closed 1 year ago

Add logging for window actor messages

Categories

(Core :: DOM: Content Processes, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
126 Branch
Tracking Status
firefox126 --- fixed

People

(Reporter: mccr8, Assigned: tjr)

References

(Blocks 1 open bug, )

Details

Attachments

(2 obsolete files)

Akin to bug 1512690, it would be nice to have some logging for window actor messages. I have a very crude prototype I wanted to upload somewhere, so I'm filing this bug.

Along with this, I implemented a parser for these logging messages, along with what could loosely be called a Javascript-to-Python compiler, and a very crude type system.

For instance, here are the types it produces for a few AboutNewTab messages you see after opening the browser briefly:
Init {portID: string, url: string}
ActivityStream:ContentToMain {type: string, meta: {from: string, to: string, skipLocal?: bool}, data?: {topsites_icon_stats?: {custom_screenshot: int, screenshot: int, tippytop: int, rich_icon: int, no_image: int}, topsites_pinned?: int, topsites_search_shortcuts?: int, topsites_first_painted_ts?: int, visibility_event_rcvd_ts?: int, source?: string, tiles?: Array({id: int, pos: int, type?: string, recommendation_id?: string | undefined, shim?: string}, type?: string, position?: int, tile_id?: int, reporting_url?: string, advertiser?: string, window_inner_width?: int, window_inner_height?: int, flightId?: int}}
Load undefined
AboutNewTabVisible undefined
Unload undefined

?: means the field is optional. Right now, it globs together multiple messages in the crudest way possible so if it sees {foo: int} and {bar: string} for a message, it'll combine them into {foo?: int, bar?: string}. My focus now is getting the parsing working. The type inferencing will probably require some more clever heuristics.

Unsurprisingly, JS_ValueToSource doesn't seem to produce useful output for DOM objects, at least based on one example.

The message MarionetteEventsChild:PageLoadEvent has a field browsingContext that is assigned the value this.browsingContext, which I assume is a BrowsingContext based on the WebIDL, but in my logging it shows up as {} which is not helpful. I'll have to see if there's a better function I can call.

JS_ValueToSource also doesn't produce any real output for Maps. evilpie pointed me at bug 1820804 which is about improving console logging for various objects.

I think I'll have to implement (yet another) logging function for this. Any type checking that we implement will likely have to implement a similar sort of traversal, so time spent understanding how to do that hopefully won't be wasted.

Blocks: 1885221

I went to log JSActor messages, and hacked up this patch, then I remembered you had done something with MMPrinter and realized I had duplicated this patch in a different way. I think it's more naive than yours, but I figured I'd throw it up just in case.

Pushed by tritter@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/acccc0eb50c9 Log JSActor messages with MMPrinter r=mccr8
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
Regressions: 1886922
Assignee: continuation → tom
Attachment #9391321 - Attachment is obsolete: true
Attachment #9390592 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: