OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 v8::Local<v8::Value> returnValue; | 112 v8::Local<v8::Value> returnValue; |
113 { | 113 { |
114 // Catch exceptions thrown in the event handler so they do not propagate
to javascript code that caused the event to fire. | 114 // Catch exceptions thrown in the event handler so they do not propagate
to javascript code that caused the event to fire. |
115 v8::TryCatch tryCatch; | 115 v8::TryCatch tryCatch; |
116 tryCatch.SetVerbose(true); | 116 tryCatch.SetVerbose(true); |
117 | 117 |
118 // Save the old 'event' property so we can restore it later. | 118 // Save the old 'event' property so we can restore it later. |
119 v8::Local<v8::Value> savedEvent = V8HiddenValue::getHiddenValue(isolate(
), scriptState()->context()->Global(), V8HiddenValue::event(isolate())); | 119 v8::Local<v8::Value> savedEvent = V8HiddenValue::getHiddenValue(isolate(
), scriptState()->context()->Global(), V8HiddenValue::event(isolate())); |
120 tryCatch.Reset(); | 120 tryCatch.Reset(); |
121 | 121 |
122 // Make the event available in the global object, so DOMWindow can expos
e it. | 122 // Make the event available in the global object, so LocalDOMWindow can
expose it. |
123 V8HiddenValue::setHiddenValue(isolate(), scriptState()->context()->Globa
l(), V8HiddenValue::event(isolate()), jsEvent); | 123 V8HiddenValue::setHiddenValue(isolate(), scriptState()->context()->Globa
l(), V8HiddenValue::event(isolate()), jsEvent); |
124 tryCatch.Reset(); | 124 tryCatch.Reset(); |
125 | 125 |
126 returnValue = callListenerFunction(jsEvent, event); | 126 returnValue = callListenerFunction(jsEvent, event); |
127 if (tryCatch.HasCaught()) | 127 if (tryCatch.HasCaught()) |
128 event->target()->uncaughtExceptionInEventHandler(); | 128 event->target()->uncaughtExceptionInEventHandler(); |
129 | 129 |
130 if (!tryCatch.CanContinue()) { // Result of TerminateExecution(). | 130 if (!tryCatch.CanContinue()) { // Result of TerminateExecution(). |
131 if (scriptState()->executionContext()->isWorkerGlobalScope()) | 131 if (scriptState()->executionContext()->isWorkerGlobalScope()) |
132 toWorkerGlobalScope(scriptState()->executionContext())->script()
->forbidExecution(); | 132 toWorkerGlobalScope(scriptState()->executionContext())->script()
->forbidExecution(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 { | 178 { |
179 return isolate()->InContext() && &world() == &DOMWrapperWorld::current(isola
te()); | 179 return isolate()->InContext() && &world() == &DOMWrapperWorld::current(isola
te()); |
180 } | 180 } |
181 | 181 |
182 void V8AbstractEventListener::setWeakCallback(const v8::WeakCallbackData<v8::Obj
ect, V8AbstractEventListener> &data) | 182 void V8AbstractEventListener::setWeakCallback(const v8::WeakCallbackData<v8::Obj
ect, V8AbstractEventListener> &data) |
183 { | 183 { |
184 data.GetParameter()->m_listener.clear(); | 184 data.GetParameter()->m_listener.clear(); |
185 } | 185 } |
186 | 186 |
187 } // namespace WebCore | 187 } // namespace WebCore |
OLD | NEW |