Cache.addAll() is not as useful if it doesn't take an init argument that fetch() needs to fetch correctly in some cases. addAll() uses fetch() internally and fetch() is overly conservative with credentials defaulting to 'omit' which causes a fetch failure while using web authentication. Currently the only way to work around this is to unroll the addAll() function for the sole reason to pass the more user friendly {'credentials': 'same-origin'} argument to fetch(). If addAll() would accept an init structure then then the init can be passed to fetch().
Please change addAll() and add() to accept an optional init argument to use for fetch(): addAll(requests, init).
Ambient context like fetch credential-mode is the root of w3ctag/design-reviews#76 .
Both add and addAll take Request objects:
cache.addAll(
urls.map(url => new Request(url, { credentials: 'include' }))
);
Most helpful comment
Both
addandaddAlltakeRequestobjects: