Exception when calling Network.enable twice for the same target
Categories
(Remote Protocol :: CDP, task, P2)
Tracking
(Not tracked)
People
(Reporter: jdescottes, Unassigned)
Details
Blocks several puppeteer tests relying on browser.pages
async pages() {
const pages = await Promise.all(
this.targets()
.filter(target => target.type() === 'page')
.map(target => target.page())
);
return pages.filter(page => !!page);
}
https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/lib/Browser.js#L185-L192
Seems to happen in any puppeteer test, doesn't matter how basic but here's an example of test that will hang on browser.pages:
console.log("Create page");
const page = await browser.newPage();
console.log("Go to example.com");
await page.goto("http://example.com/");
console.log("Call browser.pages");
await browser.pages();
Reporter | ||
Comment 1•5 years ago
|
||
As far as gutenberg is concerned, this probably only impacts preview.test.js
Reporter | ||
Comment 2•5 years ago
|
||
browser.pages() will create Targets for all the available pages, and Page.create contains:
await Promise.all([
client.send('Target.setAutoAttach', {autoAttach: true, waitForDebuggerOnStart: false}),
client.send('Page.setLifecycleEventsEnabled', { enabled: true }),
client.send('Network.enable', {}),
client.send('Runtime.enable', {}),
client.send('Security.enable', {}),
client.send('Performance.enable', {}),
client.send('Log.enable', {}),
]);
https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/lib/Page.js#L48-L56
We hang on client.send('Network.enable', {})
. When we try to create NetworkObserver in Network.enable we crash on
const registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(
SINK_CLASS_ID,
SINK_CLASS_DESCRIPTION,
SINK_CONTRACT_ID,
this._channelSinkFactory
);
Reporter | ||
Updated•5 years ago
|
Comment 3•5 years ago
|
||
For what it’s worth, we also see this XPCOM exception trying to
initialise the NetworkObserver
when Network.enable
is called
in the beforeAll
function when running the Puppeteer tests.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 4•5 years ago
|
||
I actually fixed that on bug 1585272.
Assignee | ||
Updated•4 years ago
|
Description
•