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

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

Issue 2204573002: Cache API should reject 206 Partial Responses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Give addAll a working resource, to show the whole shebang fails 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/LayoutTests/http/tests/cachestorage/worker/cache-add-expected.txt ('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/Cache.h" 5 #include "modules/cachestorage/Cache.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 if (requests[i]->method() != HTTPNames::GET) { 568 if (requests[i]->method() != HTTPNames::GET) {
569 barrierCallback->onError("Request method '" + requests[i]->method() + "' is unsupported"); 569 barrierCallback->onError("Request method '" + requests[i]->method() + "' is unsupported");
570 return promise; 570 return promise;
571 } 571 }
572 ASSERT(!requests[i]->hasBody()); 572 ASSERT(!requests[i]->hasBody());
573 573
574 if (varyHeaderContainsAsterisk(responses[i])) { 574 if (varyHeaderContainsAsterisk(responses[i])) {
575 barrierCallback->onError("Vary header contains *"); 575 barrierCallback->onError("Vary header contains *");
576 return promise; 576 return promise;
577 } 577 }
578 578 if (responses[i]->status() == 206) {
579 barrierCallback->onError("Partial response (status code 206) is unsu pported");
580 return promise;
581 }
579 if (responses[i]->isBodyLocked() || responses[i]->bodyUsed()) { 582 if (responses[i]->isBodyLocked() || responses[i]->bodyUsed()) {
580 barrierCallback->onError("Response body is already used"); 583 barrierCallback->onError("Response body is already used");
581 return promise; 584 return promise;
582 } 585 }
583 586
584 BodyStreamBuffer* buffer = responses[i]->internalBodyBuffer(); 587 BodyStreamBuffer* buffer = responses[i]->internalBodyBuffer();
585 if (buffer) { 588 if (buffer) {
586 // If the response has body, read the all data and create 589 // If the response has body, read the all data and create
587 // the blob handle and dispatch the put batch asynchronously. 590 // the blob handle and dispatch the put batch asynchronously.
588 FetchDataLoader* loader = FetchDataLoader::createLoaderAsBlobHandle( responses[i]->internalMIMEType()); 591 FetchDataLoader* loader = FetchDataLoader::createLoaderAsBlobHandle( responses[i]->internalMIMEType());
(...skipping 30 matching lines...) Expand all
619 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ ueryParams(options)); 622 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ ueryParams(options));
620 return promise; 623 return promise;
621 } 624 }
622 625
623 WebServiceWorkerCache* Cache::webCache() const 626 WebServiceWorkerCache* Cache::webCache() const
624 { 627 {
625 return m_webCache.get(); 628 return m_webCache.get();
626 } 629 }
627 630
628 } // namespace blink 631 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/cachestorage/worker/cache-add-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698