OLD | NEW |
---|---|
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 #include "config.h" | 5 #include "config.h" |
6 #include "modules/serviceworkers/Cache.h" | 6 #include "modules/serviceworkers/Cache.h" |
7 | 7 |
8 #include "bindings/core/v8/Dictionary.h" | |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
11 #include "bindings/core/v8/V8ThrowException.h" | |
12 #include "core/dom/DOMException.h" | |
13 #include "modules/serviceworkers/Request.h" | |
14 #include "modules/serviceworkers/Response.h" | |
15 #include "public/platform/WebServiceWorkerCache.h" | |
10 | 16 |
11 namespace blink { | 17 namespace blink { |
12 | 18 |
13 namespace { | 19 namespace { |
14 | 20 |
21 const char* cacheErrorToString(WebServiceWorkerCacheError reason) | |
22 { | |
23 // FIXME: Construct correct DOM error objects rather than returning strings. | |
24 switch (reason) { | |
25 case WebServiceWorkerCacheError::WebServiceWorkerCacheErrorNotImplemented: | |
26 return "not implemented"; | |
27 case WebServiceWorkerCacheError::WebServiceWorkerCacheErrorNotFound: | |
28 return "not found"; | |
29 case WebServiceWorkerCacheError::WebServiceWorkerCacheErrorExists: | |
30 return "entry already exists"; | |
31 default: | |
32 ASSERT_NOT_REACHED(); | |
33 return "unknown error"; | |
34 } | |
35 } | |
36 | |
37 WebServiceWorkerCache::QueryParams queryParamsFromDictionary(const Dictionary& d ictionary) | |
38 { | |
39 WebServiceWorkerCache::QueryParams queryParams; | |
40 DictionaryHelper::get(dictionary, "ignoreSearch", queryParams.ignoreSearch); | |
41 DictionaryHelper::get(dictionary, "ignoreMethod", queryParams.ignoreMethod); | |
42 DictionaryHelper::get(dictionary, "ignoreVary", queryParams.ignoreVary); | |
43 DictionaryHelper::get(dictionary, "prefixMatch", queryParams.prefixMatch); | |
44 // FIXME: Add cacheName. | |
45 return queryParams; | |
46 } | |
47 | |
48 class CacheMatchCallbacks : public WebServiceWorkerCache::CacheMatchCallbacks { | |
49 WTF_MAKE_NONCOPYABLE(CacheMatchCallbacks); | |
50 public: | |
51 CacheMatchCallbacks(PassRefPtr<ScriptPromiseResolver> resolver) : m_resolver (resolver) { } | |
52 | |
53 virtual void onSuccess(WebServiceWorkerResponse* webResponse) OVERRIDE | |
54 { | |
55 m_resolver->resolve(Response::create(*webResponse)); | |
56 m_resolver.clear(); | |
57 } | |
58 | |
59 virtual void onError(WebServiceWorkerCacheError* reason) OVERRIDE | |
60 { | |
61 m_resolver->reject(cacheErrorToString(*reason)); | |
62 m_resolver.clear(); | |
63 } | |
64 | |
65 private: | |
66 RefPtr<ScriptPromiseResolver> m_resolver; | |
67 }; | |
68 | |
69 class CacheWithResponsesCallbacks : public WebServiceWorkerCache::CacheWithRespo nsesCallbacks { | |
70 WTF_MAKE_NONCOPYABLE(CacheWithResponsesCallbacks); | |
71 public: | |
72 CacheWithResponsesCallbacks(PassRefPtr<ScriptPromiseResolver> resolver) : m_ resolver(resolver) { } | |
73 | |
74 virtual void onSuccess(WebVector<WebServiceWorkerResponse>* webResponses) OV ERRIDE | |
75 { | |
76 Vector<RefPtrWillBeRawPtr<Response> > responses; | |
77 for (size_t i = 0; i < webResponses->size(); ++i) | |
78 responses.append(Response::create((*webResponses)[i])); | |
79 m_resolver->resolve(responses); | |
80 m_resolver.clear(); | |
81 } | |
82 | |
83 virtual void onError(WebServiceWorkerCacheError* reason) OVERRIDE | |
84 { | |
85 m_resolver->reject(cacheErrorToString(*reason)); | |
86 m_resolver.clear(); | |
87 } | |
88 | |
89 private: | |
90 RefPtr<ScriptPromiseResolver> m_resolver; | |
91 }; | |
92 | |
93 class CacheWithRequestsCallbacks : public WebServiceWorkerCache::CacheWithReques tsCallbacks { | |
94 WTF_MAKE_NONCOPYABLE(CacheWithRequestsCallbacks); | |
95 public: | |
96 CacheWithRequestsCallbacks(PassRefPtr<ScriptPromiseResolver> resolver) : m_r esolver(resolver) { } | |
97 | |
98 virtual void onSuccess(WebVector<WebServiceWorkerRequest>* webRequests) OVER RIDE | |
99 { | |
100 Vector<RefPtrWillBeRawPtr<Request> > requests; | |
101 for (size_t i = 0; i < webRequests->size(); ++i) | |
102 requests.append(Request::create((*webRequests)[i])); | |
103 m_resolver->resolve(requests); | |
104 m_resolver.clear(); | |
105 } | |
106 | |
107 virtual void onError(WebServiceWorkerCacheError* reason) OVERRIDE | |
108 { | |
109 m_resolver->reject(cacheErrorToString(*reason)); | |
110 m_resolver.clear(); | |
111 } | |
112 | |
113 private: | |
114 RefPtr<ScriptPromiseResolver> m_resolver; | |
115 }; | |
116 | |
15 ScriptPromise rejectAsNotImplemented(ScriptState* scriptState) | 117 ScriptPromise rejectAsNotImplemented(ScriptState* scriptState) |
16 { | 118 { |
17 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); | 119 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); |
18 const ScriptPromise promise = resolver->promise(); | 120 const ScriptPromise promise = resolver->promise(); |
19 resolver->reject(DOMException::create(NotSupportedError, "Cache is not imple mented")); | 121 resolver->reject(DOMException::create(NotSupportedError, "Cache is not imple mented")); |
20 return promise; | 122 return promise; |
21 } | 123 } |
22 | 124 |
23 } | 125 } // namespace |
24 | 126 |
25 PassRefPtrWillBeRawPtr<Cache> Cache::fromWebServiceWorkerCache(WebServiceWorkerC ache* webCache) | 127 PassRefPtrWillBeRawPtr<Cache> Cache::fromWebServiceWorkerCache(WebServiceWorkerC ache* webCache) |
26 { | 128 { |
27 return adoptRefWillBeNoop(new Cache(webCache)); | 129 if (Cache* cache = static_cast<Cache*>(webCache->proxyInterface())) |
130 return cache; | |
131 return create(webCache); | |
28 } | 132 } |
29 | 133 |
30 // FIXME: Implement these methods. | 134 Cache::~Cache() |
31 ScriptPromise Cache::match(ScriptState* scriptState, Request* request, const Dic tionary& queryParams) | |
32 { | 135 { |
33 return rejectAsNotImplemented(scriptState); | |
34 } | 136 } |
35 | 137 |
36 ScriptPromise Cache::match(ScriptState* scriptState, const String& requestString , const Dictionary& queryParams) | 138 ScriptPromise Cache::match(ScriptState* scriptState, Request* originalRequest, c onst Dictionary& queryParamsDict) |
37 { | 139 { |
38 return rejectAsNotImplemented(scriptState); | 140 TrackExceptionState exceptionState; |
141 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), originalRequest, exceptionState); | |
142 if (exceptionState.hadException()) | |
143 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
144 // return ScriptPromise::reject(DOMException::create(NotFoundError, " The specified Service Worker resource was not found.")); | |
gavinp
2014/08/28 13:39:36
Sadly, this doesn't work because the type coercion
jsbell
2014/08/28 23:48:45
The bindings code automagically converts throws ex
| |
145 return matchImpl(scriptState, request, queryParamsDict); | |
39 } | 146 } |
40 | 147 |
41 ScriptPromise Cache::matchAll(ScriptState* scriptState, Request* request, const Dictionary& queryParams) | 148 ScriptPromise Cache::match(ScriptState* scriptState, const String& requestString , const Dictionary& queryParamsDict) |
42 { | 149 { |
43 return rejectAsNotImplemented(scriptState); | 150 TrackExceptionState exceptionState; |
151 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), requestString, exceptionState); | |
152 if (exceptionState.hadException()) | |
153 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
154 // return ScriptPromise::reject(DOMException::create(NotFoundError, " The specified Service Worker resource was not found.")); | |
155 return matchImpl(scriptState, request, queryParamsDict); | |
44 } | 156 } |
45 | 157 |
46 ScriptPromise Cache::matchAll(ScriptState* scriptState, const String& requestStr ing, const Dictionary& queryParams) | 158 ScriptPromise Cache::matchAll(ScriptState* scriptState, Request* originalRequest , const Dictionary& queryParamsDict) |
47 { | 159 { |
48 return rejectAsNotImplemented(scriptState); | 160 TrackExceptionState exceptionState; |
161 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), originalRequest, exceptionState); | |
162 if (exceptionState.hadException()) { | |
163 // FIXME: We should throw the caught error. | |
164 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
165 } | |
166 return matchAllImpl(scriptState, request, queryParamsDict); | |
49 } | 167 } |
50 | 168 |
51 ScriptPromise Cache::add(ScriptState* scriptState, Request* request) | 169 ScriptPromise Cache::matchAll(ScriptState* scriptState, const String& requestStr ing, const Dictionary& queryParamsDict) |
52 { | 170 { |
53 return rejectAsNotImplemented(scriptState); | 171 TrackExceptionState exceptionState; |
172 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), requestString, exceptionState); | |
173 if (exceptionState.hadException()) { | |
174 // FIXME: We should throw the caught error. | |
175 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
176 } | |
177 return matchAllImpl(scriptState, request, queryParamsDict); | |
178 } | |
179 | |
180 ScriptPromise Cache::add(ScriptState* scriptState, Request* originalRequest) | |
181 { | |
182 TrackExceptionState exceptionState; | |
183 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), originalRequest, exceptionState); | |
184 if (exceptionState.hadException()) { | |
185 // FIXME: We should throw the caught error. | |
186 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
187 } | |
188 return addImpl(scriptState, request); | |
54 } | 189 } |
55 | 190 |
56 ScriptPromise Cache::add(ScriptState* scriptState, const String& requestString) | 191 ScriptPromise Cache::add(ScriptState* scriptState, const String& requestString) |
57 { | 192 { |
58 return rejectAsNotImplemented(scriptState); | 193 TrackExceptionState exceptionState; |
194 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), requestString, exceptionState); | |
195 if (exceptionState.hadException()) { | |
196 // FIXME: We should throw the caught error. | |
197 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
198 } | |
199 return addImpl(scriptState, request); | |
59 } | 200 } |
60 | 201 |
61 ScriptPromise Cache::addAll(ScriptState* scriptState, const Vector<ScriptValue>& rawRequests) | 202 ScriptPromise Cache::addAll(ScriptState* scriptState, const Vector<ScriptValue>& rawRequests) |
62 { | 203 { |
63 return rejectAsNotImplemented(scriptState); | 204 return rejectAsNotImplemented(scriptState); |
64 } | 205 } |
65 | 206 |
66 ScriptPromise Cache::deleteFunction(ScriptState* scriptState, Request* request, const Dictionary& queryParams) | 207 ScriptPromise Cache::deleteFunction(ScriptState* scriptState, Request* originalR equest, const Dictionary& queryParamsDict) |
208 { | |
209 TrackExceptionState exceptionState; | |
210 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), originalRequest, exceptionState); | |
211 if (exceptionState.hadException()) { | |
212 // FIXME: We should throw the caught error. | |
213 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
214 } | |
215 return deleteImpl(scriptState, request, queryParamsDict); | |
216 } | |
217 | |
218 ScriptPromise Cache::deleteFunction(ScriptState* scriptState, const String& requ estString, const Dictionary& queryParamsDict) | |
219 { | |
220 TrackExceptionState exceptionState; | |
221 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), requestString, exceptionState); | |
222 if (exceptionState.hadException()) { | |
223 // FIXME: We should throw the caught error. | |
224 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
225 } | |
226 return deleteImpl(scriptState, request, queryParamsDict); | |
227 } | |
228 | |
229 ScriptPromise Cache::put(ScriptState* scriptState, Request* originalRequest, Res ponse* response) | |
230 { | |
231 TrackExceptionState exceptionState; | |
232 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), originalRequest, exceptionState); | |
233 if (exceptionState.hadException()) { | |
234 // FIXME: We should throw the caught error. | |
235 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
236 } | |
237 return putImpl(scriptState, request, response); | |
238 } | |
239 | |
240 ScriptPromise Cache::put(ScriptState* scriptState, const String& requestString, Response* response) | |
241 { | |
242 TrackExceptionState exceptionState; | |
243 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), requestString, exceptionState); | |
244 if (exceptionState.hadException()) { | |
245 // FIXME: We should throw the caught error. | |
246 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
247 } | |
248 return putImpl(scriptState, request, response); | |
249 } | |
250 | |
251 ScriptPromise Cache::keys(ScriptState* scriptState) | |
252 { | |
253 return keysImpl(scriptState, RefPtrWillBeRawPtr<Request>(), Dictionary()); | |
254 } | |
255 | |
256 ScriptPromise Cache::keys(ScriptState* scriptState, Request* originalRequest, co nst Dictionary& queryParamsDict) | |
257 { | |
258 TrackExceptionState exceptionState; | |
259 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), originalRequest, exceptionState); | |
260 if (exceptionState.hadException()) { | |
261 // FIXME: We should throw the caught error. | |
262 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
263 } | |
264 return keysImpl(scriptState); | |
265 } | |
266 | |
267 ScriptPromise Cache::keys(ScriptState* scriptState, const String& requestString, const Dictionary& queryParamsDict) | |
268 { | |
269 TrackExceptionState exceptionState; | |
270 RefPtrWillBeRawPtr<Request> request = Request::create(scriptState->execution Context(), requestString, exceptionState); | |
271 if (exceptionState.hadException()) { | |
272 // FIXME: We should throw the caught error. | |
273 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); | |
274 } | |
275 return keysImpl(scriptState, request, queryParamsDict); | |
276 } | |
277 | |
278 Cache::Cache(WebServiceWorkerCache* webCache) : m_webCache(adoptPtr(webCache)) | |
279 { | |
280 ScriptWrappable::init(this); | |
281 ASSERT(m_webCache->proxyInterface() == 0); | |
282 m_webCache->setProxyInterface(this); | |
283 } | |
284 | |
285 PassRefPtrWillBeRawPtr<Cache> Cache::create(WebServiceWorkerCache* webCache) | |
286 { | |
287 return adoptRefWillBeNoop(new Cache(webCache)); | |
288 } | |
289 | |
290 ScriptPromise Cache::matchImpl(ScriptState* scriptState, PassRefPtrWillBeRawPtr< Request> request, const Dictionary& queryParamsDict) | |
291 { | |
292 WebServiceWorkerRequest webRequest; | |
293 request->populateWebServiceWorkerRequest(webRequest); | |
294 | |
295 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); | |
296 const ScriptPromise promise = resolver->promise(); | |
297 m_webCache->dispatchMatch(new CacheMatchCallbacks(resolver), webRequest, que ryParamsFromDictionary(queryParamsDict)); | |
298 return promise; | |
299 } | |
300 | |
301 ScriptPromise Cache::matchAllImpl(ScriptState* scriptState, PassRefPtrWillBeRawP tr<Request> request, const Dictionary& queryParamsDict) | |
302 { | |
303 WebServiceWorkerRequest webRequest; | |
304 request->populateWebServiceWorkerRequest(webRequest); | |
305 | |
306 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); | |
307 const ScriptPromise promise = resolver->promise(); | |
308 m_webCache->dispatchMatchAll(new CacheWithResponsesCallbacks(resolver), webR equest, queryParamsFromDictionary(queryParamsDict)); | |
309 return promise; | |
310 } | |
311 | |
312 ScriptPromise Cache::addImpl(ScriptState* scriptState, PassRefPtrWillBeRawPtr<Re quest>) | |
67 { | 313 { |
68 return rejectAsNotImplemented(scriptState); | 314 return rejectAsNotImplemented(scriptState); |
69 } | 315 } |
70 | 316 |
71 ScriptPromise Cache::deleteFunction(ScriptState* scriptState, const String& requ estString, const Dictionary& queryParams) | 317 ScriptPromise Cache::addAllImpl(ScriptState* scriptState, Vector<RefPtrWillBeRaw Ptr<Request> >) |
72 { | 318 { |
73 return rejectAsNotImplemented(scriptState); | 319 return rejectAsNotImplemented(scriptState); |
74 } | 320 } |
75 | |
76 ScriptPromise Cache::put(ScriptState* scriptState, Request* request, Response*) | |
77 { | |
78 return rejectAsNotImplemented(scriptState); | |
79 } | |
80 | |
81 ScriptPromise Cache::put(ScriptState* scriptState, const String& requestString, Response*) | |
82 { | |
83 return rejectAsNotImplemented(scriptState); | |
84 } | |
85 | |
86 ScriptPromise Cache::keys(ScriptState* scriptState) | |
87 { | |
88 return rejectAsNotImplemented(scriptState); | |
89 } | |
90 | |
91 ScriptPromise Cache::keys(ScriptState* scriptState, Request* request, const Dict ionary& queryParams) | |
92 { | |
93 return rejectAsNotImplemented(scriptState); | |
94 } | |
95 | |
96 ScriptPromise Cache::keys(ScriptState* scriptState, const String& requestString, const Dictionary& queryParams) | |
97 { | |
98 return rejectAsNotImplemented(scriptState); | |
99 } | |
100 | 321 |
101 PassRefPtrWillBeRawPtr<DOMException> Cache::domExceptionForCacheError(WebService WorkerCacheError reason) | 322 PassRefPtrWillBeRawPtr<DOMException> Cache::domExceptionForCacheError(WebService WorkerCacheError reason) |
102 { | 323 { |
103 switch (reason) { | 324 switch (reason) { |
104 case WebServiceWorkerCacheErrorNotImplemented: | 325 case WebServiceWorkerCacheErrorNotImplemented: |
105 return DOMException::create(NotSupportedError, "Method is not implemente d."); | 326 return DOMException::create(NotSupportedError, "Method is not implemente d."); |
106 case WebServiceWorkerCacheErrorNotFound: | 327 case WebServiceWorkerCacheErrorNotFound: |
107 return DOMException::create(NotFoundError, "Entry was not found."); | 328 return DOMException::create(NotFoundError, "Entry was not found."); |
108 case WebServiceWorkerCacheErrorExists: | 329 case WebServiceWorkerCacheErrorExists: |
109 return DOMException::create(InvalidAccessError, "Entry already exists.") ; | 330 return DOMException::create(InvalidAccessError, "Entry already exists.") ; |
110 default: | 331 default: |
111 ASSERT_NOT_REACHED(); | 332 ASSERT_NOT_REACHED(); |
112 return DOMException::create(NotSupportedError, "Unknown error."); | 333 return DOMException::create(NotSupportedError, "Unknown error."); |
113 } | 334 } |
114 } | 335 } |
115 | 336 |
116 Cache::Cache(WebServiceWorkerCache* webCache) : m_webCache(webCache) | 337 ScriptPromise Cache::deleteImpl(ScriptState* scriptState, PassRefPtrWillBeRawPtr <Request> request, const Dictionary& queryParamsDict) |
117 { | 338 { |
118 ScriptWrappable::init(this); | 339 WebVector<WebServiceWorkerCache::BatchOperation> batchOperations(size_t(1)); |
340 batchOperations[0].operationType = WebServiceWorkerCache::WebServiceWorkerCa cheOperationTypeDelete; | |
341 request->populateWebServiceWorkerRequest(batchOperations[0].request); | |
342 batchOperations[0].matchParams = queryParamsFromDictionary(queryParamsDict); | |
343 | |
344 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); | |
345 const ScriptPromise promise = resolver->promise(); | |
346 m_webCache->dispatchBatch(new CacheWithResponsesCallbacks(resolver), batchOp erations); | |
347 return promise; | |
348 } | |
349 | |
350 ScriptPromise Cache::putImpl(ScriptState* scriptState, PassRefPtrWillBeRawPtr<Re quest> request, Response* response) | |
351 { | |
352 WebVector<WebServiceWorkerCache::BatchOperation> batchOperations(size_t(1)); | |
353 batchOperations[0].operationType = WebServiceWorkerCache::WebServiceWorkerCa cheOperationTypePut; | |
354 request->populateWebServiceWorkerRequest(batchOperations[0].request); | |
355 response->populateWebServiceWorkerResponse(batchOperations[0].response); | |
356 | |
357 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); | |
358 const ScriptPromise promise = resolver->promise(); | |
359 m_webCache->dispatchBatch(new CacheWithResponsesCallbacks(resolver), batchOp erations); | |
360 return promise; | |
361 } | |
362 | |
363 ScriptPromise Cache::keysImpl(ScriptState* scriptState) | |
364 { | |
365 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); | |
366 const ScriptPromise promise = resolver->promise(); | |
367 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, WebSer viceWorkerCache::QueryParams()); | |
368 return promise; | |
369 } | |
370 | |
371 ScriptPromise Cache::keysImpl(ScriptState* scriptState, PassRefPtrWillBeRawPtr<R equest> request, const Dictionary& queryParamsDict) | |
372 { | |
373 WebServiceWorkerRequest webRequest; | |
374 request->populateWebServiceWorkerRequest(webRequest); | |
375 | |
376 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); | |
377 const ScriptPromise promise = resolver->promise(); | |
378 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, WebSer viceWorkerCache::QueryParams()); | |
379 return promise; | |
119 } | 380 } |
120 | 381 |
121 } // namespace blink | 382 } // namespace blink |
OLD | NEW |