From 9b9cd6fe6413e795a86f3bd72b9774256ebea449 Mon Sep 17 00:00:00 2001 From: Hiroki Nakagawa Date: Sun, 12 Nov 2023 20:21:53 -0800 Subject: [PATCH] Prerender: Add WPT infra to trigger prerendering with target hint This CL adds WPT test helpers to trigger prerendering with target hint "_blank" (i.e., prerender-into-new-tab), and runs an existing tests as a reference. Follow-up CLs will run more existing tests. Note that this CL doesn't add test helpers to activate a prerendered page on a new tab yet so that we cannot test deferral-until-activation cases yet. Bug: 1501674 Change-Id: Ia58c1c5f3800843083ada383588a938ba12cc8ed Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5020542 Reviewed-by: Lingqi Chi Commit-Queue: Hiroki Nakagawa Reviewed-by: Kent Tamura Cr-Commit-Position: refs/heads/main@{#1223465} --- speculation-rules/prerender/resources/utils.js | 8 ++++++-- .../prerender/restriction-screen-capture.https.html | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/speculation-rules/prerender/resources/utils.js b/speculation-rules/prerender/resources/utils.js index 311d37f0a0198a..62b3b3225cd857 100644 --- a/speculation-rules/prerender/resources/utils.js +++ b/speculation-rules/prerender/resources/utils.js @@ -1,7 +1,10 @@ const STORE_URL = '/speculation-rules/prerender/resources/key-value-store.py'; // Starts prerendering for `url`. -function startPrerendering(url) { +// +// `rule_extras` provides additional parameters for the speculation rule used +// to trigger prerendering. +function startPrerendering(url, rule_extras = {}) { // Adds @@ -11,6 +13,10 @@