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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 v8::TryCatch tryCatch; | 117 v8::TryCatch tryCatch; |
118 tryCatch.SetVerbose(true); | 118 tryCatch.SetVerbose(true); |
119 | 119 |
120 // Save the old 'event' property so we can restore it later. | 120 // Save the old 'event' property so we can restore it later. |
121 v8::Local<v8::Value> savedEvent = V8HiddenValue::getHiddenValue(isolate(
), scriptState()->context()->Global(), V8HiddenValue::event(isolate())); | 121 v8::Local<v8::Value> savedEvent = V8HiddenValue::getHiddenValue(isolate(
), scriptState()->context()->Global(), V8HiddenValue::event(isolate())); |
122 tryCatch.Reset(); | 122 tryCatch.Reset(); |
123 | 123 |
124 // Make the event available in the global object, so LocalDOMWindow can
expose it. | 124 // Make the event available in the global object, so LocalDOMWindow can
expose it. |
125 V8HiddenValue::setHiddenValue(isolate(), scriptState()->context()->Globa
l(), V8HiddenValue::event(isolate()), jsEvent); | 125 V8HiddenValue::setHiddenValue(isolate(), scriptState()->context()->Globa
l(), V8HiddenValue::event(isolate()), jsEvent); |
126 tryCatch.Reset(); | 126 tryCatch.Reset(); |
127 | 127 if (event->isBeforeUnloadEvent()) |
| 128 scriptState()->executionContext()->setIsBeforeUnloadEvent(true); |
128 returnValue = callListenerFunction(jsEvent, event); | 129 returnValue = callListenerFunction(jsEvent, event); |
| 130 if (event->isBeforeUnloadEvent()) |
| 131 scriptState()->executionContext()->setIsBeforeUnloadEvent(false); |
129 if (tryCatch.HasCaught()) | 132 if (tryCatch.HasCaught()) |
130 event->target()->uncaughtExceptionInEventHandler(); | 133 event->target()->uncaughtExceptionInEventHandler(); |
131 | 134 |
132 if (!tryCatch.CanContinue()) { // Result of TerminateExecution(). | 135 if (!tryCatch.CanContinue()) { // Result of TerminateExecution(). |
133 if (scriptState()->executionContext()->isWorkerGlobalScope()) | 136 if (scriptState()->executionContext()->isWorkerGlobalScope()) |
134 toWorkerGlobalScope(scriptState()->executionContext())->script()
->forbidExecution(); | 137 toWorkerGlobalScope(scriptState()->executionContext())->script()
->forbidExecution(); |
135 return; | 138 return; |
136 } | 139 } |
137 tryCatch.Reset(); | 140 tryCatch.Reset(); |
138 | 141 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 { | 183 { |
181 return isolate()->InContext() && &world() == &DOMWrapperWorld::current(isola
te()); | 184 return isolate()->InContext() && &world() == &DOMWrapperWorld::current(isola
te()); |
182 } | 185 } |
183 | 186 |
184 void V8AbstractEventListener::setWeakCallback(const v8::WeakCallbackData<v8::Obj
ect, V8AbstractEventListener> &data) | 187 void V8AbstractEventListener::setWeakCallback(const v8::WeakCallbackData<v8::Obj
ect, V8AbstractEventListener> &data) |
185 { | 188 { |
186 data.GetParameter()->m_listener.clear(); | 189 data.GetParameter()->m_listener.clear(); |
187 } | 190 } |
188 | 191 |
189 } // namespace blink | 192 } // namespace blink |
OLD | NEW |