diff options
Diffstat (limited to 'webkit/port')
-rw-r--r-- | webkit/port/bindings/v8/v8_events.cpp | 28 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_events.h | 1 |
2 files changed, 21 insertions, 8 deletions
diff --git a/webkit/port/bindings/v8/v8_events.cpp b/webkit/port/bindings/v8/v8_events.cpp index 18e43c5..9f84d9b 100644 --- a/webkit/port/bindings/v8/v8_events.cpp +++ b/webkit/port/bindings/v8/v8_events.cpp @@ -62,14 +62,9 @@ V8AbstractEventListener::V8AbstractEventListener(Frame* frame, bool isInline) void V8AbstractEventListener::HandleEventHelper(v8::Handle<v8::Context> context, Event* event, + v8::Handle<v8::Value> jsevent, bool isWindowEvent) { - // Enter the V8 context in which to perform the event handling. - v8::Context::Scope scope(context); - - // Get the V8 wrapper for the event object. - v8::Handle<v8::Value> jsevent = V8Proxy::EventToV8Object(event); - // For compatibility, we store the event object as a property on the window // called "event". Because this is the global namespace, we save away any // existing "event" property, and then restore it after executing the @@ -159,7 +154,15 @@ void V8AbstractEventListener::handleEvent(Event* event, bool isWindowEvent) { IF_DEVEL(log_info(frame, "Handling DOM event", m_frame->document()->URL())); - HandleEventHelper(context, event, isWindowEvent); + { + // Enter the V8 context in which to perform the event handling. + v8::Context::Scope scope(context); + + // Get the V8 wrapper for the event object. + v8::Handle<v8::Value> jsevent = V8Proxy::EventToV8Object(event); + + HandleEventHelper(context, event, jsevent, isWindowEvent); + } Document::updateDocumentsRendering(); } @@ -507,7 +510,16 @@ void V8WorkerContextEventListener::handleEvent(Event* event, if (context.IsEmpty()) return; - HandleEventHelper(context, event, isWindowEvent); + { + // Enter the V8 context in which to perform the event handling. + v8::Context::Scope scope(context); + + // Get the V8 wrapper for the event object. + v8::Handle<v8::Value> jsevent = + WorkerContextExecutionProxy::EventToV8Object(event); + + HandleEventHelper(context, event, jsevent, isWindowEvent); + } } v8::Local<v8::Value> V8WorkerContextEventListener::CallListenerFunction( diff --git a/webkit/port/bindings/v8/v8_events.h b/webkit/port/bindings/v8/v8_events.h index e584a1cf..833c669 100644 --- a/webkit/port/bindings/v8/v8_events.h +++ b/webkit/port/bindings/v8/v8_events.h @@ -42,6 +42,7 @@ class V8AbstractEventListener : public EventListener { void HandleEventHelper(v8::Handle<v8::Context> context, Event* event, + v8::Handle<v8::Value> jsevent, bool isWindowEvent); // Returns the listener object, either a function or an object. |