| 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 a7ba1e195cbfae52f52c670df235da040e11957e..a3fece047dc0363efadd5588b20125833dc6d2bb 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)
|
| - : DOMWindowProperty(navigator.frame())
|
| + : ContextLifecycleObserver(navigator.frame()->document())
|
| {
|
| }
|
|
|
| @@ -33,7 +33,7 @@ NavigatorServiceWorker& NavigatorServiceWorker::from(Navigator& navigator)
|
| provideTo(navigator, supplementName(), supplement);
|
| if (navigator.frame() && navigator.frame()->securityContext()->getSecurityOrigin()->canAccessServiceWorkers()) {
|
| // Initialize ServiceWorkerContainer too.
|
| - supplement->serviceWorker(ASSERT_NO_EXCEPTION);
|
| + supplement->serviceWorker(navigator.frame(), ASSERT_NO_EXCEPTION);
|
| }
|
| }
|
| return *supplement;
|
| @@ -51,27 +51,27 @@ const char* NavigatorServiceWorker::supplementName()
|
|
|
| ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(ExecutionContext* executionContext, Navigator& navigator, ExceptionState& exceptionState)
|
| {
|
| - ASSERT(!navigator.frame() || executionContext->getSecurityOrigin()->canAccessCheckSuborigins(navigator.frame()->securityContext()->getSecurityOrigin()));
|
| - return NavigatorServiceWorker::from(navigator).serviceWorker(exceptionState);
|
| + DCHECK(!navigator.frame() || executionContext->getSecurityOrigin()->canAccessCheckSuborigins(navigator.frame()->securityContext()->getSecurityOrigin()));
|
| + return NavigatorServiceWorker::from(navigator).serviceWorker(navigator.frame(), exceptionState);
|
| }
|
|
|
| -ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(ExceptionState& exceptionState)
|
| +ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(LocalFrame* frame, 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()) {
|
| - ASSERT(frame()->domWindow());
|
| - m_serviceWorker = ServiceWorkerContainer::create(frame()->domWindow()->getExecutionContext());
|
| + if (!m_serviceWorker && frame) {
|
| + DCHECK(frame->domWindow());
|
| + m_serviceWorker = ServiceWorkerContainer::create(frame->domWindow()->getExecutionContext());
|
| }
|
| return m_serviceWorker.get();
|
| }
|
|
|
| -void NavigatorServiceWorker::willDetachGlobalObjectFromFrame()
|
| +void NavigatorServiceWorker::contextDestroyed()
|
| {
|
| if (m_serviceWorker) {
|
| m_serviceWorker->willBeDetachedFromFrame();
|
| @@ -83,7 +83,7 @@ DEFINE_TRACE(NavigatorServiceWorker)
|
| {
|
| visitor->trace(m_serviceWorker);
|
| Supplement<Navigator>::trace(visitor);
|
| - DOMWindowProperty::trace(visitor);
|
| + ContextLifecycleObserver::trace(visitor);
|
| }
|
|
|
| } // namespace blink
|
|
|