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

Unified Diff: sky/engine/bindings/core/v8/V8AbstractEventListener.cpp

Issue 873983005: Remove the global event property. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « sky/engine/bindings/core/v8/V8AbstractEventListener.h ('k') | sky/engine/bindings/core/v8/V8ErrorHandler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/bindings/core/v8/V8AbstractEventListener.cpp
diff --git a/sky/engine/bindings/core/v8/V8AbstractEventListener.cpp b/sky/engine/bindings/core/v8/V8AbstractEventListener.cpp
index 29fe7c842b99eb55df7ad430e0678af8ccf3ac58..9fff510377100034169c439ee640639e33b30e3d 100644
--- a/sky/engine/bindings/core/v8/V8AbstractEventListener.cpp
+++ b/sky/engine/bindings/core/v8/V8AbstractEventListener.cpp
@@ -100,50 +100,16 @@ void V8AbstractEventListener::setListenerObject(v8::Handle<v8::Object> listener)
void V8AbstractEventListener::invokeEventHandler(Event* event, v8::Local<v8::Value> jsEvent)
{
- // If jsEvent is empty, attempt to set it as a hidden value would crash v8.
if (jsEvent.IsEmpty())
return;
ASSERT(!scriptState()->contextIsEmpty());
- v8::Local<v8::Value> returnValue;
- {
- // Catch exceptions thrown in the event handler so they do not propagate to javascript code that caused the event to fire.
- v8::TryCatch tryCatch;
- tryCatch.SetVerbose(true);
-
- // Save the old 'event' property so we can restore it later.
- v8::Local<v8::Value> savedEvent = V8HiddenValue::getHiddenValue(isolate(), scriptState()->context()->Global(), V8HiddenValue::event(isolate()));
- tryCatch.Reset();
-
- // Make the event available in the global object, so LocalDOMWindow can expose it.
- V8HiddenValue::setHiddenValue(isolate(), scriptState()->context()->Global(), V8HiddenValue::event(isolate()), jsEvent);
- tryCatch.Reset();
-
- returnValue = callListenerFunction(jsEvent, event);
- if (tryCatch.HasCaught())
- event->target()->uncaughtExceptionInEventHandler();
-
- if (!tryCatch.CanContinue()) // Result of TerminateExecution().
- return;
- tryCatch.Reset();
-
- // Restore the old event. This must be done for all exit paths through this method.
- if (savedEvent.IsEmpty())
- V8HiddenValue::setHiddenValue(isolate(), scriptState()->context()->Global(), V8HiddenValue::event(isolate()), v8::Undefined(isolate()));
- else
- V8HiddenValue::setHiddenValue(isolate(), scriptState()->context()->Global(), V8HiddenValue::event(isolate()), savedEvent);
- tryCatch.Reset();
- }
- if (returnValue.IsEmpty())
- return;
-}
+ // Catch exceptions thrown in the event handler so they do not propagate to javascript code that caused the event to fire.
+ v8::TryCatch tryCatch;
+ tryCatch.SetVerbose(true);
-bool V8AbstractEventListener::shouldPreventDefault(v8::Local<v8::Value> returnValue)
-{
- // Prevent default action if the return value is false in accord with the spec
- // http://www.w3.org/TR/html5/webappapis.html#event-handler-attributes
- return returnValue->IsBoolean() && !returnValue->BooleanValue();
+ callListenerFunction(jsEvent, event);
}
v8::Local<v8::Object> V8AbstractEventListener::getReceiverObject(Event* event)
« no previous file with comments | « sky/engine/bindings/core/v8/V8AbstractEventListener.h ('k') | sky/engine/bindings/core/v8/V8ErrorHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698