diff --git a/speculation-rules/prerender/csp-script-src-elem-inline-speculation-rules.html b/speculation-rules/prerender/csp-script-src-elem-inline-speculation-rules.html
index 62689184ba9483..7f33c32793bef2 100644
--- a/speculation-rules/prerender/csp-script-src-elem-inline-speculation-rules.html
+++ b/speculation-rules/prerender/csp-script-src-elem-inline-speculation-rules.html
@@ -1,4 +1,6 @@
+
+
@@ -17,7 +19,7 @@
// Open the test runner in a popup - it will prerender itself, record the
// test results, and send them back to this harness.
const url =
- `resources/csp-script-src-elem-inline-speculation-rules.html?key=${key}`;
+ `resources/csp-script-src-elem-inline-speculation-rules.html?key=${key}&target_hint=${getTargetHint()}`;
window.open(url, '_blank', 'noopener');
// Wait until the test sends us the results.
diff --git a/speculation-rules/prerender/csp-script-src-inline-speculation-rules.html b/speculation-rules/prerender/csp-script-src-inline-speculation-rules.html
index 6c3a817f761221..1d5b35c30fba7c 100644
--- a/speculation-rules/prerender/csp-script-src-inline-speculation-rules.html
+++ b/speculation-rules/prerender/csp-script-src-inline-speculation-rules.html
@@ -1,5 +1,7 @@
+
+
@@ -17,7 +19,7 @@
// Open the test runner in a popup - it will prerender itself, record the
// test results, and send them back to this harness.
const url =
- `resources/csp-script-src-inline-speculation-rules.html?key=${key}`;
+ `resources/csp-script-src-inline-speculation-rules.html?key=${key}&target_hint=${getTargetHint()}`;
window.open(url, '_blank', 'noopener');
// Wait until the test sends us the results.
diff --git a/speculation-rules/prerender/csp-script-src-self.html b/speculation-rules/prerender/csp-script-src-self.html
index 46fbfd72fd042a..86cf9def4a5a0d 100644
--- a/speculation-rules/prerender/csp-script-src-self.html
+++ b/speculation-rules/prerender/csp-script-src-self.html
@@ -1,4 +1,6 @@
+
+
@@ -17,7 +19,7 @@
// Open the test runner in a popup - it will prerender itself, record the
// test results, and send them back to this harness.
const url =
- `resources/csp-script-src-self.html?key=${key}`;
+ `resources/csp-script-src-self.html?key=${key}&target_hint=${getTargetHint()}`;
window.open(url, '_blank', 'noopener');
// Wait until the test sends us the results.
diff --git a/speculation-rules/prerender/csp-script-src-strict-dynamic.html b/speculation-rules/prerender/csp-script-src-strict-dynamic.html
index d84ea3e435b0af..d5d8079401127c 100644
--- a/speculation-rules/prerender/csp-script-src-strict-dynamic.html
+++ b/speculation-rules/prerender/csp-script-src-strict-dynamic.html
@@ -1,4 +1,6 @@
+
+
@@ -17,7 +19,7 @@
// Open the test runner in a popup - it will prerender itself, record the
// test results, and send them back to this harness.
const url =
- `resources/csp-script-src-strict-dynamic.html?key=${key}`;
+ `resources/csp-script-src-strict-dynamic.html?key=${key}&target_hint=${getTargetHint()}`;
window.open(url, '_blank', 'noopener');
// Wait until the test sends us the results.
diff --git a/speculation-rules/prerender/csp-script-src-unsafe-inline.html b/speculation-rules/prerender/csp-script-src-unsafe-inline.html
index ea2879bc72cffe..b9b3092a1282bd 100644
--- a/speculation-rules/prerender/csp-script-src-unsafe-inline.html
+++ b/speculation-rules/prerender/csp-script-src-unsafe-inline.html
@@ -1,4 +1,6 @@
+
+
@@ -17,7 +19,7 @@
// Open the test runner in a popup - it will prerender itself, record the
// test results, and send them back to this harness.
const url =
- `resources/csp-script-src-unsafe-inline.html?key=${key}`;
+ `resources/csp-script-src-unsafe-inline.html?key=${key}&target_hint=${getTargetHint()}`;
window.open(url, '_blank', 'noopener');
// Wait until the test sends us the results.
diff --git a/speculation-rules/prerender/resources/csp-script-src.js b/speculation-rules/prerender/resources/csp-script-src.js
index 866acaa09ba78e..6107819a36938d 100644
--- a/speculation-rules/prerender/resources/csp-script-src.js
+++ b/speculation-rules/prerender/resources/csp-script-src.js
@@ -3,6 +3,9 @@ const params = new URLSearchParams(location.search);
// Take a key used for storing a test result in the server.
const key = params.get('key');
+// Take a target hint to decide a target context for prerendering.
+const rule_extras = {'target_hint': getTargetHint()};
+
// Speculation rules injection is blocked in the csp-script-src 'self' test.
const block = location.pathname.endsWith('csp-script-src-self.html');
@@ -37,7 +40,7 @@ if (!run_test) {
});
}
- startPrerendering(url.toString());
+ startPrerendering(url.toString(), rule_extras);
// Wait until the prerendered page signals us it's ready to close.
nextValueFromServer(done_key).then(() => {