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

Unified Diff: Source/modules/serviceworkers/ServiceWorkerContainerClient.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: 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/ServiceWorkerContainerClient.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp b/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp
index fca53dfd79bb8bcd49e3c88883c6e0786021bc9f..3d546eb37d002b50cbac943f6c477c181c806779 100644
--- a/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp
@@ -36,8 +36,10 @@ ServiceWorkerContainerClient* ServiceWorkerContainerClient::from(ExecutionContex
if (client)
return client;
- // If it's not provided yet create it lazily.
- ASSERT(document->frame());
+ if (!document->frame())
+ return 0;
+
+ // If it's not provided yet, create it lazily.
document->page()->provideSupplement(ServiceWorkerContainerClient::supplementName(), ServiceWorkerContainerClient::create(document->frame()->loader().client()->createServiceWorkerProvider()));
return static_cast<ServiceWorkerContainerClient*>(Supplement<Page>::from(document->page(), supplementName()));
}

Powered by Google App Engine
This is Rietveld 408576698