mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: LifecycleWatcher sub frames handling (#10841)
This commit is contained in:
parent
12bdd70651
commit
06c1588016
@ -22,6 +22,7 @@ import {Deferred} from '../util/Deferred.js';
|
|||||||
|
|
||||||
import {TimeoutError} from './Errors.js';
|
import {TimeoutError} from './Errors.js';
|
||||||
import {CDPFrame, FrameEmittedEvents} from './Frame.js';
|
import {CDPFrame, FrameEmittedEvents} from './Frame.js';
|
||||||
|
import {FrameManagerEmittedEvents} from './FrameManager.js';
|
||||||
import {HTTPRequest} from './HTTPRequest.js';
|
import {HTTPRequest} from './HTTPRequest.js';
|
||||||
import {NetworkManager, NetworkManagerEmittedEvents} from './NetworkManager.js';
|
import {NetworkManager, NetworkManagerEmittedEvents} from './NetworkManager.js';
|
||||||
import {
|
import {
|
||||||
@ -100,8 +101,9 @@ export class LifecycleWatcher {
|
|||||||
this.#timeout = timeout;
|
this.#timeout = timeout;
|
||||||
this.#eventListeners = [
|
this.#eventListeners = [
|
||||||
addEventListener(
|
addEventListener(
|
||||||
frame,
|
// Revert if TODO #1 is done
|
||||||
FrameEmittedEvents.LifecycleEvent,
|
frame._frameManager,
|
||||||
|
FrameManagerEmittedEvents.LifecycleEvent,
|
||||||
this.#checkLifecycleComplete.bind(this)
|
this.#checkLifecycleComplete.bind(this)
|
||||||
),
|
),
|
||||||
addEventListener(
|
addEventListener(
|
||||||
@ -254,6 +256,10 @@ export class LifecycleWatcher {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO(#1): Its possible we don't need this check
|
||||||
|
// CDP provided the correct order for Loading Events
|
||||||
|
// And NetworkIdle is a global state
|
||||||
|
// Consider removing
|
||||||
for (const child of frame.childFrames()) {
|
for (const child of frame.childFrames()) {
|
||||||
if (
|
if (
|
||||||
child._hasStartedLoading &&
|
child._hasStartedLoading &&
|
||||||
|
@ -1181,6 +1181,12 @@
|
|||||||
"parameters": ["webDriverBiDi"],
|
"parameters": ["webDriverBiDi"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[navigation.spec] navigation Page.goto should navigate to page with iframe and networkidle0",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[navigation.spec] navigation Page.goto should send referer",
|
"testIdPattern": "[navigation.spec] navigation Page.goto should send referer",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -2939,6 +2945,12 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["SKIP"]
|
"expectations": ["SKIP"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[navigation.spec] navigation Page.goto should navigate to page with iframe and networkidle0",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["cdp", "firefox"],
|
||||||
|
"expectations": ["TIMEOUT"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[navigation.spec] navigation Page.goto should navigate to URL with hash and fire requests without hash",
|
"testIdPattern": "[navigation.spec] navigation Page.goto should navigate to URL with hash and fire requests without hash",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
@ -129,6 +129,17 @@ describe('navigation', function () {
|
|||||||
});
|
});
|
||||||
expect(response!.status()).toBe(200);
|
expect(response!.status()).toBe(200);
|
||||||
});
|
});
|
||||||
|
it('should navigate to page with iframe and networkidle0', async () => {
|
||||||
|
const {page, server} = await getTestState();
|
||||||
|
|
||||||
|
const response = await page.goto(
|
||||||
|
server.PREFIX + '/frames/one-frame.html',
|
||||||
|
{
|
||||||
|
waitUntil: 'networkidle0',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
expect(response!.status()).toBe(200);
|
||||||
|
});
|
||||||
it('should navigate to empty page with networkidle2', async () => {
|
it('should navigate to empty page with networkidle2', async () => {
|
||||||
const {page, server} = await getTestState();
|
const {page, server} = await getTestState();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user