diff options
author | jsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 19:24:15 +0000 |
---|---|---|
committer | jsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 19:24:15 +0000 |
commit | cd417d99eaebfd5617499397153d0d1a7bec7685 (patch) | |
tree | 961ec00d06dfcdbbb48f384fb80b07fc834462ad | |
parent | 9a63ca428ec58dd996c68ed5074f8346a98240cc (diff) | |
download | chromium_src-cd417d99eaebfd5617499397153d0d1a7bec7685.zip chromium_src-cd417d99eaebfd5617499397153d0d1a7bec7685.tar.gz chromium_src-cd417d99eaebfd5617499397153d0d1a7bec7685.tar.bz2 |
Handled failed IDB object lookup in IPC.
In the IPC dispatcher code (both renderer and browser), handle failed IDB object lookups, which can occur when the document is being torn down or closed.
BUG=104492
TEST=
Review URL: http://codereview.chromium.org/8486023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111740 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/in_process_webkit/indexed_db_dispatcher_host.cc | 4 | ||||
-rw-r--r-- | content/renderer/indexed_db_dispatcher.cc | 25 |
2 files changed, 27 insertions, 2 deletions
diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc index 953445c..e4abb51 100644 --- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -467,6 +467,8 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen( int32 idb_database_id, int32 response_id) { WebIDBDatabase* database = parent_->GetOrTerminateProcess( &map_, idb_database_id); + if (!database) + return; database->open(new IndexedDBDatabaseCallbacks(parent_, response_id)); } @@ -474,6 +476,8 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( int32 idb_database_id) { WebIDBDatabase* database = parent_->GetOrTerminateProcess( &map_, idb_database_id); + if (!database) + return; database->close(); } diff --git a/content/renderer/indexed_db_dispatcher.cc b/content/renderer/indexed_db_dispatcher.cc index 7fd0954..915275f 100644 --- a/content/renderer/indexed_db_dispatcher.cc +++ b/content/renderer/indexed_db_dispatcher.cc @@ -392,6 +392,8 @@ int32 IndexedDBDispatcher::TransactionId( void IndexedDBDispatcher::OnSuccessIDBDatabase(int32 response_id, int32 object_id) { WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); + if (!callbacks) + return; callbacks->onSuccess(new RendererWebIDBDatabaseImpl(object_id)); pending_callbacks_.Remove(response_id); } @@ -399,6 +401,8 @@ void IndexedDBDispatcher::OnSuccessIDBDatabase(int32 response_id, void IndexedDBDispatcher::OnSuccessIndexedDBKey(int32 response_id, const IndexedDBKey& key) { WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); + if (!callbacks) + return; callbacks->onSuccess(key); pending_callbacks_.Remove(response_id); } @@ -406,6 +410,8 @@ void IndexedDBDispatcher::OnSuccessIndexedDBKey(int32 response_id, void IndexedDBDispatcher::OnSuccessIDBTransaction(int32 response_id, int32 object_id) { WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); + if (!callbacks) + return; callbacks->onSuccess(new RendererWebIDBTransactionImpl(object_id)); pending_callbacks_.Remove(response_id); } @@ -413,6 +419,8 @@ void IndexedDBDispatcher::OnSuccessIDBTransaction(int32 response_id, void IndexedDBDispatcher::OnSuccessStringList( int32 response_id, const std::vector<string16>& value) { WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); + if (!callbacks) + return; WebDOMStringList string_list; for (std::vector<string16>::const_iterator it = value.begin(); it != value.end(); ++it) @@ -424,6 +432,8 @@ void IndexedDBDispatcher::OnSuccessStringList( void IndexedDBDispatcher::OnSuccessSerializedScriptValue( int32 response_id, const content::SerializedScriptValue& value) { WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); + if (!callbacks) + return; callbacks->onSuccess(value); pending_callbacks_.Remove(response_id); } @@ -433,6 +443,8 @@ void IndexedDBDispatcher::OnSuccessOpenCursor(int32 repsonse_id, const content::SerializedScriptValue& value) { WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(repsonse_id); + if (!callbacks) + return; RendererWebIDBCursorImpl* cursor = new RendererWebIDBCursorImpl(object_id); cursors_[object_id] = cursor; @@ -453,6 +465,8 @@ void IndexedDBDispatcher::OnSuccessCursorContinue( cursor->SetKeyAndValue(key, primary_key, value); WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); + if (!callbacks) + return; callbacks->onSuccessWithContinuation(); pending_callbacks_.Remove(response_id); @@ -466,6 +480,8 @@ void IndexedDBDispatcher::OnBlocked(int32 response_id) { void IndexedDBDispatcher::OnError(int32 response_id, int code, const string16& message) { WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); + if (!callbacks) + return; callbacks->onError(WebIDBDatabaseError(code, message)); pending_callbacks_.Remove(response_id); } @@ -473,6 +489,8 @@ void IndexedDBDispatcher::OnError(int32 response_id, int code, void IndexedDBDispatcher::OnAbort(int32 transaction_id) { WebIDBTransactionCallbacks* callbacks = pending_transaction_callbacks_.Lookup(transaction_id); + if (!callbacks) + return; callbacks->onAbort(); pending_transaction_callbacks_.Remove(transaction_id); } @@ -480,6 +498,8 @@ void IndexedDBDispatcher::OnAbort(int32 transaction_id) { void IndexedDBDispatcher::OnComplete(int32 transaction_id) { WebIDBTransactionCallbacks* callbacks = pending_transaction_callbacks_.Lookup(transaction_id); + if (!callbacks) + return; callbacks->onComplete(); pending_transaction_callbacks_.Remove(transaction_id); } @@ -490,6 +510,7 @@ void IndexedDBDispatcher::OnVersionChange(int32 database_id, pending_database_callbacks_.Lookup(database_id); // callbacks would be NULL if a versionchange event is received after close // has been called. - if (callbacks) - callbacks->onVersionChange(newVersion); + if (!callbacks) + return; + callbacks->onVersionChange(newVersion); } |