Skip to content

Commit

Permalink
Returning a cached ranged response should now give a network error
Browse files Browse the repository at this point in the history
  • Loading branch information
jakearchibald committed May 22, 2018
1 parent b60c833 commit cc17d0d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions fetch/range/sw.https.window.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ promise_test(async t => {

await storedRangeResponse;

// This should not throw
await w.fetch('?action=use-stored-ranged-response', { mode: 'no-cors' });
// Fetching should reject
const fetchPromise = w.fetch('?action=use-stored-ranged-response', { mode: 'no-cors' });
promise_rejects(t, new TypeError(), fetchPromise);

// This shouldn't throw either
await loadScript('?action=use-stored-ranged-response', { doc: w.document });
// Script loading should error too
const loadScriptPromise = loadScript('?action=use-stored-ranged-response', { doc: w.document });
promise_rejects(t, new Error(), loadScriptPromise);

await loadScriptPromise.catch(() => {});

assert_false(!!w.scriptExecuted, `Partial response shouldn't be executed`);
}, `Ranged response not executed following no-cors ranged request`);
}, `Ranged response not allowed following no-cors ranged request`);

promise_test(async t => {
await setupRegistration(t);
Expand Down

0 comments on commit cc17d0d

Please sign in to comment.