OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "bindings/v8/V8ErrorHandler.h" | 32 #include "bindings/v8/V8ErrorHandler.h" |
33 | 33 |
| 34 #include "V8ErrorEvent.h" |
34 #include "bindings/v8/ScriptController.h" | 35 #include "bindings/v8/ScriptController.h" |
35 #include "bindings/v8/V8Binding.h" | 36 #include "bindings/v8/V8Binding.h" |
36 #include "bindings/v8/V8HiddenPropertyName.h" | 37 #include "bindings/v8/V8HiddenPropertyName.h" |
37 #include "bindings/v8/V8ScriptRunner.h" | 38 #include "bindings/v8/V8ScriptRunner.h" |
| 39 #include "core/dom/Document.h" |
38 #include "core/dom/ErrorEvent.h" | 40 #include "core/dom/ErrorEvent.h" |
39 #include "core/dom/EventNames.h" | 41 #include "core/dom/EventNames.h" |
| 42 #include "core/dom/ScriptExecutionContext.h" |
| 43 #include "core/page/Frame.h" |
40 | 44 |
41 namespace WebCore { | 45 namespace WebCore { |
42 | 46 |
43 V8ErrorHandler::V8ErrorHandler(v8::Local<v8::Object> listener, bool isInline) | 47 V8ErrorHandler::V8ErrorHandler(v8::Local<v8::Object> listener, bool isInline) |
44 : V8EventListener(listener, isInline) | 48 : V8EventListener(listener, isInline) |
45 { | 49 { |
46 } | 50 } |
47 | 51 |
48 v8::Local<v8::Value> V8ErrorHandler::callListenerFunction(ScriptExecutionContext
* context, v8::Handle<v8::Value> jsEvent, Event* event) | 52 v8::Local<v8::Value> V8ErrorHandler::callListenerFunction(ScriptExecutionContext
* context, v8::Handle<v8::Value> jsEvent, Event* event) |
49 { | 53 { |
(...skipping 16 matching lines...) Expand all Loading... |
66 v8::TryCatch tryCatch; | 70 v8::TryCatch tryCatch; |
67 tryCatch.SetVerbose(true); | 71 tryCatch.SetVerbose(true); |
68 if (worldType(isolate) == WorkerWorld) | 72 if (worldType(isolate) == WorkerWorld) |
69 returnValue = V8ScriptRunner::callFunction(callFunction, context, th
isValue, WTF_ARRAY_LENGTH(parameters), parameters); | 73 returnValue = V8ScriptRunner::callFunction(callFunction, context, th
isValue, WTF_ARRAY_LENGTH(parameters), parameters); |
70 else | 74 else |
71 returnValue = ScriptController::callFunctionWithInstrumentation(0, c
allFunction, thisValue, WTF_ARRAY_LENGTH(parameters), parameters); | 75 returnValue = ScriptController::callFunctionWithInstrumentation(0, c
allFunction, thisValue, WTF_ARRAY_LENGTH(parameters), parameters); |
72 } | 76 } |
73 return returnValue; | 77 return returnValue; |
74 } | 78 } |
75 | 79 |
| 80 // static |
| 81 void V8ErrorHandler::storeExceptionOnErrorEventWrapper(ErrorEvent* event, v8::Ha
ndle<v8::Value> data, v8::Isolate* isolate) |
| 82 { |
| 83 v8::Local<v8::Value> wrappedEvent = toV8(event, v8::Handle<v8::Object>(), is
olate); |
| 84 if (!wrappedEvent.IsEmpty()) { |
| 85 ASSERT(wrappedEvent->IsObject()); |
| 86 v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenProper
tyName::error(), data); |
| 87 } |
| 88 } |
| 89 |
76 bool V8ErrorHandler::shouldPreventDefault(v8::Local<v8::Value> returnValue) | 90 bool V8ErrorHandler::shouldPreventDefault(v8::Local<v8::Value> returnValue) |
77 { | 91 { |
78 return returnValue->IsBoolean() && returnValue->BooleanValue(); | 92 return returnValue->IsBoolean() && returnValue->BooleanValue(); |
79 } | 93 } |
80 | 94 |
81 } // namespace WebCore | 95 } // namespace WebCore |
OLD | NEW |