Index: third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp |
diff --git a/third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp b/third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp |
index ec621fc9becbad9dd145606d5057124abdccc440..06d029598a2779cb06b87609d5fd300f8e45004a 100644 |
--- a/third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp |
+++ b/third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp |
@@ -17,6 +17,7 @@ PromiseRejectionEvent::PromiseRejectionEvent(ScriptState* state, const AtomicStr |
: Event(type, initializer) |
, m_scriptState(state) |
{ |
+ ThreadState::current()->registerPreFinalizer(this); |
ASSERT(initializer.hasPromise()); |
m_promise.set(initializer.promise().isolate(), initializer.promise().v8Value()); |
m_promise.setPhantom(); |
@@ -30,6 +31,15 @@ PromiseRejectionEvent::~PromiseRejectionEvent() |
{ |
} |
+void PromiseRejectionEvent::dispose() |
+{ |
+ // Clear ScopedPersistents so that V8 doesn't call phantom callbacks |
+ // (and touch the ScopedPersistents) after Oilpan starts lazy sweeping. |
+ m_promise.clear(); |
+ m_reason.clear(); |
+ m_scriptState.clear(); |
+} |
+ |
ScriptPromise PromiseRejectionEvent::promise(ScriptState* state) const |
{ |
// Return null when the promise is accessed by a different world than the world that created the promise. |