Open Bug 1610855 Opened 5 years ago Updated 1 years ago

Implement Target.targetInfoChanged

Categories

(Remote Protocol :: CDP, enhancement, P3)

enhancement

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: impossibus, Assigned: canadahonk)

References

(Blocks 1 open bug)

Details

(Whiteboard: [puppeteer-beta2-mvp])

Attachments

(1 file)

The Puppeteer unit test for this expects a Target.targetInfoChanged CDP event after Page.close in Puppeteer.

https://github.com/puppeteer/puppeteer/blob/14b236965000c2821aece8deae72fb927ab33930/test/launcher.spec.js#L382-L393

Puppeteer emits its own Events.Browser.TargetChanged when it sees Target.targetInfoChanged

Firefox Browser target events should work (launcher.spec.js:382:5)
  Message:
    expect.toEqual failed:
{
  "0": "CREATED",
  "1": "DESTROYED"
} ≈ {
  "0": "CREATED",
  "1": "CHANGED",
  "2": "DESTROYED"
}
  Stack:
    Error: expect.toEqual failed:
    {
      "0": "CREATED",
      "1": "DESTROYED"
    } ≈ {
      "0": "CREATED",
      "1": "CHANGED",
      "2": "DESTROYED"

This event doesn't need to be emitted for Page.close only, but for each instance a target changes. Note that we don't have implemented this event at all. Also there is even no meta bug filed yet. Could you do that?

It's actually for targetInfoChanged, for which we have a meta bug. (I updated my original comment as well to reflect this.)

Blocks: 1587467
Type: defect → enhancement
Summary: Emit targetChanged after Page.close → Implement Target.targetInfoChanged
Whiteboard: [puppeteer-beta-reserve]
Type: enhancement → task
Type: task → enhancement
Whiteboard: [puppeteer-beta-reserve] → [puppeteer-beta2-mvp]
Component: CDP: Target → CDP
Severity: normal → S3

As the spec does not specify, from looking at Chromium source, Target.targetInfoChanged is emitted when a target is:

  • Navigated
  • Attached
  • Detached (not implemented)

As detached is not implemented, it might be good for this (or the meta) to depend on detach as otherwise Page.close, etc would not emit a Target.targetInfoChanged event.

Added new "target-changed" event to TargetList generally, which Target
domain now subscribes to with Target.setDiscoverTargets, and emits a
Target.targetInfoChanged event when recieved.

Target.targetInfoChanged is emitted when certain things happen to a target:

  • Top frame navigation (via observing document-element-inserted in TargetList)
  • Attached (via attachToTarget in Target domain)
  • Detached (not implemented - see Bug 1549536)

These are not specified in the spec but you can find by searching Chromium source:
https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/protocol/target_handler.cc?q=targetInfoChanged

Puppeteer tests look to depend on this event quite a bit as they
always expect it in event histories, hopefully should fix several
results (TODO: retest and check changes).

WIP, needs tests.

Assignee: nobody → oj
Status: NEW → ASSIGNED

(In reply to CanadaHonk [:CanadaHonk] from comment #3)

As detached is not implemented, it might be good for this (or the meta) to depend on detach as otherwise Page.close, etc would not emit a Target.targetInfoChanged event.

I've added a comment to bug 1636979 to indicate that this event needs to be fired as well.

Attachment #9318513 - Attachment description: WIP: Bug 1610855 - [cdp] Implement Target.targetInfoChanged → Bug 1610855 - [cdp] Implement Target.targetInfoChanged
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: