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

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: some fixes 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 var entry = entriesByUrl[request.url]; 102 var entry = entriesByUrl[request.url];
104 resolve(entry); 103 resolve(entry);
105 }); 104 });
106 }; 105 };
107 106
108 // FIXME: Implement this. 107 // FIXME: Implement this.
109 Cache.prototype.matchAll = Promise.reject.bind(Promise, 'Cache.prototype.mat chAll not implemented.'); 108 Cache.prototype.matchAll = Promise.reject.bind(Promise, 'Cache.prototype.mat chAll not implemented.');
110 109
111 global.Cache = global.Cache || Cache; 110 global.Cache = global.Cache || Cache;
112 }(self)); // window or worker global scope. 111 }(self)); // window or worker global scope.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698