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 "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 Loading... |
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 Loading... |
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 |
OLD | NEW |