Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(978)

Unified Diff: Source/core/events/PromiseRejectionEvent.cpp

Issue 1215813003: Correctly track lifetime of promise rejection events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/events/PromiseRejectionEvent.h ('k') | Source/core/events/PromiseRejectionEvent.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/events/PromiseRejectionEvent.cpp
diff --git a/Source/core/events/PromiseRejectionEvent.cpp b/Source/core/events/PromiseRejectionEvent.cpp
index 7947362f7ecfced3394c1b701fd91a981f5c9f01..a1333b4117036e41a40883283aa10218f1a7d766 100644
--- a/Source/core/events/PromiseRejectionEvent.cpp
+++ b/Source/core/events/PromiseRejectionEvent.cpp
@@ -48,6 +48,18 @@ ScriptValue PromiseRejectionEvent::reason(ScriptState* state) const
return ScriptValue(m_scriptState.get(), m_reason.newLocal(m_scriptState->isolate()));
}
+void PromiseRejectionEvent::setWrapperReference(v8::Isolate* isolate, const v8::Persistent<v8::Object>& wrapper)
+{
+ // This might create cross world references. However, the regular code path
+ // will not create them, and if we get a cross world reference here, the
+ // worst thing is that the lifetime is too long (similar to what happens
+ // for DOM trees).
+ if (!m_promise.isEmpty())
+ m_promise.setReference(wrapper, isolate);
+ if (!m_reason.isEmpty())
+ m_reason.setReference(wrapper, isolate);
+}
+
const AtomicString& PromiseRejectionEvent::interfaceName() const
{
return EventNames::PromiseRejectionEvent;
« no previous file with comments | « Source/core/events/PromiseRejectionEvent.h ('k') | Source/core/events/PromiseRejectionEvent.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698