Skip to content

Commit

Permalink
Reland "Prerender: Run WPT for CSP with target hint"
Browse files Browse the repository at this point in the history
This reverts commit c7d04919d65f45e49225b88737004c0741eaf4fa.

The original CL forgot to update the test expectations.

Original change's description:
> Revert "Prerender: Run WPT for CSP with target hint"
>
> This reverts commit 195504db54e81c95256097493b65140314be9d10.
>
> Reason for revert: Breaks tests on mac builders
>
> First failed build:
>
> https://ci.chromium.org/ui/p/chromium/builders/ci/mac12-arm64-rel-tests/15213/overview
>
> Original change's description:
> > Prerender: Run WPT for CSP with target hint
> >
> > Bug: 1501674
> > Change-Id: I7428467793000f1f37acdcde0b5310a9a3b364d7
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5043782
> > Reviewed-by: Lingqi Chi <lingqi@chromium.org>
> > Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1226729}
>
> Bug: 1503635
> Change-Id: If7314c3814251fe6d92191e3deab3249c7396d2a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5043730
> Owners-Override: Andreea Costinas <acostinas@google.com>
> Reviewed-by: Andreea Costinas <acostinas@google.com>
> Reviewed-by: Oleg Davydov <burunduk@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Oleg Davydov <burunduk@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1226765}

Bug: 1503635
Change-Id: I788157400410f8b0e8bfcd4af9d7b047a4e7057a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5047871
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1227331}
  • Loading branch information
nhiroki authored and chromium-wpt-export-bot committed Nov 21, 2023
1 parent 3d1200b commit e3d24c1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<meta name="variant" content="?target_hint=_self">
<meta name="variant" content="?target_hint=_blank">
<meta name="timeout" content="long">
<script src="/common/utils.js"></script>
<script src="/resources/testharness.js"></script>
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<!DOCTYPE html>
<meta name="timeout" content="long">
<meta name="variant" content="?target_hint=_self">
<meta name="variant" content="?target_hint=_blank">
<script src="/common/utils.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
Expand All @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion speculation-rules/prerender/csp-script-src-self.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<meta name="variant" content="?target_hint=_self">
<meta name="variant" content="?target_hint=_blank">
<meta name="timeout" content="long">
<script src="/common/utils.js"></script>
<script src="/resources/testharness.js"></script>
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<meta name="variant" content="?target_hint=_self">
<meta name="variant" content="?target_hint=_blank">
<meta name="timeout" content="long">
<script src="/common/utils.js"></script>
<script src="/resources/testharness.js"></script>
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<!DOCTYPE html>
<meta name="variant" content="?target_hint=_self">
<meta name="variant" content="?target_hint=_blank">
<meta name="timeout" content="long">
<script src="/common/utils.js"></script>
<script src="/resources/testharness.js"></script>
Expand All @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion speculation-rules/prerender/resources/csp-script-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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(() => {
Expand Down

0 comments on commit e3d24c1

Please sign in to comment.