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

Side by Side Diff: third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp

Issue 2204683002: Cache API should not match() HEAD requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: HEAD -> Head Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/modules/cachestorage/Cache.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "modules/cachestorage/CacheStorage.h" 5 #include "modules/cachestorage/CacheStorage.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 ScriptPromise CacheStorage::matchImpl(ScriptState* scriptState, const Request* r equest, const CacheQueryOptions& options) 314 ScriptPromise CacheStorage::matchImpl(ScriptState* scriptState, const Request* r equest, const CacheQueryOptions& options)
315 { 315 {
316 WebServiceWorkerRequest webRequest; 316 WebServiceWorkerRequest webRequest;
317 request->populateWebServiceWorkerRequest(webRequest); 317 request->populateWebServiceWorkerRequest(webRequest);
318 checkCacheQueryOptions(options, scriptState->getExecutionContext()); 318 checkCacheQueryOptions(options, scriptState->getExecutionContext());
319 319
320 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 320 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
321 const ScriptPromise promise = resolver->promise(); 321 const ScriptPromise promise = resolver->promise();
322 322
323 if (request->method() != HTTPNames::GET && !options.ignoreMethod()) {
324 resolver->resolve();
325 return promise;
326 }
327
323 if (m_webCacheStorage) 328 if (m_webCacheStorage)
324 m_webCacheStorage->dispatchMatch(new MatchCallbacks(resolver), webReques t, Cache::toWebQueryParams(options)); 329 m_webCacheStorage->dispatchMatch(new MatchCallbacks(resolver), webReques t, Cache::toWebQueryParams(options));
325 else 330 else
326 resolver->reject(createNoImplementationException()); 331 resolver->reject(createNoImplementationException());
327 332
328 return promise; 333 return promise;
329 } 334 }
330 335
331 CacheStorage::CacheStorage(GlobalFetch::ScopedFetcher* fetcher, std::unique_ptr< WebServiceWorkerCacheStorage> webCacheStorage) 336 CacheStorage::CacheStorage(GlobalFetch::ScopedFetcher* fetcher, std::unique_ptr< WebServiceWorkerCacheStorage> webCacheStorage)
332 : m_scopedFetcher(fetcher) 337 : m_scopedFetcher(fetcher)
(...skipping 10 matching lines...) Expand all
343 m_webCacheStorage.reset(); 348 m_webCacheStorage.reset();
344 } 349 }
345 350
346 DEFINE_TRACE(CacheStorage) 351 DEFINE_TRACE(CacheStorage)
347 { 352 {
348 visitor->trace(m_scopedFetcher); 353 visitor->trace(m_scopedFetcher);
349 visitor->trace(m_nameToCacheMap); 354 visitor->trace(m_nameToCacheMap);
350 } 355 }
351 356
352 } // namespace blink 357 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/cachestorage/Cache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698