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 73160f042ade6669ce253c8138413baca46ac274..ea09389dd824fe6804084a897e33bf4620136458 100644 |
--- a/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp |
+++ b/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp |
@@ -26,14 +26,16 @@ NavigatorServiceWorker& NavigatorServiceWorker::from(Navigator& navigator) { |
if (!supplement) { |
supplement = new NavigatorServiceWorker(navigator); |
provideTo(navigator, supplementName(), supplement); |
- if (navigator.frame() && |
- navigator.frame() |
- ->securityContext() |
- ->getSecurityOrigin() |
- ->canAccessServiceWorkers()) { |
- // Initialize ServiceWorkerContainer too. |
- supplement->serviceWorker(navigator.frame(), ASSERT_NO_EXCEPTION); |
- } |
+ } |
+ if (navigator.frame() && |
+ navigator.frame() |
+ ->securityContext() |
+ ->getSecurityOrigin() |
+ ->canAccessServiceWorkers()) { |
+ // Ensure ServiceWorkerContainer. It can be cleared regardless of |
+ // |supplement|. See comments in NavigatorServiceWorker::serviceWorker() for |
+ // details. |
+ supplement->serviceWorker(navigator.frame(), ASSERT_NO_EXCEPTION); |
} |
return *supplement; |
} |