forked from puppeteer/puppeteer
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Frame): postpone evaluations until execution context gets created
In Blink, frames don't necesserily have execution context all the time. DevTools Protocol precisely reports this situation, which results in Puppeteer's frame.executionContext() being null occasionally. However, from puppeteer point of view every frame will have at least a default executions context, sooner or later: - frame's execution context might be created naturally to run frame's javascript - if frame has no javascript, devtools protocol will issue execution context creation This patch builds up on this assumption and introduces a PendingContext: - Initially, frame is created with a PendingContext instead of a real context - When frame clients request evaluations, PendingContext records evaluation requests - When a real execution context is created, the PendingContext runs all the postponed evaluations in the real context Fixes puppeteer#827, puppeteer#1325
- Loading branch information
1 parent
48ccf1e
commit b2c8fee
Showing
4 changed files
with
106 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters