Closed Bug 1603223 Opened 4 years ago Closed 4 months ago

Decouple Page and Runtime domains

Categories

(Remote Protocol :: CDP, task, P3)

task

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: impossibus, Unassigned)

References

Details

(Whiteboard: [puppeteer-beta2-mvp])

Methods in the Page domain make use of Runtime._onContextCreated, for example.

See https://phabricator.services.mozilla.com/D55334#inline-341952:

I wonder instead if we could somehow make this emit an event per-world-to-evaluate for the ContextObserver to use, so that context-created events are created in just one central location and avoids the tight coupling between Page and Runtime?

Priority: P3 → P2
Whiteboard: [puppeteer-beta-mvp]
Whiteboard: [puppeteer-beta-mvp] → [puppeteer-beta-reserve]
Priority: P2 → P3

Both domains would have to listen for the internal context-created events instead. With the work on bug 1593226 we will get a ContextObserver singleton per session, both domains can listen for.

Depends on: 1593226

Also right now we have a couple of observers registered for the ContextObserver inside the framescript, which means for each and every tab:

https://hg.mozilla.org/integration/autoland/file/tip/remote/observers/ContextObserver.jsm#l59

I think this is complete overhead and should really be done only once in the parent process. Especially seeing Fission coming up. But at the same time when checking the Fission documentation I can see that JSWindowActor also allows you to register for observer notifications:

https://firefox-source-docs.mozilla.org/dom/Fission.html#other-jswindowactor-methods-that-can-be-overridden

Olli, do you know which kind of observers those are? Do we have content specific ones that would have to be registered per JSWindowActorChild? What about the webnavigation-create one? Thanks!

Flags: needinfo?(bugs)

I don't know what JSWindowActor observe() is for.
Alphan might know.

Flags: needinfo?(bugs) → needinfo?(alchen)

Olli, do you know which kind of observers those are? Do we have content specific ones that would have to be registered per JSWindowActorChild? What about the webnavigation-create one? Thanks!

Hello John,
could you help to answer this?

Flags: needinfo?(alchen) → needinfo?(jdai)

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #2)

Also right now we have a couple of observers registered for the ContextObserver inside the framescript, which means for each and every tab:

https://hg.mozilla.org/integration/autoland/file/tip/remote/observers/ContextObserver.jsm#l59

I think this is complete overhead and should really be done only once in the parent process. Especially seeing Fission coming up. But at the same time when checking the Fission documentation I can see that JSWindowActor also allows you to register for observer notifications:

https://firefox-source-docs.mozilla.org/dom/Fission.html#other-jswindowactor-methods-that-can-be-overridden

Olli, do you know which kind of observers those are? Do we have content specific ones that would have to be registered per JSWindowActorChild? What about the webnavigation-create one? Thanks!

We don't have content specific ones to allow register per JSWindowActor, but I think you can have your own JSWindowActor which can observe webnavigation-create.

Flags: needinfo?(jdai)

(In reply to John Dai[:jdai] from comment #5)

We don't have content specific ones to allow register per JSWindowActor, but I think you can have your own JSWindowActor which can observe webnavigation-create.

Right, but I'm not particularly interested to register for the same observer notification in each and every client actor. So I basically wonder why we have that feature, and if it maybe has to be used with caution for global observer notifications. Maybe a warning should be put on https://firefox-source-docs.mozilla.org/dom/Fission.html?

Flags: needinfo?(jdai)

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #6)

(In reply to John Dai[:jdai] from comment #5)

We don't have content specific ones to allow register per JSWindowActor, but I think you can have your own JSWindowActor which can observe webnavigation-create.

Right, but I'm not particularly interested to register for the same observer notification in each and every client actor. So I basically wonder why we have that feature, and if it maybe has to be used with caution for global observer notifications. Maybe a warning should be put on https://firefox-source-docs.mozilla.org/dom/Fission.html?

It's because JSWindowActor is lazily instantiated, some JSWindowActor needs to be instantiated when it received observer notification, ex: AudioPlayback[1]. I think it's worth putting a warning to notice user use with caution. :)

[1] https://searchfox.org/mozilla-central/rev/8ccea36c4fb09412609fb738c722830d7098602b/toolkit/modules/ActorManagerParent.jsm#58-69

Flags: needinfo?(jdai)
Whiteboard: [puppeteer-beta-reserve] → [puppeteer-beta2-mvp]
Component: CDP: Runtime → CDP
Severity: normal → S3

We are not going to fix that.

Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.