Closed Bug 1625961 Opened 8 months ago Closed 7 months ago

Use the ResourceWatcher API to fetch Root NodeFront

Categories

(DevTools :: Inspector, task, P2)

task

Tracking

(Fission Milestone:M6, firefox78 fixed)

RESOLVED FIXED
Firefox 78
Fission Milestone M6
Tracking Status
firefox78 --- fixed

People

(Reporter: ochameau, Assigned: jdescottes)

References

(Blocks 2 open bugs)

Details

(Whiteboard: dt-fission-m2-mvp)

Attachments

(2 files)

Bug 157662 introduced the ResourceWatcher API, accessible via toolbox.resourceWatcher. This API will help listen to data that is being created early, when the document just started loading.

We should migrate the whole DevTools codebase to this API for any data that:

  • DevTools frontend listen to, or care about,
    and,
  • may be created or be notified early, when the document just starts being loaded.
    This data will typically be: console messages, errors, warnings, sources, Root element NodeFront, storage values, network events, stylesheets, ...

We are typically not going to use this API for:

  • data being fetched on-demand, from user's input. For ex: webconsole evaluation input, or, DOM element expands from the Markup view.
  • events which we only want to record when the user cares about them. For ex: animation events.

For some more high level context, please have a look at Migration to Fission-compatible APIs, which describes all Fission-related refactorings.

The typical task for this bug will be about migrating code that:

  • start listening and register a RDP event listener,
  • retrieve already existings data,
    from panel's codebase, to the ResourceWatcher module, in the LegacyListener object.
    And then, the panel should use the ResourceWatcher instead.

Bug 1620234 is a good example of such migration, applied to Console Messages.
Bug 1623699 is also useful example as it demonstrates how to write tests for such migration.

This bug is about focusing on only one usecase: the root DOM Element NodeFront.

This work depends on bug 1611096, which make the root NodeFront retrieval closer to a what we need here.

Before this work, the root NodeFront was emited via the Walker actor mutations event, from here:
https://searchfox.org/mozilla-central/source/devtools/server/actors/inspector/walker.js#2511-2514
or, retrieved on initialization or the walker actor from here:
https://searchfox.org/mozilla-central/source/devtools/server/actors/inspector/walker.js#377-387

After this work a new new-root-available event is fired on the Walker actor and I think we rely on the same code for initialization.

Tracking Fission DevTools bugs for Fission Nightly (M6) milestone

Fission Milestone: --- → M6
Blocks: 1626645
See Also: → 1633348
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Attachment #9143977 - Attachment description: Bug 1625961 - Log a warning when calling ResourceWatcher::watch twice for the same type → Bug 1625961 - Throw when calling ResourceWatcher::watch twice for the same type
Blocks: 1635461
Blocks: 1635467
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/18646e7b984f
Use the ResourceWatcher API to fetch Root NodeFront r=ochameau,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/977b0031b41c
Throw when calling ResourceWatcher::watch twice for the same type r=nchevobbe,ochameau
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c7757cea8327
Use the ResourceWatcher API to fetch Root NodeFront r=ochameau,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/cf46002eefb0
Throw when calling ResourceWatcher::watch twice for the same type r=nchevobbe,ochameau

Backed out for mochitest perma failures.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1635467#c6

Flags: needinfo?(jdescottes)
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c24dddd0d636
Use the ResourceWatcher API to fetch Root NodeFront r=ochameau,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/ec4126b8bd7a
Throw when calling ResourceWatcher::watch twice for the same type r=nchevobbe,ochameau
Regressions: 1636813
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 78
Blocks: 1644190
Blocks: 1652445
You need to log in before you can comment on or make changes to this bug.