Skip to content

Commit

Permalink
Add test for filtered crossorigin cache response (#24356).
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed Oct 4, 2019
1 parent b347cf8 commit b282ed9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/wpt/mozilla/meta/MANIFEST.json
Expand Up @@ -11353,6 +11353,12 @@
{}
]
],
"mozilla/cache_crossorigin_response.sub.html": [
[
"mozilla/cache_crossorigin_response.sub.html",
{}
]
],
"mozilla/calc.html": [
[
"mozilla/calc.html",
Expand Down Expand Up @@ -18479,6 +18485,10 @@
"13a1a0fdc15ac05458ebf2c1fd75d501a6de92e3",
"testharness"
],
"mozilla/cache_crossorigin_response.sub.html": [
"266995f30afa3e9b3472e4cc43be6493c562aef6",
"testharness"
],
"mozilla/calc.html": [
"80aa06e2ae7cd5db585873f147a21382b279b86e",
"testharness"
Expand Down
@@ -0,0 +1,31 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Cached cross-origin response doesn't hang");

onload = t.step_func(function() {
let complete = 0;
function check() {
complete++;
if (complete == 2) {
t.done();
}
}

const url = "http://{{hosts[][www]]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/is-script-goal.js?pipe=trickle(d5)|header(Cache-Control,max-age=3600)|header(Pragma,)|header(Expires,36000)";

function loadScript() {
let script = document.createElement('script');
document.body.appendChild(script);
script.src = url;
script.onerror = t.unreached_func();
script.onload = t.step_func(check);
}
// Kick off a load so there's a cache entry with an in progress response.
loadScript();

// Kick off a second load after a slight delay which should end up waiting until
// the first load is complete before sharing the existing cached response.
t.step_timeout(loadScript, 0);
});
</script>

0 comments on commit b282ed9

Please sign in to comment.