OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return ""; | 100 return ""; |
101 | 101 |
102 v8::HandleScope scope(toIsolate(document)); | 102 v8::HandleScope scope(toIsolate(document)); |
103 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(
listener); | 103 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(
listener); |
104 v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world())
; | 104 v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world())
; |
105 v8::Context::Scope contextScope(context); | 105 v8::Context::Scope contextScope(context); |
106 v8::Handle<v8::Value> function = v8Listener->getListenerObject(document); | 106 v8::Handle<v8::Value> function = v8Listener->getListenerObject(document); |
107 if (function.IsEmpty()) | 107 if (function.IsEmpty()) |
108 return ""; | 108 return ""; |
109 | 109 |
110 return toWebCoreStringWithNullCheck(function); | 110 V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithNullCheck>, func
tionString, function, ""); |
| 111 return functionString; |
111 } | 112 } |
112 | 113 |
113 ScriptValue eventListenerHandler(Document* document, EventListener* listener) | 114 ScriptValue eventListenerHandler(Document* document, EventListener* listener) |
114 { | 115 { |
115 if (listener->type() != EventListener::JSEventListenerType) | 116 if (listener->type() != EventListener::JSEventListenerType) |
116 return ScriptValue(); | 117 return ScriptValue(); |
117 | 118 |
118 v8::Isolate* isolate = toIsolate(document); | 119 v8::Isolate* isolate = toIsolate(document); |
119 v8::HandleScope scope(isolate); | 120 v8::HandleScope scope(isolate); |
120 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(
listener); | 121 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(
listener); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 v8::ScriptOrigin origin = function->GetScriptOrigin(); | 156 v8::ScriptOrigin origin = function->GetScriptOrigin(); |
156 if (!origin.ResourceName().IsEmpty() && origin.ResourceName()->IsString()) | 157 if (!origin.ResourceName().IsEmpty() && origin.ResourceName()->IsString()) |
157 sourceName = toWebCoreString(origin.ResourceName().As<v8::String>()); | 158 sourceName = toWebCoreString(origin.ResourceName().As<v8::String>()); |
158 else | 159 else |
159 sourceName = ""; | 160 sourceName = ""; |
160 lineNumber = function->GetScriptLineNumber(); | 161 lineNumber = function->GetScriptLineNumber(); |
161 return true; | 162 return true; |
162 } | 163 } |
163 | 164 |
164 } // namespace WebCore | 165 } // namespace WebCore |
OLD | NEW |