Implement Page.addScriptToEvaluateOnNewDocument
Categories
(Remote Protocol :: CDP, enhancement, P1)
Tracking
(firefox73 fixed)
Tracking | Status | |
---|---|---|
firefox73 | --- | fixed |
People
(Reporter: impossibus, Assigned: impossibus)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [puppeteer-alpha-reserve])
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
Evaluates given script in every frame upon creation (before loading frame's scripts) and returns script's id.
Example
"method":"Page.addScriptToEvaluateOnNewDocument","params":{"source":"//# sourceURL=__puppeteer_evaluation_script__","worldName":"__puppeteer_utility_world__"}
"result":{"identifier":"1"}
Assignee | ||
Comment 1•5 years ago
|
||
Since this figures in Puppeteer's FrameManager._ensureIsolatedWorld, it might also block many gutenberg tests as in https://bugzilla.mozilla.org/show_bug.cgi?id=1597877#c1 -- but this is unclear right now.
Comment 2•5 years ago
|
||
Three concerns that should be investigated here:
- How does Chromium deal with deprecation in the script cache?
- Is there a memory limitation on the maximum number of allowed scripts?
- When during document loading is the script evaluated? (
load
vsDOMContentLoaded
for example)
Updated•5 years ago
|
Comment 3•5 years ago
|
||
Another thing which comes into my mind is also the order of the scripts to evaluate. There could be code that gets modified by multiple registered scripts. As such the order would matter. Maybe it is just by the time when scripts got added.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 4•5 years ago
|
||
If the "worldName" parameter is specified, then this command "creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted."
This part is what creates the "secondary world" in Puppeteer after each navigation, so it's definitely blocking gutenberg and more. It's the other piece of the puzzle, alongside Bug 1597877.
Assignee | ||
Comment 5•5 years ago
|
||
Looks like Puppeteer registers a dummy script with this command and only relies on it for execution contexts for their "secondary world", as described above.
Assignee | ||
Comment 6•5 years ago
|
||
Depends on D55169
Depends on D55169
Comment 8•5 years ago
|
||
bugherder |
Updated•4 years ago
|
Description
•