-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert the CL which removes the origin trial code
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
Showing
6 changed files
with
137 additions
and
0 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
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
67 changes: 67 additions & 0 deletions
67
...nk/web_tests/http/tests/loading/wbn/origin-trial/script-webbundle-origin-trial.https.html
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,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> |
59 changes: 59 additions & 0 deletions
59
.../http/tests/loading/wbn/origin-trial/script-webbundle-third-party-origin-trial.https.html
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,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> |
1 change: 1 addition & 0 deletions
1
third_party/blink/web_tests/virtual/subresource-web-bundles-disabled/README.md
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 @@ | ||
In this virtual test suite subresource web bundles are disabled. |