| Index: third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
|
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
|
| index 3110a384e6bc5c41b479b2534ac9d77a5ac83f5e..82e8e1eccb0391b90b49a4a8dfcbf68563cbaa06 100644
|
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
|
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBObserver.cpp
|
| @@ -5,12 +5,14 @@
|
| #include "modules/indexeddb/IDBObserver.h"
|
|
|
| #include "bindings/core/v8/ExceptionState.h"
|
| +#include "bindings/core/v8/ExceptionStatePlaceholder.h"
|
| #include "bindings/modules/v8/ToV8ForModules.h"
|
| #include "bindings/modules/v8/V8BindingForModules.h"
|
| +#include "core/dom/ExceptionCode.h"
|
| +#include "modules/indexeddb/IDBDatabase.h"
|
| #include "modules/indexeddb/IDBObserverCallback.h"
|
| #include "modules/indexeddb/IDBObserverChanges.h"
|
| #include "modules/indexeddb/IDBObserverInit.h"
|
| -#include <v8.h>
|
|
|
| namespace blink {
|
|
|
| @@ -29,7 +31,19 @@ IDBObserver::IDBObserver(IDBObserverCallback& callback, const IDBObserverInit& o
|
|
|
| void IDBObserver::observe(IDBDatabase* database, IDBTransaction* transaction, ExceptionState& exceptionState)
|
| {
|
| - // TODO(palakj): Finish implementation.
|
| + if (transaction->isFinished() || transaction->isFinishing()) {
|
| + exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
|
| + return;
|
| + }
|
| + if (!transaction->isActive()) {
|
| + exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
|
| + return;
|
| + }
|
| + if (!database->backend()) {
|
| + exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
|
| + return;
|
| + }
|
| + database->backend()->observe(this, transaction->id());
|
| }
|
|
|
| DEFINE_TRACE(IDBObserver)
|
|
|