| Index: third_party/WebKit/Source/core/loader/appcache/ApplicationCache.cpp
|
| diff --git a/third_party/WebKit/Source/core/loader/appcache/ApplicationCache.cpp b/third_party/WebKit/Source/core/loader/appcache/ApplicationCache.cpp
|
| index f76fbe11fe0e5f4a6428024c668a451f4d86ad59..84db691bc78c415a25ddc1a76e746eb246fcda7a 100644
|
| --- a/third_party/WebKit/Source/core/loader/appcache/ApplicationCache.cpp
|
| +++ b/third_party/WebKit/Source/core/loader/appcache/ApplicationCache.cpp
|
| @@ -29,7 +29,10 @@
|
| #include "core/dom/Document.h"
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/events/EventListener.h"
|
| +#include "core/frame/Deprecation.h"
|
| #include "core/frame/LocalFrame.h"
|
| +#include "core/frame/OriginsUsingFeatures.h"
|
| +#include "core/frame/UseCounter.h"
|
| #include "core/loader/DocumentLoader.h"
|
| #include "core/loader/FrameLoader.h"
|
|
|
| @@ -65,6 +68,7 @@ ApplicationCacheHost* ApplicationCache::applicationCacheHost() const
|
|
|
| unsigned short ApplicationCache::status() const
|
| {
|
| + recordAPIUseType();
|
| ApplicationCacheHost* cacheHost = applicationCacheHost();
|
| if (!cacheHost)
|
| return ApplicationCacheHost::UNCACHED;
|
| @@ -73,6 +77,7 @@ unsigned short ApplicationCache::status() const
|
|
|
| void ApplicationCache::update(ExceptionState& exceptionState)
|
| {
|
| + recordAPIUseType();
|
| ApplicationCacheHost* cacheHost = applicationCacheHost();
|
| if (!cacheHost || !cacheHost->update())
|
| exceptionState.throwDOMException(InvalidStateError, "there is no application cache to update.");
|
| @@ -80,6 +85,7 @@ void ApplicationCache::update(ExceptionState& exceptionState)
|
|
|
| void ApplicationCache::swapCache(ExceptionState& exceptionState)
|
| {
|
| + recordAPIUseType();
|
| ApplicationCacheHost* cacheHost = applicationCacheHost();
|
| if (!cacheHost || !cacheHost->swapCache())
|
| exceptionState.throwDOMException(InvalidStateError, "there is no newer application cache to swap to.");
|
| @@ -128,4 +134,24 @@ const AtomicString& ApplicationCache::toEventType(ApplicationCacheHost::EventID
|
| return EventTypeNames::error;
|
| }
|
|
|
| +void ApplicationCache::recordAPIUseType() const
|
| +{
|
| + if (!m_frame)
|
| + return;
|
| +
|
| + Document* document = m_frame->document();
|
| +
|
| + if (!document)
|
| + return;
|
| +
|
| + if (document->isSecureContext()) {
|
| + UseCounter::count(document, UseCounter::ApplicationCacheAPISecureOrigin);
|
| + UseCounter::countCrossOriginIframe(*document, UseCounter::ApplicationCacheAPISecureOrigin);
|
| + } else {
|
| + Deprecation::countDeprecation(document, UseCounter::ApplicationCacheAPIInsecureOrigin);
|
| + UseCounter::countCrossOriginIframe(*document, UseCounter::ApplicationCacheAPIInsecureOrigin);
|
| + OriginsUsingFeatures::countAnyWorld(*document, OriginsUsingFeatures::Feature::ApplicationCacheAPIInsecureOrigin);
|
| + }
|
| +}
|
| +
|
| } // namespace blink
|
|
|