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

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

Issue 217023003: Add null checks in navigator.serviceWorker access to fix possible crash (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: reverted iframe change Created 6 years, 9 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: Source/modules/serviceworkers/NavigatorServiceWorker.cpp
diff --git a/Source/modules/serviceworkers/NavigatorServiceWorker.cpp b/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
index a5ddd516e1786a29a08224fc25ff6f7d1167df86..d4068538cffcd18730fd68b633c2fb63d149d7a9 100644
--- a/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
+++ b/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
@@ -53,8 +53,10 @@ ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(ExecutionContext*
void NavigatorServiceWorker::willDetachGlobalObjectFromFrame()
{
- m_serviceWorker->detachClient();
- m_serviceWorker = nullptr;
+ if (m_serviceWorker) {
+ m_serviceWorker->detachClient();
+ m_serviceWorker = nullptr;
+ }
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698