| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 if (v8Context.IsEmpty()) | 129 if (v8Context.IsEmpty()) |
| 130 return; | 130 return; |
| 131 | 131 |
| 132 v8::Context::Scope scope(v8Context); | 132 v8::Context::Scope scope(v8Context); |
| 133 | 133 |
| 134 String listenerSource = InspectorInstrumentation::preprocessEventListener(t
oDocument(context)->frame(), m_code, m_sourceURL, m_functionName); | 134 String listenerSource = InspectorInstrumentation::preprocessEventListener(t
oDocument(context)->frame(), m_code, m_sourceURL, m_functionName); |
| 135 | 135 |
| 136 // FIXME: Remove the following 'with' hack. | 136 // FIXME: Remove the following 'with' hack. |
| 137 // | 137 // |
| 138 // Nodes other than the document object, when executing inline event | 138 // Nodes other than the document object, when executing inline event |
| 139 // handlers push document, form, and the target node on the scope chain. | 139 // handlers push document, form owner, and the target node on the scope chai
n. |
| 140 // We do this by using 'with' statement. | 140 // We do this by using 'with' statement. |
| 141 // See chrome/fast/forms/form-action.html | 141 // See chrome/fast/forms/form-action.html |
| 142 // chrome/fast/forms/selected-index-value.html | 142 // chrome/fast/forms/selected-index-value.html |
| 143 // base/fast/overflow/onscroll-layer-self-destruct.html | 143 // base/fast/overflow/onscroll-layer-self-destruct.html |
| 144 // | 144 // |
| 145 // Don't use new lines so that lines in the modified handler | 145 // Don't use new lines so that lines in the modified handler |
| 146 // have the same numbers as in the original code. | 146 // have the same numbers as in the original code. |
| 147 // FIXME: V8 does not allow us to programmatically create object environment
s so | 147 // FIXME: V8 does not allow us to programmatically create object environment
s so |
| 148 // we have to do this hack! What if m_code escapes to run arbitrary s
cript? | 148 // we have to do this hack! What if m_code escapes to run arbitrary s
cript? |
| 149 // | 149 // |
| (...skipping 14 matching lines...) Expand all Loading... |
| 164 v8::Local<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(co
deExternalString, isolate, m_sourceURL, m_position, 0); | 164 v8::Local<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(co
deExternalString, isolate, m_sourceURL, m_position, 0); |
| 165 if (result.IsEmpty()) | 165 if (result.IsEmpty()) |
| 166 return; | 166 return; |
| 167 | 167 |
| 168 // Call the outer function to get the inner function. | 168 // Call the outer function to get the inner function. |
| 169 ASSERT(result->IsFunction()); | 169 ASSERT(result->IsFunction()); |
| 170 v8::Local<v8::Function> intermediateFunction = result.As<v8::Function>(); | 170 v8::Local<v8::Function> intermediateFunction = result.As<v8::Function>(); |
| 171 | 171 |
| 172 HTMLFormElement* formElement = 0; | 172 HTMLFormElement* formElement = 0; |
| 173 if (m_node && m_node->isHTMLElement()) | 173 if (m_node && m_node->isHTMLElement()) |
| 174 formElement = toHTMLElement(m_node)->form(); | 174 formElement = toHTMLElement(m_node)->formOwner(); |
| 175 | 175 |
| 176 v8::Handle<v8::Object> nodeWrapper = toObjectWrapper<Node>(m_node, isolate); | 176 v8::Handle<v8::Object> nodeWrapper = toObjectWrapper<Node>(m_node, isolate); |
| 177 v8::Handle<v8::Object> formWrapper = toObjectWrapper<HTMLFormElement>(formEl
ement, isolate); | 177 v8::Handle<v8::Object> formWrapper = toObjectWrapper<HTMLFormElement>(formEl
ement, isolate); |
| 178 v8::Handle<v8::Object> documentWrapper = toObjectWrapper<Document>(m_node ?
m_node->ownerDocument() : 0, isolate); | 178 v8::Handle<v8::Object> documentWrapper = toObjectWrapper<Document>(m_node ?
m_node->ownerDocument() : 0, isolate); |
| 179 | 179 |
| 180 v8::Local<v8::Object> thisObject = v8::Object::New(); | 180 v8::Local<v8::Object> thisObject = v8::Object::New(); |
| 181 if (thisObject.IsEmpty()) | 181 if (thisObject.IsEmpty()) |
| 182 return; | 182 return; |
| 183 if (!thisObject->ForceSet(v8::Integer::New(0, isolate), nodeWrapper)) | 183 if (!thisObject->ForceSet(v8::Integer::New(0, isolate), nodeWrapper)) |
| 184 return; | 184 return; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |