Skip to content

Commit

Permalink
Revert "Cache Storage: Check for duplicate entries in Cache.addAll()."
Browse files Browse the repository at this point in the history
This reverts commit 74fd352e51322e823070088c7d5c72e911966580.

Reason for revert: Moving behind experimental feature flag until web compat can be assessed.

Original change's description:
> Cache Storage: Check for duplicate entries in Cache.addAll().
>
> This implements step 4.2.3 of the BatchCacheOperations algorithm:
>
> https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm
>
> Bug: 720919
> Change-Id: I679f786441b813ed816a183522021c417f4ab7b8
> Reviewed-on: https://chromium-review.googlesource.com/1162362
> Commit-Queue: Ben Kelly <[email protected]>
> Reviewed-by: Joshua Bell <[email protected]>
> Reviewed-by: Kinuko Yasuda <[email protected]>
> Reviewed-by: Victor Costan <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#582738}

[email protected],[email protected],[email protected],[email protected]

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 720919
Change-Id: I08736e4ec638a65c48f329966f378698a6d9b045
Reviewed-on: https://chromium-review.googlesource.com/1178502
Reviewed-by: Victor Costan <[email protected]>
Commit-Queue: Ben Kelly <[email protected]>
Cr-Commit-Position: refs/heads/master@{#583849}
  • Loading branch information
wanderview authored and chromium-wpt-export-bot committed Aug 16, 2018
1 parent d44f0f5 commit 2dda7b8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 105 deletions.
25 changes: 0 additions & 25 deletions service-workers/cache-storage/resources/vary.py

This file was deleted.

80 changes: 0 additions & 80 deletions service-workers/cache-storage/script-tests/cache-add.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,84 +267,4 @@ cache_test(function(cache, test) {
'twice.');
}, 'Cache.addAll called with the same Request object specified twice');

cache_test(async function(cache, test) {
const url = '../resources/vary.py?vary=x-shape';
let requests = [
new Request(url, { headers: { 'x-shape': 'circle' }}),
new Request(url, { headers: { 'x-shape': 'square' }}),
];
let result = await cache.addAll(requests);
assert_equals(result, undefined, 'Cache.addAll() should succeed');
}, 'Cache.addAll should succeed when entries differ by vary header');

cache_test(async function(cache, test) {
const url = '../resources/vary.py?vary=x-shape';
let requests = [
new Request(url, { headers: { 'x-shape': 'circle' }}),
new Request(url, { headers: { 'x-shape': 'circle' }}),
];
await promise_rejects(
test,
'InvalidStateError',
cache.addAll(requests),
'Cache.addAll() should reject when entries are duplicate by vary header');
}, 'Cache.addAll should reject when entries are duplicate by vary header');

// VARY header matching is asymmetric. Determining if two entries are duplicate
// depends on which entry's response is used in the comparison. The target
// response's VARY header determines what request headers are examined. This
// test verifies that Cache.addAll() duplicate checking handles this asymmetric
// behavior correctly.
cache_test(async function(cache, test) {
const base_url = '../resources/vary.py';

// Define a request URL that sets a VARY header in the
// query string to be echoed back by the server.
const url = base_url + '?vary=x-size';

// Set a cookie to override the VARY header of the response
// when the request is made with credentials. This will
// take precedence over the query string vary param. This
// is a bit confusing, but it's necessary to construct a test
// where the URL is the same, but the VARY headers differ.
//
// Note, the test could also pass this information in additional
// request headers. If the cookie approach becomes too unwieldy
// this test could be rewritten to use that technique.
await fetch(base_url + '?set-vary-value-override-cookie=x-shape');
test.add_cleanup(_ => fetch(base_url + '?clear-vary-value-override-cookie'));

let requests = [
// This request will result in a Response with a "Vary: x-shape"
// header. This *will not* result in a duplicate match with the
// other entry.
new Request(url, { headers: { 'x-shape': 'circle',
'x-size': 'big' },
credentials: 'same-origin' }),

// This request will result in a Response with a "Vary: x-size"
// header. This *will* result in a duplicate match with the other
// entry.
new Request(url, { headers: { 'x-shape': 'square',
'x-size': 'big' },
credentials: 'omit' }),
];
await promise_rejects(
test,
'InvalidStateError',
cache.addAll(requests),
'Cache.addAll() should reject when one entry has a vary header ' +
'matching an earlier entry.');

// Test the reverse order now.
await promise_rejects(
test,
'InvalidStateError',
cache.addAll(requests.reverse()),
'Cache.addAll() should reject when one entry has a vary header ' +
'matching a later entry.');

}, 'Cache.addAll should reject when one entry has a vary header ' +
'matching another entry');

done();

0 comments on commit 2dda7b8

Please sign in to comment.