Add logging for window actor messages
Categories
(Core :: DOM: Content Processes, enhancement)
Tracking
()
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.
Reporter | ||
Comment 1•1 year ago
|
||
Reporter | ||
Comment 2•1 year ago
|
||
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.
Reporter | ||
Comment 3•1 year ago
|
||
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.
Reporter | ||
Comment 4•1 year ago
|
||
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.
Assignee | ||
Comment 5•1 year ago
|
||
Assignee | ||
Comment 6•1 year ago
|
||
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.
Comment 8•1 year ago
|
||
bugherder |
Reporter | ||
Updated•1 year ago
|
Reporter | ||
Updated•1 year ago
|
Updated•1 year ago
|
Description
•