| 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/cachestorage/InspectorCacheStorageAgent.h" | 6 #include "modules/cachestorage/InspectorCacheStorageAgent.h" |
| 7 | 7 |
| 8 #include "core/InspectorBackendDispatcher.h" | 8 #include "core/InspectorBackendDispatcher.h" |
| 9 #include "core/InspectorTypeBuilder.h" | 9 #include "core/InspectorTypeBuilder.h" |
| 10 #include "platform/JSONValues.h" | 10 #include "platform/JSONValues.h" |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 DEFINE_TRACE(InspectorCacheStorageAgent) | 409 DEFINE_TRACE(InspectorCacheStorageAgent) |
| 410 { | 410 { |
| 411 InspectorBaseAgent::trace(visitor); | 411 InspectorBaseAgent::trace(visitor); |
| 412 } | 412 } |
| 413 | 413 |
| 414 void InspectorCacheStorageAgent::requestCacheNames(ErrorString* errorString, con
st String& securityOrigin, PassRefPtrWillBeRawPtr<RequestCacheNamesCallback> cal
lback) | 414 void InspectorCacheStorageAgent::requestCacheNames(ErrorString* errorString, con
st String& securityOrigin, PassRefPtrWillBeRawPtr<RequestCacheNamesCallback> cal
lback) |
| 415 { | 415 { |
| 416 RefPtr<SecurityOrigin> secOrigin = SecurityOrigin::createFromString(security
Origin); | 416 RefPtr<SecurityOrigin> secOrigin = SecurityOrigin::createFromString(security
Origin); |
| 417 | 417 |
| 418 // Cache Storage API is restricted to trustworthy origins. | 418 // Cache Storage API is restricted to trustworthy origins. |
| 419 String ignoredMessage; | 419 if (!secOrigin->isPotentiallyTrustworthy()) { |
| 420 if (!secOrigin->isPotentiallyTrustworthy(ignoredMessage)) { | |
| 421 // Don't treat this as an error, just don't attempt to open and enumerat
e the caches. | 420 // Don't treat this as an error, just don't attempt to open and enumerat
e the caches. |
| 422 callback->sendSuccess(Array<TypeBuilder::CacheStorage::Cache>::create())
; | 421 callback->sendSuccess(Array<TypeBuilder::CacheStorage::Cache>::create())
; |
| 423 return; | 422 return; |
| 424 } | 423 } |
| 425 | 424 |
| 426 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString,
securityOrigin); | 425 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString,
securityOrigin); |
| 427 if (!cache) { | 426 if (!cache) { |
| 428 callback->sendFailure(*errorString); | 427 callback->sendFailure(*errorString); |
| 429 return; | 428 return; |
| 430 } | 429 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(
errorString, cacheId, &cacheName); | 462 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(
errorString, cacheId, &cacheName); |
| 464 if (!cache) { | 463 if (!cache) { |
| 465 callback->sendFailure(*errorString); | 464 callback->sendFailure(*errorString); |
| 466 return; | 465 return; |
| 467 } | 466 } |
| 468 cache->dispatchOpen(new GetCacheForDeleteEntry(request, cacheName, callback)
, WebString(cacheName)); | 467 cache->dispatchOpen(new GetCacheForDeleteEntry(request, cacheName, callback)
, WebString(cacheName)); |
| 469 } | 468 } |
| 470 | 469 |
| 471 | 470 |
| 472 } // namespace blink | 471 } // namespace blink |
| OLD | NEW |