| 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/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" |
| 11 #include "core/inspector/ConsoleMessage.h" | 11 #include "core/inspector/ConsoleMessage.h" |
| 12 #include "modules/cachestorage/CacheStorageError.h" | 12 #include "modules/cachestorage/CacheStorageError.h" |
| 13 #include "modules/fetch/Request.h" | 13 #include "modules/fetch/Request.h" |
| 14 #include "modules/fetch/Response.h" | 14 #include "modules/fetch/Response.h" |
| 15 #include "platform/RuntimeEnabledFeatures.h" |
| 15 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" | 16 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" |
| 16 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h" | 17 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 DOMException* createNoImplementationException() | 23 DOMException* createNoImplementationException() |
| 23 { | 24 { |
| 24 return DOMException::create(NotSupportedError, "No CacheStorage implementati
on provided."); | 25 return DOMException::create(NotSupportedError, "No CacheStorage implementati
on provided."); |
| 25 } | 26 } |
| 26 | 27 |
| 27 bool commonChecks(ScriptState* scriptState, ExceptionState& exceptionState) | 28 bool commonChecks(ScriptState* scriptState, ExceptionState& exceptionState) |
| 28 { | 29 { |
| 29 ExecutionContext* executionContext = scriptState->executionContext(); | 30 ExecutionContext* executionContext = scriptState->executionContext(); |
| 30 // FIXME: May be null due to worker termination: http://crbug.com/413518. | 31 // FIXME: May be null due to worker termination: http://crbug.com/413518. |
| 31 if (!executionContext) | 32 if (!executionContext) |
| 32 return false; | 33 return false; |
| 33 | 34 |
| 34 String errorMessage; | 35 String errorMessage; |
| 35 if (!executionContext->isSecureContext(errorMessage)) { | 36 if (!executionContext->isSecureContext(errorMessage)) { |
| 36 exceptionState.throwSecurityError(errorMessage); | 37 exceptionState.throwSecurityError(errorMessage); |
| 37 return false; | 38 return false; |
| 38 } | 39 } |
| 39 return true; | 40 return true; |
| 40 } | 41 } |
| 41 | 42 |
| 42 void checkCacheQueryOptions(const CacheQueryOptions& options, ExecutionContext*
context) | 43 void checkCacheQueryOptions(const CacheQueryOptions& options, ExecutionContext*
context) |
| 43 { | 44 { |
| 44 if (options.ignoreSearch()) | 45 if (!RuntimeEnabledFeatures::cacheIgnoreSearchOptionEnabled() && options.ign
oreSearch()) |
| 45 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Cache.match() does not support 'ignoreSearch' option yet. See h
ttp://crbug.com/520784")); | 46 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Cache.match() does not support 'ignoreSearch' option yet. See h
ttp://crbug.com/520784")); |
| 46 if (options.ignoreMethod()) | 47 if (options.ignoreMethod()) |
| 47 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Cache.match() does not support 'ignoreMethod' option yet. See h
ttp://crbug.com/482256")); | 48 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Cache.match() does not support 'ignoreMethod' option yet. See h
ttp://crbug.com/482256")); |
| 48 if (options.ignoreVary()) | 49 if (options.ignoreVary()) |
| 49 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Cache.match() does not support 'ignoreVary' option yet. See htt
p://crbug.com/499216")); | 50 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Cache.match() does not support 'ignoreVary' option yet. See htt
p://crbug.com/499216")); |
| 50 } | 51 } |
| 51 | 52 |
| 52 } | 53 } |
| 53 | 54 |
| 54 // FIXME: Consider using CallbackPromiseAdapter. | 55 // FIXME: Consider using CallbackPromiseAdapter. |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 m_webCacheStorage.clear(); | 340 m_webCacheStorage.clear(); |
| 340 } | 341 } |
| 341 | 342 |
| 342 DEFINE_TRACE(CacheStorage) | 343 DEFINE_TRACE(CacheStorage) |
| 343 { | 344 { |
| 344 visitor->trace(m_scopedFetcher); | 345 visitor->trace(m_scopedFetcher); |
| 345 visitor->trace(m_nameToCacheMap); | 346 visitor->trace(m_nameToCacheMap); |
| 346 } | 347 } |
| 347 | 348 |
| 348 } // namespace blink | 349 } // namespace blink |
| OLD | NEW |