Skip to content

Commit

Permalink
Revert the CL which removes the origin trial code
Browse files Browse the repository at this point in the history
Revert the CL [1], which removed the origin trial code, since we are extending the origin trial, unexpectedly.

[1]: https://crrev.com/c/3578207

(cherry picked from commit 67aec55)

Bug: 1133108
Change-Id: I43e331f2ae015e2db7072618f3de04b913ec51ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3659553
Reviewed-by: Kunihiko Sakamoto <ksakamoto@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Hayato Ito <hayato@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1006297}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3661867
Auto-Submit: Hayato Ito <hayato@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/branch-heads/5060@{#230}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
hayatoito authored and Chromium LUCI CQ committed May 24, 2022
1 parent d82e06d commit e35e648
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2228,6 +2228,8 @@
},
{
name: "SubresourceWebBundles",
origin_trial_feature_name: "SubresourceWebBundles",
origin_trial_allows_third_party: true,
status: "experimental"
},
{
Expand Down
2 changes: 2 additions & 0 deletions third_party/blink/web_tests/NeverFixTests
Original file line number Diff line number Diff line change
Expand Up @@ -1814,6 +1814,8 @@ crbug.com/1119600 external/wpt/direct-sockets/* [ Skip ]
crbug.com/1119600 wpt_internal/direct-sockets/* [ Skip ]
virtual/direct-sockets/external/wpt/direct-sockets/* [ Pass ]
virtual/direct-sockets/wpt_internal/direct-sockets/* [ Pass ]
crbug.com/1082020 http/tests/loading/wbn/origin-trial/* [ Skip ]
virtual/subresource-web-bundles-disabled/http/tests/loading/wbn/origin-trial/* [ Pass ]

# No good way to automate this test yet
external/wpt/file-system-access/showSaveFilePicker-manual.https.html [ Skip ]
Expand Down
6 changes: 6 additions & 0 deletions third_party/blink/web_tests/VirtualTestSuites
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,12 @@
],
"args": [ "--enable-features=DisableDocumentDomainByDefault" ]
},
{
"prefix": "subresource-web-bundles-disabled",
"platforms": ["Linux", "Mac", "Win"],
"bases": [ "http/tests/loading/wbn/origin-trial/" ],
"args": [ "--disable-blink-features=SubresourceWebBundles" ]
},
{
"prefix": "backface-visibility-interop",
"platforms": ["Linux", "Mac", "Win"],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!DOCTYPE html>
<head><title>Subresource Web Bundles Origin Trial</title></head>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async (t) => {
assert_false(
HTMLScriptElement.supports('webbundle'),
'Subresource Web Bundles should not be supported by default.');

const meta = document.createElement('meta');
meta.httpEquiv = "origin-trial";
// This Origin Trial token is generated with the command:
// tools/origin_trials/generate_token.py \
// --expire-timestamp=2000000000 \
// --version=3 \
// https://127.0.0.1:8443 SubresourceWebBundles
meta.content = "A1nOn5e148yGA6ExfhqzlxQFFC71b03gYEAJEZ1XpUw+Lv8uUA4rpeyhCme0z3bBaRtIy8XkDK8twDUuhVXOegEAAABeeyJvcmlnaW4iOiAiaHR0cHM6Ly8xMjcuMC4wLjE6ODQ0MyIsICJmZWF0dXJlIjogIlN1YnJlc291cmNlV2ViQnVuZGxlcyIsICJleHBpcnkiOiAyMDAwMDAwMDAwfQ==";
document.head.appendChild(meta);

assert_true(
HTMLScriptElement.supports('webbundle'),
'Subresource Web Bundles should be supported.');

const wbn_url = 'https://localhost:8443/loading/wbn/resources/wbn/wbn-subresource-origin-trial.wbn';
const script_url = 'https://localhost:8443/loading/wbn/resources/wbn/server/wbn-subresource-origin-trial/script.js';

const ScriptWebBundle = 4074; // From web_feature.mojom
assert_false(window.internals.isUseCounted(document, ScriptWebBundle));

const bundle = document.createElement('script');
bundle.type = 'webbundle';
bundle.textContent = JSON.stringify({
source: wbn_url,
resources: [script_url]
});
document.body.appendChild(bundle);

assert_true(window.internals.isUseCounted(document, ScriptWebBundle));

async function loadScriptAndWaitReport(script_url) {
const result_promise = new Promise((resolve) => {
// This function will be called from script.js
window.report_result = resolve;
});

const script = document.createElement('script');
script.src = script_url;
document.body.appendChild(script);
return result_promise;
}

assert_equals(
await loadScriptAndWaitReport(script_url),
'from web bundle',
'Script should be loaded from the web bundle.');
document.body.removeChild(bundle);

assert_equals(
await loadScriptAndWaitReport(script_url),
'from server',
'Script should be loaded from the server after removing the script ' +
'type=webbundle.');
}, 'Subresource Web Bundles Origin Trial');
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<head><title>Subresource Web Bundles Third Party Origin Trial</title></head>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async (t) => {
assert_false(
HTMLScriptElement.supports('webbundle'),
'Subresource Web Bundles should not be supported by default.');

let resolve_third_party_script_loaded;
const third_party_script_loaded = new Promise((resolve) => {
resolve_third_party_script_loaded = resolve;
});
const third_party_script = document.createElement('script');
third_party_script.src = 'https://localhost:8443/loading/wbn/resources/wbn-subresource-third-party-origin-trial-script.js';
third_party_script.addEventListener('load', () => {
resolve_third_party_script_loaded();
});
document.body.appendChild(third_party_script);
await third_party_script_loaded;

assert_true(
HTMLScriptElement.supports('webbundle'),
'Subresource Web Bundles should be supported.');

const wbn_url = 'https://localhost:8443/loading/wbn/resources/wbn/wbn-subresource-third-party-origin-trial.wbn';
const script_url = 'https://localhost:8443/loading/wbn/resources/wbn/server/wbn-subresource-third-party-origin-trial/script.js';

const ScriptWebBundle = 4074; // From web_feature.mojom
assert_false(window.internals.isUseCounted(document, ScriptWebBundle));

const bundle = document.createElement('script');
bundle.type = 'webbundle';
bundle.textContent = JSON.stringify({
source: wbn_url,
resources: [script_url]
});
document.body.appendChild(bundle);

assert_true(window.internals.isUseCounted(document, ScriptWebBundle));

const result_promise = new Promise((resolve) => {
// This function will be called from script.js
window.report_result = resolve;
});

const script = document.createElement('script');
script.src = script_url;
document.body.appendChild(script);

assert_equals(
await result_promise,
'from web bundle',
'Script should be loaded from the web bundle.');
}, 'Subresource Web Bundles Third Party Origin Trial');
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In this virtual test suite subresource web bundles are disabled.

0 comments on commit e35e648

Please sign in to comment.