| Index: Source/core/inspector/InspectorIndexedDBAgent.cpp
|
| diff --git a/Source/core/inspector/InspectorIndexedDBAgent.cpp b/Source/core/inspector/InspectorIndexedDBAgent.cpp
|
| index d1389319a80f49e58ab38dc5ec41e0bfd5dd614e..430dbb80796c0e1d981696aa76537efeb1753842 100644
|
| --- a/Source/core/inspector/InspectorIndexedDBAgent.cpp
|
| +++ b/Source/core/inspector/InspectorIndexedDBAgent.cpp
|
| @@ -32,6 +32,8 @@
|
|
|
| #include "core/inspector/InspectorIndexedDBAgent.h"
|
|
|
| +#include "bindings/v8/ExceptionState.h"
|
| +#include "bindings/v8/ExceptionStatePlaceholder.h"
|
| #include "bindings/v8/ScriptController.h"
|
| #include "core/dom/DOMStringList.h"
|
| #include "core/dom/Document.h"
|
| @@ -109,9 +111,9 @@ public:
|
| }
|
|
|
| IDBRequest* idbRequest = static_cast<IDBRequest*>(event->target());
|
| - ExceptionCode ec = 0;
|
| - RefPtr<IDBAny> requestResult = idbRequest->result(ec);
|
| - if (ec) {
|
| + NonThrowExceptionState es;
|
| + RefPtr<IDBAny> requestResult = idbRequest->result(es);
|
| + if (es.hadException()) {
|
| m_requestCallback->sendFailure("Could not get result in callback.");
|
| return;
|
| }
|
| @@ -171,9 +173,9 @@ public:
|
| }
|
|
|
| IDBOpenDBRequest* idbOpenDBRequest = static_cast<IDBOpenDBRequest*>(event->target());
|
| - ExceptionCode ec = 0;
|
| - RefPtr<IDBAny> requestResult = idbOpenDBRequest->result(ec);
|
| - if (ec) {
|
| + NonThrowExceptionState es;
|
| + RefPtr<IDBAny> requestResult = idbOpenDBRequest->result(es);
|
| + if (es.hadException()) {
|
| m_executableWithDatabase->requestCallback()->sendFailure("Could not get result in callback.");
|
| return;
|
| }
|
| @@ -198,9 +200,9 @@ private:
|
| void ExecutableWithDatabase::start(IDBFactory* idbFactory, SecurityOrigin*, const String& databaseName)
|
| {
|
| RefPtr<OpenDatabaseCallback> callback = OpenDatabaseCallback::create(this);
|
| - ExceptionCode ec = 0;
|
| - RefPtr<IDBOpenDBRequest> idbOpenDBRequest = idbFactory->open(context(), databaseName, ec);
|
| - if (ec) {
|
| + NonThrowExceptionState es;
|
| + RefPtr<IDBOpenDBRequest> idbOpenDBRequest = idbFactory->open(context(), databaseName, es);
|
| + if (es.hadException()) {
|
| requestCallback()->sendFailure("Could not open database.");
|
| return;
|
| }
|
| @@ -209,27 +211,27 @@ void ExecutableWithDatabase::start(IDBFactory* idbFactory, SecurityOrigin*, cons
|
|
|
| static PassRefPtr<IDBTransaction> transactionForDatabase(ScriptExecutionContext* scriptExecutionContext, IDBDatabase* idbDatabase, const String& objectStoreName, const String& mode = IDBTransaction::modeReadOnly())
|
| {
|
| - ExceptionCode ec = 0;
|
| - RefPtr<IDBTransaction> idbTransaction = idbDatabase->transaction(scriptExecutionContext, objectStoreName, mode, ec);
|
| - if (ec)
|
| + NonThrowExceptionState es;
|
| + RefPtr<IDBTransaction> idbTransaction = idbDatabase->transaction(scriptExecutionContext, objectStoreName, mode, es);
|
| + if (es.hadException())
|
| return 0;
|
| return idbTransaction;
|
| }
|
|
|
| static PassRefPtr<IDBObjectStore> objectStoreForTransaction(IDBTransaction* idbTransaction, const String& objectStoreName)
|
| {
|
| - ExceptionCode ec = 0;
|
| - RefPtr<IDBObjectStore> idbObjectStore = idbTransaction->objectStore(objectStoreName, ec);
|
| - if (ec)
|
| + NonThrowExceptionState es;
|
| + RefPtr<IDBObjectStore> idbObjectStore = idbTransaction->objectStore(objectStoreName, es);
|
| + if (es.hadException())
|
| return 0;
|
| return idbObjectStore;
|
| }
|
|
|
| static PassRefPtr<IDBIndex> indexForObjectStore(IDBObjectStore* idbObjectStore, const String& indexName)
|
| {
|
| - ExceptionCode ec = 0;
|
| - RefPtr<IDBIndex> idbIndex = idbObjectStore->index(indexName, ec);
|
| - if (ec)
|
| + NonThrowExceptionState es;
|
| + RefPtr<IDBIndex> idbIndex = idbObjectStore->index(indexName, es);
|
| + if (es.hadException())
|
| return 0;
|
| return idbIndex;
|
| }
|
| @@ -415,9 +417,9 @@ public:
|
| }
|
|
|
| IDBRequest* idbRequest = static_cast<IDBRequest*>(event->target());
|
| - ExceptionCode ec = 0;
|
| - RefPtr<IDBAny> requestResult = idbRequest->result(ec);
|
| - if (ec) {
|
| + NonThrowExceptionState es;
|
| + RefPtr<IDBAny> requestResult = idbRequest->result(es);
|
| + if (es.hadException()) {
|
| m_requestCallback->sendFailure("Could not get result in callback.");
|
| return;
|
| }
|
| @@ -433,9 +435,9 @@ public:
|
| RefPtr<IDBCursorWithValue> idbCursor = requestResult->idbCursorWithValue();
|
|
|
| if (m_skipCount) {
|
| - ExceptionCode ec = 0;
|
| - idbCursor->advance(m_skipCount, ec);
|
| - if (ec)
|
| + NonThrowExceptionState es;
|
| + idbCursor->advance(m_skipCount, es);
|
| + if (es.hadException())
|
| m_requestCallback->sendFailure("Could not advance cursor.");
|
| m_skipCount = 0;
|
| return;
|
| @@ -447,8 +449,8 @@ public:
|
| }
|
|
|
| // Continue cursor before making injected script calls, otherwise transaction might be finished.
|
| - idbCursor->continueFunction(0, ec);
|
| - if (ec) {
|
| + idbCursor->continueFunction(0, es);
|
| + if (es.hadException()) {
|
| m_requestCallback->sendFailure("Could not continue cursor.");
|
| return;
|
| }
|
| @@ -512,7 +514,6 @@ public:
|
|
|
| RefPtr<OpenCursorCallback> openCursorCallback = OpenCursorCallback::create(m_injectedScript, m_requestCallback, m_skipCount, m_pageSize);
|
|
|
| - ExceptionCode ec = 0;
|
| RefPtr<IDBRequest> idbRequest;
|
| if (!m_indexName.isEmpty()) {
|
| RefPtr<IDBIndex> idbIndex = indexForObjectStore(idbObjectStore.get(), m_indexName);
|
| @@ -521,9 +522,10 @@ public:
|
| return;
|
| }
|
|
|
| - idbRequest = idbIndex->openCursor(context(), PassRefPtr<IDBKeyRange>(m_idbKeyRange), IDBCursor::directionNext(), ec);
|
| - } else
|
| - idbRequest = idbObjectStore->openCursor(context(), PassRefPtr<IDBKeyRange>(m_idbKeyRange), IDBCursor::directionNext(), ec);
|
| + idbRequest = idbIndex->openCursor(context(), PassRefPtr<IDBKeyRange>(m_idbKeyRange), IDBCursor::directionNext(), IGNORE_EXCEPTION_STATE);
|
| + } else {
|
| + idbRequest = idbObjectStore->openCursor(context(), PassRefPtr<IDBKeyRange>(m_idbKeyRange), IDBCursor::directionNext(), IGNORE_EXCEPTION_STATE);
|
| + }
|
| idbRequest->addEventListener(eventNames().successEvent, openCursorCallback, false);
|
| }
|
|
|
| @@ -623,9 +625,9 @@ void InspectorIndexedDBAgent::requestDatabaseNames(ErrorString* errorString, con
|
| ASSERT(!context.IsEmpty());
|
| v8::Context::Scope contextScope(context);
|
|
|
| - ExceptionCode ec = 0;
|
| - RefPtr<IDBRequest> idbRequest = idbFactory->getDatabaseNames(document, ec);
|
| - if (ec) {
|
| + NonThrowExceptionState es;
|
| + RefPtr<IDBRequest> idbRequest = idbFactory->getDatabaseNames(document, es);
|
| + if (es.hadException()) {
|
| requestCallback->sendFailure("Could not obtain database names.");
|
| return;
|
| }
|
| @@ -747,10 +749,11 @@ public:
|
| return;
|
| }
|
|
|
| - ExceptionCode ec = 0;
|
| - RefPtr<IDBRequest> idbRequest = idbObjectStore->clear(context(), ec);
|
| - ASSERT(!ec);
|
| - if (ec) {
|
| + NonThrowExceptionState es;
|
| + RefPtr<IDBRequest> idbRequest = idbObjectStore->clear(context(), es);
|
| + ASSERT(!es.hadException());
|
| + if (es.hadException()) {
|
| + ExceptionCode ec = es;
|
| m_requestCallback->sendFailure(String::format("Could not clear object store '%s': %d", m_objectStoreName.utf8().data(), ec));
|
| return;
|
| }
|
|
|