Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: Source/modules/serviceworkers/polyfills/cachePolyfill.js

Issue 329433002: Initial ServiceWorker CacheStorage API polyfill. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: clear to land Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A simple, incomplete implementation of the Cache API, intended to facilitate 5 // A simple, incomplete implementation of the Cache API, intended to facilitate
6 // end to end serviceworker testing. 6 // end to end serviceworker testing.
7 7
8 // See https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.htm l#cache 8 // See https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.htm l#cache-objects
9 9
10 // FIXME: Support AbstractResponse/OpaqueResponse correctly. 10 // FIXME: Support AbstractResponse/OpaqueResponse correctly.
11 // FIXME: Serialize the cache. 11 // FIXME: Serialize the cache.
12 // FIXME: Implement CacheStorage API.
13 // FIXME: Bind all function references. 12 // FIXME: Bind all function references.
14 (function(global) { 13 (function(global) {
15 var _castToRequest = function(item) { 14 var _castToRequest = function(item) {
16 if (typeof item === 'string') { 15 if (typeof item === 'string') {
17 item = new Request({ 16 item = new Request({
18 url: item, 17 url: item,
19 }); 18 });
20 } 19 }
21 return item; 20 return item;
22 }; 21 };
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 var entry = entriesByUrl[request.url]; 111 var entry = entriesByUrl[request.url];
113 resolve(entry); 112 resolve(entry);
114 }); 113 });
115 }; 114 };
116 115
117 // FIXME: Implement this. 116 // FIXME: Implement this.
118 Cache.prototype.matchAll = Promise.reject.bind(Promise, 'Cache.prototype.mat chAll not implemented.'); 117 Cache.prototype.matchAll = Promise.reject.bind(Promise, 'Cache.prototype.mat chAll not implemented.');
119 118
120 global.Cache = global.Cache || Cache; 119 global.Cache = global.Cache || Cache;
121 }(self)); // window or worker global scope. 120 }(self)); // window or worker global scope.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698