[Chromium] Some WebSQLDatabase in worker bug fixes.
authormichaeln@google.com <michaeln@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Oct 2011 07:16:21 +0000 (07:16 +0000)
committermichaeln@google.com <michaeln@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Oct 2011 07:16:21 +0000 (07:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70071

- Test for a NULL webView WebWorkerClientImpl.
- Avoid altering Database instance lifetimes during WorkerThread::stop().

Source/WebCore:

Existing tests coverage applies.

Reviewed by David Levin.

* storage/chromium/DatabaseTrackerChromium.cpp:
(WebCore::DatabaseTracker::interruptAllDatabasesForContext):

Source/WebKit/chromium:

Reviewed by David Levin.

* src/WebWorkerClientImpl.cpp:
(WebKit::WebWorkerClientImpl::allowFileSystem):
(WebKit::WebWorkerClientImpl::allowDatabase):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97546 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/storage/chromium/DatabaseTrackerChromium.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebWorkerClientImpl.cpp

index cef890c..c5fd294 100644 (file)
@@ -1,3 +1,18 @@
+2011-10-15  Michael Nordman  <michaeln@google.com>
+
+        [Chromium] Some WebSQLDatabase in worker bug fixes.
+        https://bugs.webkit.org/show_bug.cgi?id=70071
+
+        - Test for a NULL webView WebWorkerClientImpl.
+        - Avoid altering Database instance lifetimes during WorkerThread::stop().
+
+        Existing tests coverage applies.
+
+        Reviewed by David Levin.
+
+        * storage/chromium/DatabaseTrackerChromium.cpp:
+        (WebCore::DatabaseTracker::interruptAllDatabasesForContext):
+
 2011-10-14  Adam Barth  <abarth@webkit.org>
 
         Update expected results.
index 11686d3..5ece385 100644 (file)
@@ -189,31 +189,24 @@ unsigned long long DatabaseTracker::getMaxSizeForDatabase(const AbstractDatabase
 
 void DatabaseTracker::interruptAllDatabasesForContext(const ScriptExecutionContext* context)
 {
-    Vector<RefPtr<AbstractDatabase> > openDatabases;
-    {
-        MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
-
-        if (!m_openDatabaseMap)
-            return;
-
-        DatabaseNameMap* nameMap = m_openDatabaseMap->get(context->securityOrigin()->databaseIdentifier());
-        if (!nameMap)
-            return;
-
-        DatabaseNameMap::const_iterator dbNameMapEndIt = nameMap->end();
-        for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameMapIt != dbNameMapEndIt; ++dbNameMapIt) {
-            DatabaseSet* databaseSet = dbNameMapIt->second;
-            DatabaseSet::const_iterator dbSetEndIt = databaseSet->end();
-            for (DatabaseSet::const_iterator dbSetIt = databaseSet->begin(); dbSetIt != dbSetEndIt; ++dbSetIt) {
-                if ((*dbSetIt)->scriptExecutionContext() == context)
-                    openDatabases.append(*dbSetIt);
-            }
+    MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
+
+    if (!m_openDatabaseMap)
+        return;
+
+    DatabaseNameMap* nameMap = m_openDatabaseMap->get(context->securityOrigin()->databaseIdentifier());
+    if (!nameMap)
+        return;
+
+    DatabaseNameMap::const_iterator dbNameMapEndIt = nameMap->end();
+    for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameMapIt != dbNameMapEndIt; ++dbNameMapIt) {
+        DatabaseSet* databaseSet = dbNameMapIt->second;
+        DatabaseSet::const_iterator end = databaseSet->end();
+        for (DatabaseSet::const_iterator it = databaseSet->begin(); it != end; ++it) {
+            if ((*it)->scriptExecutionContext() == context)
+                (*it)->interrupt();
         }
     }
-
-    Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesEndIt = openDatabases.end();
-    for (Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesIt = openDatabases.begin(); openDatabasesIt != openDatabasesEndIt; ++openDatabasesIt)
-        (*openDatabasesIt)->interrupt();
 }
 
 }
index a60d03c..e5c20de 100644 (file)
@@ -1,3 +1,17 @@
+2011-10-15  Michael Nordman  <michaeln@google.com>
+
+        [Chromium] Some WebSQLDatabase in worker bug fixes.
+        https://bugs.webkit.org/show_bug.cgi?id=70071
+
+        - Test for a NULL webView WebWorkerClientImpl.
+        - Avoid altering Database instance lifetimes during WorkerThread::stop().
+
+        Reviewed by David Levin.
+
+        * src/WebWorkerClientImpl.cpp:
+        (WebKit::WebWorkerClientImpl::allowFileSystem):
+        (WebKit::WebWorkerClientImpl::allowDatabase):
+
 2011-10-14  Darin Adler  <darin@apple.com>
 
        Try to fix Chromium build.
index 9682973..ea63812 100644 (file)
@@ -193,6 +193,8 @@ void WebWorkerClientImpl::workerContextDestroyed()
 bool WebWorkerClientImpl::allowFileSystem() 
 {
     WebKit::WebViewImpl* webView = m_webFrame->viewImpl();
+    if (!webView)
+        return false;
     return !webView->permissionClient() || webView->permissionClient()->allowFileSystem(m_webFrame);
 }
 
@@ -204,8 +206,10 @@ void WebWorkerClientImpl::openFileSystem(WebFileSystem::Type type, long long siz
 
 bool WebWorkerClientImpl::allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) 
 {
-     WebKit::WebViewImpl* webView = m_webFrame->viewImpl();
-     return !webView->permissionClient() || webView->permissionClient()->allowDatabase(m_webFrame, name, displayName, estimatedSize);
+    WebKit::WebViewImpl* webView = m_webFrame->viewImpl();
+    if (!webView)
+        return false;
+    return !webView->permissionClient() || webView->permissionClient()->allowDatabase(m_webFrame, name, displayName, estimatedSize);
 }
  
 void WebWorkerClientImpl::dispatchDevToolsMessage(const WebString& message)