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

Unified Diff: Source/bindings/dart/DartEventListener.cpp

Issue 24492005: Keep a strong handle to an event listener during handleEvent (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Reupload Created 7 years, 3 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/bindings/dart/DartEventListener.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/DartEventListener.cpp
diff --git a/Source/bindings/dart/DartEventListener.cpp b/Source/bindings/dart/DartEventListener.cpp
index 92602dedbb3295a30d6986a826fc9259a71e6933..95f21e9e9f3de58d111021fd693366cc99ca2d73 100644
--- a/Source/bindings/dart/DartEventListener.cpp
+++ b/Source/bindings/dart/DartEventListener.cpp
@@ -96,6 +96,8 @@ void DartEventListener::handleEvent(ScriptExecutionContext* context, Event* even
// The callback function on XMLHttpRequest can clear the event listener and destroys 'this' object. Keep a local reference to it.
// See issue 889829.
RefPtr<DartEventListener> protect(this);
+ // Keep a strong handle to the listener.
+ Dart_Handle listener = Dart_HandleFromWeakPersistent(m_listener);
// Get the Dart wrapper for the event object.
Dart_Handle dartEvent = DartEvent::toDart(event);
@@ -103,7 +105,7 @@ void DartEventListener::handleEvent(ScriptExecutionContext* context, Event* even
// FIXME: consider if DateExtension manipulations are necessary and if yes (most probably),
// factor out common logic. For example by introducing EventProcessScope RAII to manage DateExtension.
- Dart_Handle result = callListenerFunction(context, dartEvent, event);
+ Dart_Handle result = callListenerFunction(context, listener, dartEvent);
if (Dart_IsError(result)) {
DartUtilities::reportProblem(context, result);
return;
@@ -130,16 +132,16 @@ EventListener* DartEventListener::toNative(Dart_Handle handle, Dart_Handle& exce
return createOrFetch(handle);
}
-Dart_Handle DartEventListener::callListenerFunction(ScriptExecutionContext* context, Dart_Handle dartEvent, Event* event)
+Dart_Handle DartEventListener::callListenerFunction(ScriptExecutionContext* context, Dart_Handle listener, Dart_Handle dartEvent)
{
- ASSERT(m_listener);
+ ASSERT(listener);
DartController* dartController = DartController::retrieve(context);
if (!dartController)
return Dart_Error("Internal error: failed to fetch Dart controller");
Dart_Handle parameters[1] = { dartEvent };
- return dartController->callFunction(Dart_HandleFromWeakPersistent(m_listener), 1, parameters);
+ return dartController->callFunction(listener, 1, parameters);
}
}
« no previous file with comments | « Source/bindings/dart/DartEventListener.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698