PageSourceSearch

https://www.texasfootball.com/js/libs/serviceworker-cache-polyfill.js

js texasfootball.com collected 2026-09-24 09:17:13 UTC 2,283 bytes, 83 lines download raw bytes

1if ( !Cache.prototype.add ) {
2	Cache.prototype.add = function add( request ) {
3		return this.addAll( [request] );
4	};
5}
6
7if ( !Cache.prototype.addAll ) {
8	Cache.prototype.addAll = function addAll( requests ) {
9		var cache = this;
10
11		// Since DOMExceptions are not constructable:
12		function NetworkError( message ) {
13			this.name = 'NetworkError';
14			this.code = 19;
15			this.message = message;
16		}
17		NetworkError.prototype = Object.create( Error.prototype );
18
19		return Promise.resolve().then( function() {
20			if ( arguments.length < 1 ) throw new TypeError();
21
22			// Simulate sequence<(Request or USVString)> binding:
23			var sequence = [];
24
25			requests = requests.map( function( request ) {
26				if ( request instanceof Request ) {
27					return request;
28				}
29				else {
30					return String( request ); // may throw TypeError
31				}
32			} );
33
34			return Promise.all(
35			  requests.map( function( request ) {
36			  	if ( typeof request === 'string' ) {
37			  		request = new Request( request );
38			  	}
39
40			  	var scheme = new URL( request.url ).protocol;
41
42			  	if ( scheme !== 'http:' && scheme !== 'https:' ) {
43			  		throw new NetworkError( "Invalid scheme" );
44			  	}
45
46			  	return fetch( request.clone() );
47			  } )
48			);
49		} ).then( function( responses ) {
50			// TODO: check that requests don't overwrite one another
51			// (don't think this is possible to polyfill due to opaque responses)
52			return Promise.all(
53			  responses.map( function( response, i ) {
54			  	return cache.put( requests[i], response );
55			  } )
56			);
57		} ).then( function() {
58			return undefined;
59		} );
60	};
61}
62
63if ( !CacheStorage.prototype.match ) {
64	// This is probably vulnerable to race conditions (removing caches etc)
65	CacheStorage.prototype.match = function match( request, opts ) {
66		var caches = this;
67
68		return this.keys().then( function( cacheNames ) {
69			var match;
70
71			return cacheNames.reduce( function( chain, cacheName ) {
72				return chain.then( function() {
73					return match || caches.open( cacheName ).then( function( cache ) {
74						return cache.match( request, opts );
75					} ).then( function( response ) {
76						match = response;
77						return match;
78					} );
79				} );
80			}, Promise.resolve() );
81		} );
82	};
83}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.