-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PreloadingDevTools: Disable prerendering for clients other than DevTo…
…ols frontend Prerendering introduced switching of FrameTreeNodes in the browser side and frame targets in the CDP client side. If a CDP client unaware of this logic and a prerendered page activated, it will cause unexpected behaviors. For example, Puppeteer loses control. To mitigate this, this CL disables prerendering if a target without tab target support is attached. For more details, see [1]. [1] https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA Bug: 1440085 Change-Id: I80bf9234b60722112baf21c4fa2ee1f0d0cb3221 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4495911 Reviewed-by: Danil Somsikov <dsv@chromium.org> Commit-Queue: Ken Okada <kenoss@chromium.org> Cr-Commit-Position: refs/heads/main@{#1158723}
- Loading branch information
Showing
6 changed files
with
181 additions
and
42 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
15 changes: 15 additions & 0 deletions
15
...ttp/tests/inspector-protocol/prerender/prerender-disabled-without-tab-target-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Test that prerender fails if a frame target without tab target is attached. | ||
{ | ||
method : Preload.prerenderStatusUpdated | ||
params : { | ||
key : { | ||
action : Prerender | ||
loaderId : <string> | ||
url : http://127.0.0.1:8000/inspector-protocol/prerender/resources/empty.html | ||
} | ||
prerenderStatus : PrerenderingDisabledByDevTools | ||
status : Failure | ||
} | ||
sessionId : <string> | ||
} | ||
|
23 changes: 23 additions & 0 deletions
23
...eb_tests/http/tests/inspector-protocol/prerender/prerender-disabled-without-tab-target.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
(async function(testRunner) { | ||
await testRunner.log('Test that prerender fails if a frame target without tab target is attached.'); | ||
|
||
const targetId = (await testRunner.browserP().Target.createTarget({ | ||
url: 'about:blank', | ||
forTab: false, | ||
})).result.targetId; | ||
const sessionId = (await testRunner.browserP().Target.attachToTarget({ | ||
targetId, | ||
flatten: true | ||
})).result.sessionId; | ||
const session = testRunner.browserSession().createChild(sessionId); | ||
const dp = session.protocol; | ||
|
||
await dp.Page.enable(); | ||
await dp.Preload.enable(); | ||
|
||
session.navigate('resources/simple-prerender.html'); | ||
|
||
testRunner.log(await dp.Preload.oncePrerenderStatusUpdated()); | ||
|
||
testRunner.completeTest(); | ||
}); |
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
43 changes: 20 additions & 23 deletions
43
third_party/blink/web_tests/http/tests/inspector-protocol/tracing/prerender.js
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