Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(985)

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp

Issue 2138003002: Remove DOMWindowProperty::willDetachGlobalObjectFromFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..4dd3c93182a150d9a628185d4e51ab2c6ce50929 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() ? navigator.frame()->document() : nullptr)
{
}
@@ -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

Powered by Google App Engine
This is Rietveld 408576698