| Index: third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
|
| index e1c0ab831088fbdfeb86b3894cef87a4acac8f0c..ebfd503fb2359507a30a026c3760f14cd92bfd4f 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
|
| @@ -17,7 +17,7 @@ namespace blink {
|
| ScriptPromisePropertyBase::ScriptPromisePropertyBase(
|
| ExecutionContext* executionContext,
|
| Name name)
|
| - : ContextLifecycleObserver(executionContext),
|
| + : m_executionContext(executionContext),
|
| m_isolate(toIsolate(executionContext)),
|
| m_name(name),
|
| m_state(Pending) {}
|
| @@ -26,19 +26,23 @@ ScriptPromisePropertyBase::~ScriptPromisePropertyBase() {
|
| clearWrappers();
|
| }
|
|
|
| +ExecutionContext* ScriptPromisePropertyBase::getExecutionContext() const {
|
| + return m_executionContext;
|
| +}
|
| +
|
| ScriptPromise ScriptPromisePropertyBase::promise(DOMWrapperWorld& world) {
|
| - if (!getExecutionContext())
|
| + if (m_executionContext->isContextDestroyed())
|
| return ScriptPromise();
|
|
|
| v8::HandleScope handleScope(m_isolate);
|
| - v8::Local<v8::Context> context = toV8Context(getExecutionContext(), world);
|
| + v8::Local<v8::Context> context = toV8Context(m_executionContext, world);
|
| if (context.IsEmpty())
|
| return ScriptPromise();
|
| ScriptState* scriptState = ScriptState::from(context);
|
| ScriptState::Scope scope(scriptState);
|
|
|
| v8::Local<v8::Object> wrapper = ensureHolderWrapper(scriptState);
|
| - ASSERT(wrapper->CreationContext() == context);
|
| + DCHECK(wrapper->CreationContext() == context);
|
|
|
| v8::Local<v8::Value> cachedPromise =
|
| V8HiddenValue::getHiddenValue(scriptState, wrapper, promiseName());
|
| @@ -68,9 +72,9 @@ ScriptPromise ScriptPromisePropertyBase::promise(DOMWrapperWorld& world) {
|
| }
|
|
|
| void ScriptPromisePropertyBase::resolveOrReject(State targetState) {
|
| - ASSERT(getExecutionContext());
|
| - ASSERT(m_state == Pending);
|
| - ASSERT(targetState == Resolved || targetState == Rejected);
|
| + DCHECK(!m_executionContext->isContextDestroyed());
|
| + DCHECK(m_state == Pending);
|
| + DCHECK(targetState == Resolved || targetState == Rejected);
|
|
|
| m_state = targetState;
|
|
|
| @@ -207,7 +211,7 @@ v8::Local<v8::String> ScriptPromisePropertyBase::resolverName() {
|
| }
|
|
|
| DEFINE_TRACE(ScriptPromisePropertyBase) {
|
| - ContextLifecycleObserver::trace(visitor);
|
| + visitor->trace(m_executionContext);
|
| }
|
|
|
| } // namespace blink
|
|
|