mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
parent
486bbe010d
commit
d7937b806d
@ -256,7 +256,7 @@ export class FrameManager extends EventEmitter {
|
||||
const session = Connection.fromSession(this._client).session(
|
||||
event.sessionId
|
||||
);
|
||||
frame._updateClient(session);
|
||||
if (frame) frame._updateClient(session);
|
||||
this.setupEventListeners(session);
|
||||
await this.initialize(session);
|
||||
}
|
||||
|
@ -28,7 +28,10 @@ describeChromeOnly('OOPIF', function () {
|
||||
const { puppeteer, defaultBrowserOptions } = getTestState();
|
||||
browser = await puppeteer.launch(
|
||||
Object.assign({}, defaultBrowserOptions, {
|
||||
args: (defaultBrowserOptions.args || []).concat(['--site-per-process']),
|
||||
args: (defaultBrowserOptions.args || []).concat([
|
||||
'--site-per-process',
|
||||
'--remote-debugging-port=21222',
|
||||
]),
|
||||
})
|
||||
);
|
||||
});
|
||||
@ -309,6 +312,26 @@ describeChromeOnly('OOPIF', function () {
|
||||
expect(result.x).toBeGreaterThan(150); // padding + margin + border left
|
||||
expect(result.y).toBeGreaterThan(150); // padding + margin + border top
|
||||
});
|
||||
|
||||
it('should detect existing OOPIFs when Puppeteer connects to an existing page', async () => {
|
||||
const { server, puppeteer } = getTestState();
|
||||
|
||||
const frame = page.waitForFrame((frame) =>
|
||||
frame.url().endsWith('/oopif.html')
|
||||
);
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
await frame;
|
||||
expect(oopifs(context).length).toBe(1);
|
||||
expect(page.frames().length).toBe(2);
|
||||
|
||||
const browserURL = 'http://127.0.0.1:21222';
|
||||
const browser1 = await puppeteer.connect({ browserURL });
|
||||
const target = await browser1.waitForTarget((target) =>
|
||||
target.url().endsWith('dynamic-oopif.html')
|
||||
);
|
||||
await target.page();
|
||||
browser1.disconnect();
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user