Index: third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp |
diff --git a/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp b/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp |
index 4dd3c93182a150d9a628185d4e51ab2c6ce50929..a7ba1e195cbfae52f52c670df235da040e11957e 100644 |
--- a/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp |
+++ b/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp |
@@ -13,7 +13,7 @@ |
namespace blink { |
NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator) |
- : ContextLifecycleObserver(navigator.frame() ? navigator.frame()->document() : nullptr) |
+ : DOMWindowProperty(navigator.frame()) |
{ |
} |
@@ -33,7 +33,7 @@ |
provideTo(navigator, supplementName(), supplement); |
if (navigator.frame() && navigator.frame()->securityContext()->getSecurityOrigin()->canAccessServiceWorkers()) { |
// Initialize ServiceWorkerContainer too. |
- supplement->serviceWorker(navigator.frame(), ASSERT_NO_EXCEPTION); |
+ supplement->serviceWorker(ASSERT_NO_EXCEPTION); |
} |
} |
return *supplement; |
@@ -51,27 +51,27 @@ |
ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(ExecutionContext* executionContext, Navigator& navigator, ExceptionState& exceptionState) |
{ |
- DCHECK(!navigator.frame() || executionContext->getSecurityOrigin()->canAccessCheckSuborigins(navigator.frame()->securityContext()->getSecurityOrigin())); |
- return NavigatorServiceWorker::from(navigator).serviceWorker(navigator.frame(), exceptionState); |
+ ASSERT(!navigator.frame() || executionContext->getSecurityOrigin()->canAccessCheckSuborigins(navigator.frame()->securityContext()->getSecurityOrigin())); |
+ return NavigatorServiceWorker::from(navigator).serviceWorker(exceptionState); |
} |
-ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(LocalFrame* frame, ExceptionState& exceptionState) |
+ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(ExceptionState& exceptionState) |
{ |
- if (frame && !frame->securityContext()->getSecurityOrigin()->canAccessServiceWorkers()) { |
- if (frame->securityContext()->isSandboxed(SandboxOrigin)) |
+ if (frame() && !frame()->securityContext()->getSecurityOrigin()->canAccessServiceWorkers()) { |
+ if (frame()->securityContext()->isSandboxed(SandboxOrigin)) |
exceptionState.throwSecurityError("Service worker is disabled because the context is sandboxed and lacks the 'allow-same-origin' flag."); |
else |
exceptionState.throwSecurityError("Access to service workers is denied in this document origin."); |
return nullptr; |
} |
- if (!m_serviceWorker && frame) { |
- DCHECK(frame->domWindow()); |
- m_serviceWorker = ServiceWorkerContainer::create(frame->domWindow()->getExecutionContext()); |
+ if (!m_serviceWorker && frame()) { |
+ ASSERT(frame()->domWindow()); |
+ m_serviceWorker = ServiceWorkerContainer::create(frame()->domWindow()->getExecutionContext()); |
} |
return m_serviceWorker.get(); |
} |
-void NavigatorServiceWorker::contextDestroyed() |
+void NavigatorServiceWorker::willDetachGlobalObjectFromFrame() |
{ |
if (m_serviceWorker) { |
m_serviceWorker->willBeDetachedFromFrame(); |
@@ -83,7 +83,7 @@ |
{ |
visitor->trace(m_serviceWorker); |
Supplement<Navigator>::trace(visitor); |
- ContextLifecycleObserver::trace(visitor); |
+ DOMWindowProperty::trace(visitor); |
} |
} // namespace blink |