https://bugs.webkit.org/show_bug.cgi?id=78150
Handle case when the frame is shut down under us gracefully.
Patch by Dmitry Lomov <dslomov@chromium.org> on 2012-02-08
Reviewed by David Levin.
* src/DatabaseObserver.cpp:
(WebCore::DatabaseObserver::canEstablishDatabase): Handle WebWorkerBase::view returning 0.
* src/IDBFactoryBackendProxy.cpp:
(WebKit::IDBFactoryBackendProxy::openFromWorker): Handle WebWorkerBase::view returning 0.
* src/WebWorkerClientImpl.cpp:
(WebKit::WebWorkerClientImpl::allowFileSystem):
(WebKit::WebWorkerClientImpl::allowDatabase):
(WebKit::WebWorkerClientImpl::view):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107174
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-08 Dmitry Lomov <dslomov@chromium.org>
+
+ [V8][Chromium] Race between worker accessing WebDatabase and frame closing down.
+ https://bugs.webkit.org/show_bug.cgi?id=78150
+ Handle case when the frame is shut down under us gracefully.
+
+ Reviewed by David Levin.
+
+ * src/DatabaseObserver.cpp:
+ (WebCore::DatabaseObserver::canEstablishDatabase): Handle WebWorkerBase::view returning 0.
+ * src/IDBFactoryBackendProxy.cpp:
+ (WebKit::IDBFactoryBackendProxy::openFromWorker): Handle WebWorkerBase::view returning 0.
+ * src/WebWorkerClientImpl.cpp:
+ (WebKit::WebWorkerClientImpl::allowFileSystem):
+ (WebKit::WebWorkerClientImpl::allowDatabase):
+ (WebKit::WebWorkerClientImpl::view):
+
2012-02-08 Adam Klein <adamk@chromium.org>
DOM mutations should not be delivered on worker threads
WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext);
WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy();
WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy);
- return allowDatabaseForWorker(webWorker->commonClient(), webWorker->view()->mainFrame(), name, displayName, estimatedSize);
+ WebView* view = webWorker->view();
+ if (!view)
+ return false;
+ return allowDatabaseForWorker(webWorker->commonClient(), view->mainFrame(), name, displayName, estimatedSize);
#else
ASSERT_NOT_REACHED();
#endif
}
WorkerLoaderProxy* workerLoaderProxy = &context->thread()->workerLoaderProxy();
WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy);
- WebFrame* webFrame = webWorker->view()->mainFrame();
+ WebView* webView = webWorker->view();
+ if (!webView) {
+ // Frame is closed, worker is terminaring.
+ return;
+ }
+ WebFrame* webFrame = webView->mainFrame();
m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir);
#endif
}
m_proxy->workerContextDestroyed();
}
-bool WebWorkerClientImpl::allowFileSystem()
+bool WebWorkerClientImpl::allowFileSystem()
{
+ if (m_proxy->askedToTerminate())
+ return false;
WebKit::WebViewImpl* webView = m_webFrame->viewImpl();
if (!webView)
return false;
bool WebWorkerClientImpl::allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize)
{
+ if (m_proxy->askedToTerminate())
+ return false;
WebKit::WebViewImpl* webView = m_webFrame->viewImpl();
if (!webView)
return false;
}
WebView* WebWorkerClientImpl::view() const
-{
+{
+ if (m_proxy->askedToTerminate())
+ return 0;
return m_webFrame->view();
}