Closed Bug 1539210 Opened 6 years ago Closed 6 years ago

Add support for Target.sendMessageToTarget and Target.receivedMessageFromTarget

Categories

(Remote Protocol :: CDP, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 2 open bugs)

Details

Attachments

(3 files)

Target.sendMessageToTarget allows to send a message to a target different from the one you originally connected too when attaching to the HTTP Endpoint.

Typically, Wordpress will use puppetteer in a way where it will connect to /devtools/browser HTTP endpoint. This actually connect to the main process target.

It will then use Target.createTarget to open a new tab and then use Target.attachToTarget to connect to the newly-opened tab's target.

But since they are still using Puppeteer 1.6.1 (Today's upstream version is 1.13.0), they are not using sessions as implemented in bug 1533682.

Instead, they are using Target.sendMessageToTarget and Target.receivedMessageFromTarget to communicate to this target while reusing the same websocket connection. Puppeteer no longer does/supports that.

We could probably help migrating WordPress to run against firefox if we don't force them to update puppeteer. But anyway, these two target methods are documented in many places and are often referenced in chrome-remote-interface as the main way to communicated to new targets. So it would probably help other integration if we implement these method and event.

A session is bound to a browsing context, not just one document.
unload is fired when navigating to another document. The document goes
away, but not the browsing context. So, we should keep the session up and running
when the current document is destroyed and we navigate to another URL.

Depends on D25577

Status: NEW → ASSIGNED
Priority: -- → P1
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dea69b276a3f Add support for Target.sendMessageToTarget and Target.receivedMessageFromTarget. r=ato https://hg.mozilla.org/integration/autoland/rev/d0558202539c Do not destroy the content process session on page unload. r=ato https://hg.mozilla.org/integration/autoland/rev/dfc8060c8b0e Document TabSession and Session constructor arguments. r=ato
Component: CDP: Target → CDP
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: