Skip to content

Commit

Permalink
Fixed references with links to archived HTML5 standard (#41)
Browse files Browse the repository at this point in the history
* Replaced outdated links with Wayback Machine

Some of the documentation links are no longer working, because the AppCache has also been removed from the HTML standard. (The 404 error page explains that "Links to the multipage version of the specification are unfortunately likely to break over time.")

[Other source files of this project](https://github.com/GoogleChromeLabs/sw-appcache-behavior/blob/main/packages/appcache-polyfill-sw/index.ts#L167) link to a W3C snapshot of the living specification. However, that snapshot (which appears to be the most recent one at the W3C) seems to be too old to contain the specific content referenced from here. Hence, I propose to link to the last existing copy in the Internet Archive (which seems to match the comments in this file).

* Consistent reference with our source file

Updated the reference to be consistent throughout the code, see commit c700922#diff-40410b51384db4d3ef6d50cc67b8944a838633468afcb9177f6b7a52d8e0d429
  • Loading branch information
arneschuldt authored Oct 6, 2021
1 parent b8f8c3b commit 9c6d88c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/appcache-polyfill-sw/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async function noManifestBehavior(event: FetchEvent) {
// there are multiple matches, the longest prefix wins. If there are
// multiple prefixes of the same length in different manifest, then
// the one we access last wins. (This might not match browser behavior.)
// See https://www.w3.org/TR/2011/WD-html5-20110525/offline.html#concept-appcache-matches-fallback
// See https://web.archive.org/web/20201129180031/https://html.spec.whatwg.org/multipage/offline.html#concept-appcache-matches-fallback
const manifestURLToHashes: ManifestURLToHashes =
await storage.get('ManifestURLToHashes');

Expand Down
10 changes: 5 additions & 5 deletions packages/appcache-polyfill-window/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function addToCache(hash: string, urls: Array<string>) {
const cache = await caches.open(hash);

await Promise.all(urls.map(async (url) => {
// See Item 18.3 of https://html.spec.whatwg.org/multipage/browsers.html#downloading-or-updating-an-application-cache
// See Item 18.3 of https://web.archive.org/web/20201129180031/https://html.spec.whatwg.org/multipage/offline.html#downloading-or-updating-an-application-cache
const init: RequestInit = {
credentials: 'include',
headers: [['X-Use-Fetch', 'true']],
Expand All @@ -83,7 +83,7 @@ async function addToCache(hash: string, urls: Array<string>) {
return;
}

// See Item 18.5 of https://html.spec.whatwg.org/multipage/browsers.html#downloading-or-updating-an-application-cache
// See Item 18.5 of https://web.archive.org/web/20201129180031/https://html.spec.whatwg.org/multipage/offline.html#downloading-or-updating-an-application-cache
if (response.status !== 404 && response.status !== 410) {
// Assuming this isn't a 200, 404 or 410, we want the catch to
// trigger, which will cause any previously cached Response for this
Expand All @@ -104,15 +104,15 @@ async function addToCache(hash: string, urls: Array<string>) {
}

async function checkManifestVersion(manifestUrl: string) {
// See Item 4 of https://html.spec.whatwg.org/multipage/browsers.html#downloading-or-updating-an-application-cache
// See Item 4 of https://web.archive.org/web/20201129180031/https://html.spec.whatwg.org/multipage/offline.html#downloading-or-updating-an-application-cache
const init: RequestInit = {
credentials: 'include',
headers: [['X-Use-Fetch', 'true']],
};
const manifestRequest = new Request(manifestUrl, init);

let manifestResponse = await fetch(manifestRequest);
// See Item 6 of https://html.spec.whatwg.org/multipage/offline.html#downloading-or-updating-an-application-cache
// See Item 6 of https://web.archive.org/web/20201129180031/https://html.spec.whatwg.org/multipage/offline.html#downloading-or-updating-an-application-cache
if (manifestResponse.status === 404 || manifestResponse.status === 410) {
// TODO: Double check that this is a reasonable approach.
// If the manifest has explicitly been removed, then remove our saved state
Expand All @@ -122,7 +122,7 @@ async function checkManifestVersion(manifestUrl: string) {
return null;
}

// See https://html.spec.whatwg.org/multipage/offline.html#cache-failure-steps
// See https://web.archive.org/web/20201129180031/https://html.spec.whatwg.org/multipage/offline.html#cache-failure-steps
if (manifestResponse.status !== 200) {
// TODO: Double check that this is a reasonable approach.
// For non-200/404/410 responses, just abort.
Expand Down

0 comments on commit 9c6d88c

Please sign in to comment.