| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 if (!frame->script()->canExecuteScripts(AboutToExecuteScript)) | 99 if (!frame->script()->canExecuteScripts(AboutToExecuteScript)) |
| 100 return v8::Local<v8::Value>(); | 100 return v8::Local<v8::Value>(); |
| 101 | 101 |
| 102 v8::Handle<v8::Value> parameters[1] = { jsEvent }; | 102 v8::Handle<v8::Value> parameters[1] = { jsEvent }; |
| 103 return frame->script()->callFunction(handlerFunction, receiver, WTF_ARRAY_LE
NGTH(parameters), parameters); | 103 return frame->script()->callFunction(handlerFunction, receiver, WTF_ARRAY_LE
NGTH(parameters), parameters); |
| 104 } | 104 } |
| 105 | 105 |
| 106 static void V8LazyEventListenerToString(const v8::FunctionCallbackInfo<v8::Value
>& args) | 106 static void V8LazyEventListenerToString(const v8::FunctionCallbackInfo<v8::Value
>& args) |
| 107 { | 107 { |
| 108 v8SetReturnValue(args, args.Holder()->GetHiddenValue(V8HiddenPropertyName::t
oStringString())); | 108 v8SetReturnValue(args, args.Holder()->GetHiddenValue(V8HiddenPropertyName::t
oStringString(args.GetIsolate()))); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context) | 111 void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context) |
| 112 { | 112 { |
| 113 if (context->isDocument() && !toDocument(context)->allowInlineEventHandlers(
m_node, this, m_sourceURL, m_position.m_line)) { | 113 if (context->isDocument() && !toDocument(context)->allowInlineEventHandlers(
m_node, this, m_sourceURL, m_position.m_line)) { |
| 114 clearListenerObject(); | 114 clearListenerObject(); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 | 117 |
| 118 if (hasExistingListenerObject()) | 118 if (hasExistingListenerObject()) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // returned. | 204 // returned. |
| 205 v8::Handle<v8::FunctionTemplate> toStringTemplate = | 205 v8::Handle<v8::FunctionTemplate> toStringTemplate = |
| 206 V8PerIsolateData::current()->lazyEventListenerToStringTemplate(); | 206 V8PerIsolateData::current()->lazyEventListenerToStringTemplate(); |
| 207 if (toStringTemplate.IsEmpty()) | 207 if (toStringTemplate.IsEmpty()) |
| 208 toStringTemplate = v8::FunctionTemplate::New(V8LazyEventListenerToString
); | 208 toStringTemplate = v8::FunctionTemplate::New(V8LazyEventListenerToString
); |
| 209 v8::Local<v8::Function> toStringFunction; | 209 v8::Local<v8::Function> toStringFunction; |
| 210 if (!toStringTemplate.IsEmpty()) | 210 if (!toStringTemplate.IsEmpty()) |
| 211 toStringFunction = toStringTemplate->GetFunction(); | 211 toStringFunction = toStringTemplate->GetFunction(); |
| 212 if (!toStringFunction.IsEmpty()) { | 212 if (!toStringFunction.IsEmpty()) { |
| 213 String toStringString = "function " + m_functionName + "(" + m_eventPara
meterName + ") {\n " + m_code + "\n}"; | 213 String toStringString = "function " + m_functionName + "(" + m_eventPara
meterName + ") {\n " + m_code + "\n}"; |
| 214 wrappedFunction->SetHiddenValue(V8HiddenPropertyName::toStringString(),
v8String(toStringString, isolate)); | 214 wrappedFunction->SetHiddenValue(V8HiddenPropertyName::toStringString(iso
late), v8String(toStringString, isolate)); |
| 215 wrappedFunction->Set(v8::String::NewSymbol("toString"), toStringFunction
); | 215 wrappedFunction->Set(v8::String::NewSymbol("toString"), toStringFunction
); |
| 216 } | 216 } |
| 217 | 217 |
| 218 wrappedFunction->SetName(v8String(m_functionName, isolate)); | 218 wrappedFunction->SetName(v8String(m_functionName, isolate)); |
| 219 | 219 |
| 220 // FIXME: Remove the following comment-outs. | 220 // FIXME: Remove the following comment-outs. |
| 221 // See https://bugs.webkit.org/show_bug.cgi?id=85152 for more details. | 221 // See https://bugs.webkit.org/show_bug.cgi?id=85152 for more details. |
| 222 // | 222 // |
| 223 // For the time being, we comment out the following code since the | 223 // For the time being, we comment out the following code since the |
| 224 // second parsing can happen. | 224 // second parsing can happen. |
| 225 // // Since we only parse once, there's no need to keep data used for parsin
g around anymore. | 225 // // Since we only parse once, there's no need to keep data used for parsin
g around anymore. |
| 226 // m_functionName = String(); | 226 // m_functionName = String(); |
| 227 // m_code = String(); | 227 // m_code = String(); |
| 228 // m_eventParameterName = String(); | 228 // m_eventParameterName = String(); |
| 229 // m_sourceURL = String(); | 229 // m_sourceURL = String(); |
| 230 | 230 |
| 231 setListenerObject(wrappedFunction); | 231 setListenerObject(wrappedFunction); |
| 232 } | 232 } |
| 233 | 233 |
| 234 } // namespace WebCore | 234 } // namespace WebCore |
| OLD | NEW |