Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(page): support wait options for page.setContent #3557

Merged
merged 1 commit into from Nov 20, 2018

Conversation

aslushnikov
Copy link
Contributor

This patch teaches page.setContent to await resources in
the new document.

NOTE: This patch changes behavior: currently, page.setContent
awaits the "domcontentloaded" event; with this patch, we can now await
other lifecycle events, and switched default to the "load" event.

The change is justified since current behavior made page.setContent
unusable for its main designated usecases, pushing our client
to use dataURL workaround.

Fixes #728

timeout = 30000,
} = options;
// We rely upon the fact that document.open() will reset frame lifecycle with "init"
// lifecycle event. @see https://crrev.com/608658
await this.evaluate(html => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the time this evaluate has finished, couldn't we have received all of the life cycle events? Then the lifecyclePromise will timeout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see what you mean. Done.

@aslushnikov aslushnikov merged commit 927d0f4 into puppeteer:master Nov 20, 2018
@aslushnikov aslushnikov deleted the waituntil branch January 22, 2019 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants