Index: Source/modules/serviceworkers/polyfills/cachePolyfill.js |
diff --git a/Source/modules/serviceworkers/polyfills/cachePolyfill.js b/Source/modules/serviceworkers/polyfills/cachePolyfill.js |
index a862886b300b263e07552ac9062c9041056cb76d..297af78c2793060f7e1e0dab6e0ae8a5a7c34e98 100644 |
--- a/Source/modules/serviceworkers/polyfills/cachePolyfill.js |
+++ b/Source/modules/serviceworkers/polyfills/cachePolyfill.js |
@@ -64,8 +64,17 @@ |
}); |
}; |
- // FIXME: Implement this. |
- Cache.prototype.add = Promise.reject.bind(Promise, 'Cache.prototype.add() not implemented.'); |
+ Cache.prototype.add = function(request) { |
+ var that = this; |
+ request = _castToRequest(request); |
+ return new Promise(function (resolve, reject) { |
+ fetch(request).then( |
+ function(response) { |
+ that.put(request, response).then(resolve); |
+ }, |
+ reject); |
+ }); |
+ }; |
// FIXME: Add QueryParams argument. |
Cache.prototype.delete = function(request) { |