| Index: Source/core/events/PromiseRejectionEvent.cpp
|
| diff --git a/Source/core/events/PromiseRejectionEvent.cpp b/Source/core/events/PromiseRejectionEvent.cpp
|
| index 2a4eb14da3e3e3f7db1e1889e116c6543a59e2ba..8f50096ead74ea8d8485189fa6fc5e633e3952da 100644
|
| --- a/Source/core/events/PromiseRejectionEvent.cpp
|
| +++ b/Source/core/events/PromiseRejectionEvent.cpp
|
| @@ -12,8 +12,9 @@ PromiseRejectionEvent::PromiseRejectionEvent()
|
| {
|
| }
|
|
|
| -PromiseRejectionEvent::PromiseRejectionEvent(const AtomicString& type, const PromiseRejectionEventInit& initializer)
|
| +PromiseRejectionEvent::PromiseRejectionEvent(ScriptState* state, const AtomicString& type, const PromiseRejectionEventInit& initializer)
|
| : Event(type, initializer)
|
| + , m_scriptState(state)
|
| {
|
| if (initializer.hasPromise()) {
|
| m_promise.set(initializer.promise().isolate(), initializer.promise().v8Value());
|
| @@ -29,16 +30,18 @@ PromiseRejectionEvent::~PromiseRejectionEvent()
|
| {
|
| }
|
|
|
| -ScriptPromise PromiseRejectionEvent::promise(ScriptState* state) const
|
| +ScriptPromise PromiseRejectionEvent::promise() const
|
| {
|
| - v8::Local<v8::Value> value = m_promise.newLocal(state->isolate());
|
| - return ScriptPromise(state, value);
|
| + if (!m_scriptState || !m_scriptState->contextIsValid())
|
| + return ScriptPromise();
|
| + return ScriptPromise(m_scriptState.get(), m_promise.newLocal(m_scriptState->isolate()));
|
| }
|
|
|
| -ScriptValue PromiseRejectionEvent::reason(ScriptState* state) const
|
| +ScriptValue PromiseRejectionEvent::reason() const
|
| {
|
| - v8::Local<v8::Value> value = m_reason.newLocal(state->isolate());
|
| - return ScriptValue(state, value);
|
| + if (!m_scriptState || !m_scriptState->contextIsValid())
|
| + return ScriptValue();
|
| + return ScriptValue(m_scriptState.get(), m_reason.newLocal(m_scriptState->isolate()));
|
| }
|
|
|
| const AtomicString& PromiseRejectionEvent::interfaceName() const
|
|
|