| Index: third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
|
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
|
| index 7c51ae712c1031a3eee5acf5fbd38b9687509b8d..e271a791d2aa439808c60214cae57c419f015651 100644
|
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
|
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
|
| @@ -52,7 +52,6 @@ namespace blink {
|
| IDBRequest* IDBRequest::create(ScriptState* scriptState, IDBAny* source, IDBTransaction* transaction)
|
| {
|
| IDBRequest* request = new IDBRequest(scriptState, source, transaction);
|
| - request->suspendIfNeeded();
|
| // Requests associated with IDBFactory (open/deleteDatabase/getDatabaseNames) are not associated with transactions.
|
| if (transaction)
|
| transaction->registerRequest(request);
|
| @@ -60,7 +59,7 @@ IDBRequest* IDBRequest::create(ScriptState* scriptState, IDBAny* source, IDBTran
|
| }
|
|
|
| IDBRequest::IDBRequest(ScriptState* scriptState, IDBAny* source, IDBTransaction* transaction)
|
| - : ActiveDOMObject(scriptState->executionContext())
|
| + : ContextLifecycleObserver(scriptState->executionContext())
|
| , m_transaction(transaction)
|
| , m_scriptState(scriptState)
|
| , m_source(source)
|
| @@ -83,7 +82,7 @@ DEFINE_TRACE(IDBRequest)
|
| visitor->trace(m_cursorKey);
|
| visitor->trace(m_cursorPrimaryKey);
|
| RefCountedGarbageCollectedEventTargetWithInlineData<IDBRequest>::trace(visitor);
|
| - ActiveDOMObject::trace(visitor);
|
| + ContextLifecycleObserver::trace(visitor);
|
| }
|
|
|
| ScriptValue IDBRequest::result(ExceptionState& exceptionState)
|
| @@ -92,7 +91,7 @@ ScriptValue IDBRequest::result(ExceptionState& exceptionState)
|
| exceptionState.throwDOMException(InvalidStateError, IDBDatabase::requestNotFinishedErrorMessage);
|
| return ScriptValue();
|
| }
|
| - if (m_contextStopped || !executionContext())
|
| + if (!executionContext())
|
| return ScriptValue();
|
| m_resultDirty = false;
|
| ScriptValue value = ScriptValue::from(m_scriptState.get(), m_result);
|
| @@ -110,7 +109,7 @@ DOMException* IDBRequest::error(ExceptionState& exceptionState) const
|
|
|
| ScriptValue IDBRequest::source() const
|
| {
|
| - if (m_contextStopped || !executionContext())
|
| + if (!executionContext())
|
| return ScriptValue();
|
|
|
| return ScriptValue::from(m_scriptState.get(), m_source);
|
| @@ -129,7 +128,7 @@ const String& IDBRequest::readyState() const
|
| void IDBRequest::abort()
|
| {
|
| ASSERT(!m_requestAborted);
|
| - if (m_contextStopped || !executionContext())
|
| + if (!executionContext())
|
| return;
|
| ASSERT(m_readyState == PENDING || m_readyState == DONE);
|
| if (m_readyState == DONE)
|
| @@ -211,7 +210,7 @@ void IDBRequest::ackReceivedBlobs(const Vector<RefPtr<IDBValue>>& values)
|
|
|
| bool IDBRequest::shouldEnqueueEvent() const
|
| {
|
| - if (m_contextStopped || !executionContext())
|
| + if (!executionContext())
|
| return false;
|
| ASSERT(m_readyState == PENDING || m_readyState == DONE);
|
| if (m_requestAborted)
|
| @@ -346,7 +345,7 @@ void IDBRequest::onSuccess()
|
|
|
| void IDBRequest::onSuccessInternal(IDBAny* result)
|
| {
|
| - ASSERT(!m_contextStopped);
|
| + ASSERT(executionContext());
|
| ASSERT(!m_pendingCursor);
|
| setResult(result);
|
| enqueueEvent(Event::create(EventTypeNames::success));
|
| @@ -373,16 +372,11 @@ bool IDBRequest::hasPendingActivity() const
|
| // FIXME: In an ideal world, we should return true as long as anyone has a or can
|
| // get a handle to us and we have event listeners. This is order to handle
|
| // user generated events properly.
|
| - return m_hasPendingActivity && !m_contextStopped;
|
| + return m_hasPendingActivity && executionContext();
|
| }
|
|
|
| -void IDBRequest::stop()
|
| +void IDBRequest::contextDestroyed()
|
| {
|
| - if (m_contextStopped)
|
| - return;
|
| -
|
| - m_contextStopped = true;
|
| -
|
| if (m_readyState == PENDING) {
|
| m_readyState = EarlyDeath;
|
| if (m_transaction) {
|
| @@ -407,13 +401,13 @@ const AtomicString& IDBRequest::interfaceName() const
|
|
|
| ExecutionContext* IDBRequest::executionContext() const
|
| {
|
| - return ActiveDOMObject::executionContext();
|
| + return ContextLifecycleObserver::executionContext();
|
| }
|
|
|
| DispatchEventResult IDBRequest::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event)
|
| {
|
| IDB_TRACE("IDBRequest::dispatchEvent");
|
| - if (m_contextStopped || !executionContext())
|
| + if (!executionContext())
|
| return DispatchEventResult::CanceledBeforeDispatch;
|
| ASSERT(m_readyState == PENDING);
|
| ASSERT(m_hasPendingActivity);
|
| @@ -503,7 +497,7 @@ void IDBRequest::transactionDidFinishAndDispatch()
|
| ASSERT(executionContext());
|
| m_transaction.clear();
|
|
|
| - if (m_contextStopped)
|
| + if (!executionContext())
|
| return;
|
|
|
| m_readyState = PENDING;
|
| @@ -513,7 +507,7 @@ void IDBRequest::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event)
|
| {
|
| ASSERT(m_readyState == PENDING || m_readyState == DONE);
|
|
|
| - if (m_contextStopped || !executionContext())
|
| + if (!executionContext())
|
| return;
|
|
|
| ASSERT_WITH_MESSAGE(m_readyState == PENDING || m_didFireUpgradeNeededEvent, "When queueing event %s, m_readyState was %d", event->type().utf8().data(), m_readyState);
|
|
|