Support running Puppeteer's connect method against Firefox

RESOLVED FIXED

Status

enhancement
P1
normal
RESOLVED FIXED
a month ago
28 days ago

People

(Reporter: ochameau, Assigned: ochameau)

Tracking

Details

Attachments

(10 attachments)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
(Assignee)

Description

a month ago

The minimal CDP server to be landed in bug 1523104, will support very basic features in order to enable basic usages of chrome-remote-interface client library.
This is demonstrated by the following test: remote/test/browser/browser_cdp.js

But we are lacking support of /json/version and a couple of methods on Target domain (Target.getBrowserContexts and Target.setDiscoverTargets) in order to allow puppeteer.connnect() function to work.

We do not have any infra to run puppeteer script/test from mozilla-central,
so the only way to evaluate this support is to manually run a puppeteer nodejs script, like this:

  • First, run a server:
$ ./mach run --remote-debugging-port=9000 --headless
  • Run nodejs script:
$ DEBUG="puppeteer:protocol" node script.js 
const puppeteer = require('puppeteer');

puppeteer.connect({ browserURL: "http://localhost:9000"}).then(browser => {
  console.log("SUCCESS");
});

(Note that you will need ac_add_options --enable-cdp to be set in your mozconfig
and also note that this works with artifact builds)

(Assignee)

Updated

a month ago
Blocks: 1533682
(Assignee)

Comment 3

a month ago

This is going to help introduce multiple kind of targets.

Depends on D22685

(Assignee)

Comment 4

a month ago

This is going to help have different kind of session par target kind.

Depends on D22686

(Assignee)

Comment 5

a month ago

Remove content, docShell and chromeEventHandler attribute from base Domain class
as these fields only work for domains implemented in the content process and
attached to a browsing context/document.
For "global" domains like Target or Browser, that are not bound to any document,
these properties won't work.

Depends on D22687

(Assignee)

Comment 6

a month ago

Without that, the exception is silented.

Depends on D22688

(Assignee)

Comment 7

a month ago

Depends on D22689

(Assignee)

Comment 8

a month ago

Introduces a new kind of target "main-process",
which is not bound to any particular browser-element/browsing-context.
This implements only a subtest of domains and typical won't support the "content" ones.

This will require some more work in order to acknowledge having multiple kinds of targets.
We will also have "worker", "addon" and remoted-frames which will be very similar to tabs.

Depends on D22690

(Assignee)

Comment 9

a month ago

The Session used by MainProcessTarget isn't bound to any browser-element
and so do not use any of the message manager to pipe message to the content process.
Same for Target, the MainProcessTarget doesn't expose any browsing-context-related attribute.

Depends on D22691

(Assignee)

Comment 10

a month ago

Empty methods that are necessary to make puppeteer.connect to pass without throwing.

Depends on D22692

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Priority: -- → P1

Comment 11

a month ago
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/76ba842e38f5
Document --remote-debugger-port in usage message. r=ato
https://hg.mozilla.org/integration/autoland/rev/6e5c72c4c884
Remove unused target argument passed to Domain constructor. r=ato
https://hg.mozilla.org/integration/autoland/rev/886ef9f05fa3
Move targets modules to a dedicated targets folder. r=ato
https://hg.mozilla.org/integration/autoland/rev/1dc639610f3b
Move session modules to a dedicated sessions folder. r=ato
https://hg.mozilla.org/integration/autoland/rev/f46ddc90587c
Make content process domains to inherit from specialized ContentProcessDomain class. r=ato
https://hg.mozilla.org/integration/autoland/rev/600543aa900a
Print exceptions thrown by JSON handlers. r=ato
https://hg.mozilla.org/integration/autoland/rev/13431774ebec
Implement Browser.close. r=ato
https://hg.mozilla.org/integration/autoland/rev/735dcab78c93
Implement /json/version. r=ato
https://hg.mozilla.org/integration/autoland/rev/44e4bcd29904
Differentiate Sessions and Targets bound to a browser-element from the others. r=ato
https://hg.mozilla.org/integration/autoland/rev/ea81ce60cfea
Implement very first Target domains. r=ato
(Assignee)

Updated

29 days ago
Blocks: 1536794
(Assignee)

Updated

28 days ago
Blocks: 1537770
You need to log in before you can comment on or make changes to this bug.