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 27 matching lines...) Expand all Loading... |
38 #include "HTMLFormElement.h" | 38 #include "HTMLFormElement.h" |
39 #include "Node.h" | 39 #include "Node.h" |
40 #include "ScriptSourceCode.h" | 40 #include "ScriptSourceCode.h" |
41 #include "V8Binding.h" | 41 #include "V8Binding.h" |
42 #include "V8DOMWrapper.h" | 42 #include "V8DOMWrapper.h" |
43 #include "V8Document.h" | 43 #include "V8Document.h" |
44 #include "V8HTMLFormElement.h" | 44 #include "V8HTMLFormElement.h" |
45 #include "V8HiddenPropertyName.h" | 45 #include "V8HiddenPropertyName.h" |
46 #include "V8Node.h" | 46 #include "V8Node.h" |
47 #include "V8RecursionScope.h" | 47 #include "V8RecursionScope.h" |
48 #include "WorldContextHandle.h" | |
49 | 48 |
50 #include <wtf/StdLibExtras.h> | 49 #include <wtf/StdLibExtras.h> |
51 | 50 |
52 namespace WebCore { | 51 namespace WebCore { |
53 | 52 |
54 V8LazyEventListener::V8LazyEventListener(const AtomicString& functionName, const
AtomicString& eventParameterName, const String& code, const String sourceURL, c
onst TextPosition& position, Node* node) | 53 V8LazyEventListener::V8LazyEventListener(const AtomicString& functionName, const
AtomicString& eventParameterName, const String& code, const String sourceURL, c
onst TextPosition& position, Node* node) |
55 : V8AbstractEventListener(true, WorldContextHandle(UseMainWorld), v8::Isolat
e::GetCurrent()) // FIXME Remove GetCurrent() | 54 : V8AbstractEventListener(true, mainThreadNormalWorld(), v8::Isolate::GetCur
rent()) // FIXME Remove GetCurrent() |
56 , m_functionName(functionName) | 55 , m_functionName(functionName) |
57 , m_eventParameterName(eventParameterName) | 56 , m_eventParameterName(eventParameterName) |
58 , m_code(code) | 57 , m_code(code) |
59 , m_sourceURL(sourceURL) | 58 , m_sourceURL(sourceURL) |
60 , m_node(node) | 59 , m_node(node) |
61 , m_position(position) | 60 , m_position(position) |
62 { | 61 { |
63 } | 62 } |
64 | 63 |
65 template<typename T> | 64 template<typename T> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 Frame* frame = toDocument(context)->frame(); | 119 Frame* frame = toDocument(context)->frame(); |
121 if (!frame) | 120 if (!frame) |
122 return; | 121 return; |
123 | 122 |
124 if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) | 123 if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) |
125 return; | 124 return; |
126 | 125 |
127 v8::HandleScope handleScope; | 126 v8::HandleScope handleScope; |
128 | 127 |
129 // Use the outer scope to hold context. | 128 // Use the outer scope to hold context. |
130 v8::Local<v8::Context> v8Context = toV8Context(context, worldContext()); | 129 v8::Local<v8::Context> v8Context = toV8Context(context, world()); |
131 v8::Isolate* isolate = v8Context->GetIsolate(); | 130 v8::Isolate* isolate = v8Context->GetIsolate(); |
132 // Bail out if we cannot get the context. | 131 // Bail out if we cannot get the context. |
133 if (v8Context.IsEmpty()) | 132 if (v8Context.IsEmpty()) |
134 return; | 133 return; |
135 | 134 |
136 v8::Context::Scope scope(v8Context); | 135 v8::Context::Scope scope(v8Context); |
137 | 136 |
138 // Nodes other than the document object, when executing inline event | 137 // Nodes other than the document object, when executing inline event |
139 // handlers push document, form, and the target node on the scope chain. | 138 // handlers push document, form, and the target node on the scope chain. |
140 // We do this by using 'with' statement. | 139 // We do this by using 'with' statement. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // // Since we only parse once, there's no need to keep data used for parsin
g around anymore. | 237 // // Since we only parse once, there's no need to keep data used for parsin
g around anymore. |
239 // m_functionName = String(); | 238 // m_functionName = String(); |
240 // m_code = String(); | 239 // m_code = String(); |
241 // m_eventParameterName = String(); | 240 // m_eventParameterName = String(); |
242 // m_sourceURL = String(); | 241 // m_sourceURL = String(); |
243 | 242 |
244 setListenerObject(wrappedFunction); | 243 setListenerObject(wrappedFunction); |
245 } | 244 } |
246 | 245 |
247 } // namespace WebCore | 246 } // namespace WebCore |
OLD | NEW |