Closed Bug 1634029 Opened 4 years ago Closed 4 years ago

Reorganize observer modules and simplify watching for created/closed browser windows

Categories

(Remote Protocol :: Agent, task, P1)

task

Tracking

(firefox77 fixed)

RESOLVED FIXED
Firefox 77
Tracking Status
firefox77 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

(Whiteboard: [puppeteer-beta-mvp])

Attachments

(3 files, 2 obsolete files)

Before I want to start working on bug 1593226 I would like to see this refactoring landed, which makes the code easier to understand and follow.

Here the notable proposed changes:

  • Move all observer modules into the /remote/observers folder
  • Simplify handling of XUL/DOMWindows, and remove the extra not-needed WindowObserver
  • Rename TabTarget to PageTarget and TabSession to PageSession to align with CDP

To better keep track of available observer classes
it's better to have them all in the same folder.

While moving files around the patch also renames
the TabObserver module to TargetObserver, which
would allow us to add target observers for workers
in the future.

The changes align our code to other instances of nsIWindowMediatorListener
usage in-tree, which always rely on the "load" event. Also "interactive"
isn't a ready state a XULWindow can ever be in, it's only used for content
windows.

The WindowObserver class is only used by the TabObserver, and as such
can easily be integrated transparently. This also removes the extra
events as being emitted for opening and closing XUL windows.

Within CDP there is no tab target, but a page target. The patch
renames our TabTarget class appropriately for an easier understanding
of our code.

Within CDP there is no tab session, but a page session. The patch
renames our TabSession class appropriately for an easier understanding
of our code.

Whiteboard: [puppeteer-beta-reserve] → [puppeteer-beta-mvp]
Priority: P2 → P1
Attachment #9144328 - Attachment is obsolete: true
Attachment #9144329 - Attachment is obsolete: true
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/804e863ee8d0
[remote] Re-organize observer modules into a single directory. r=remote-protocol-reviewers,maja_zf
https://hg.mozilla.org/integration/autoland/rev/1da9a1cbc272
[remote] Simplify handling of created DOMWindow's. r=remote-protocol-reviewers,maja_zf
https://hg.mozilla.org/integration/autoland/rev/2ea167bead02
[remote] Integrate WindowObserver into TabObserver. r=remote-protocol-reviewers,maja_zf
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 77
Summary: Refactor code for Page targets / sessions and registered observers → Reorganize observer modules and simplify watching for created/closed browser windows
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: