tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSNode.cpp
1 /*
2     This file is part of the WebKit open source project.
3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18     Boston, MA 02110-1301, USA.
19 */
20
21 #include "config.h"
22 #include "JSNode.h"
23
24 #include "Document.h"
25 #include "Element.h"
26 #include "Event.h"
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
29 #include "JSDocument.h"
30 #include "JSElement.h"
31 #include "JSEvent.h"
32 #include "JSEventListener.h"
33 #include "JSNamedNodeMap.h"
34 #include "JSNode.h"
35 #include "JSNodeList.h"
36 #include "KURL.h"
37 #include "NameNodeList.h"
38 #include "NamedNodeMap.h"
39 #include "Node.h"
40 #include "NodeList.h"
41 #include <runtime/Error.h>
42 #include <wtf/GetPtr.h>
43
44 using namespace JSC;
45
46 namespace WebCore {
47
48 ASSERT_CLASS_FITS_IN_CELL(JSNode);
49
50 /* Hash table */
51 #if ENABLE(JIT)
52 #define THUNK_GENERATOR(generator) , generator
53 #else
54 #define THUNK_GENERATOR(generator)
55 #endif
56 #if ENABLE(DFG_JIT)
57 #define INTRINSIC(intrinsic) , intrinsic
58 #else
59 #define INTRINSIC(intrinsic)
60 #endif
61
62 static const HashTableValue JSNodeTableValues[] =
63 {
64     { "nodeName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNodeName), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
65     { "nodeValue", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNodeValue), (intptr_t)setJSNodeNodeValue THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
66     { "nodeType", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNodeType), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
67     { "parentNode", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeParentNode), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
68     { "childNodes", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeChildNodes), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
69     { "firstChild", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeFirstChild), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
70     { "lastChild", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeLastChild), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
71     { "previousSibling", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodePreviousSibling), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
72     { "nextSibling", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNextSibling), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
73     { "attributes", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeAttributes), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
74     { "ownerDocument", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeOwnerDocument), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
75     { "namespaceURI", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNamespaceURI), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
76     { "prefix", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodePrefix), (intptr_t)setJSNodePrefix THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
77     { "localName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeLocalName), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
78     { "baseURI", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeBaseURI), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
79     { "textContent", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeTextContent), (intptr_t)setJSNodeTextContent THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
80     { "parentElement", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeParentElement), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
81     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
82     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
83 };
84
85 #undef THUNK_GENERATOR
86 static const HashTable JSNodeTable = { 68, 63, JSNodeTableValues, 0 };
87 /* Hash table for constructor */
88 #if ENABLE(JIT)
89 #define THUNK_GENERATOR(generator) , generator
90 #else
91 #define THUNK_GENERATOR(generator)
92 #endif
93 #if ENABLE(DFG_JIT)
94 #define INTRINSIC(intrinsic) , intrinsic
95 #else
96 #define INTRINSIC(intrinsic)
97 #endif
98
99 static const HashTableValue JSNodeConstructorTableValues[] =
100 {
101     { "ELEMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeELEMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
102     { "ATTRIBUTE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeATTRIBUTE_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
103     { "TEXT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeTEXT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
104     { "CDATA_SECTION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeCDATA_SECTION_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
105     { "ENTITY_REFERENCE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeENTITY_REFERENCE_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
106     { "ENTITY_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeENTITY_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
107     { "PROCESSING_INSTRUCTION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodePROCESSING_INSTRUCTION_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
108     { "COMMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeCOMMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
109     { "DOCUMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
110     { "DOCUMENT_TYPE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_TYPE_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
111     { "DOCUMENT_FRAGMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_FRAGMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
112     { "NOTATION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNOTATION_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
113     { "DOCUMENT_POSITION_DISCONNECTED", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_DISCONNECTED), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
114     { "DOCUMENT_POSITION_PRECEDING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_PRECEDING), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
115     { "DOCUMENT_POSITION_FOLLOWING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_FOLLOWING), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
116     { "DOCUMENT_POSITION_CONTAINS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_CONTAINS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
117     { "DOCUMENT_POSITION_CONTAINED_BY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_CONTAINED_BY), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
118     { "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
119     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
120 };
121
122 #undef THUNK_GENERATOR
123 static const HashTable JSNodeConstructorTable = { 67, 63, JSNodeConstructorTableValues, 0 };
124
125 COMPILE_ASSERT(1 == Node::ELEMENT_NODE, NodeEnumELEMENT_NODEIsWrongUseDontCheckEnums);
126 COMPILE_ASSERT(2 == Node::ATTRIBUTE_NODE, NodeEnumATTRIBUTE_NODEIsWrongUseDontCheckEnums);
127 COMPILE_ASSERT(3 == Node::TEXT_NODE, NodeEnumTEXT_NODEIsWrongUseDontCheckEnums);
128 COMPILE_ASSERT(4 == Node::CDATA_SECTION_NODE, NodeEnumCDATA_SECTION_NODEIsWrongUseDontCheckEnums);
129 COMPILE_ASSERT(5 == Node::ENTITY_REFERENCE_NODE, NodeEnumENTITY_REFERENCE_NODEIsWrongUseDontCheckEnums);
130 COMPILE_ASSERT(6 == Node::ENTITY_NODE, NodeEnumENTITY_NODEIsWrongUseDontCheckEnums);
131 COMPILE_ASSERT(7 == Node::PROCESSING_INSTRUCTION_NODE, NodeEnumPROCESSING_INSTRUCTION_NODEIsWrongUseDontCheckEnums);
132 COMPILE_ASSERT(8 == Node::COMMENT_NODE, NodeEnumCOMMENT_NODEIsWrongUseDontCheckEnums);
133 COMPILE_ASSERT(9 == Node::DOCUMENT_NODE, NodeEnumDOCUMENT_NODEIsWrongUseDontCheckEnums);
134 COMPILE_ASSERT(10 == Node::DOCUMENT_TYPE_NODE, NodeEnumDOCUMENT_TYPE_NODEIsWrongUseDontCheckEnums);
135 COMPILE_ASSERT(11 == Node::DOCUMENT_FRAGMENT_NODE, NodeEnumDOCUMENT_FRAGMENT_NODEIsWrongUseDontCheckEnums);
136 COMPILE_ASSERT(12 == Node::NOTATION_NODE, NodeEnumNOTATION_NODEIsWrongUseDontCheckEnums);
137 COMPILE_ASSERT(0x01 == Node::DOCUMENT_POSITION_DISCONNECTED, NodeEnumDOCUMENT_POSITION_DISCONNECTEDIsWrongUseDontCheckEnums);
138 COMPILE_ASSERT(0x02 == Node::DOCUMENT_POSITION_PRECEDING, NodeEnumDOCUMENT_POSITION_PRECEDINGIsWrongUseDontCheckEnums);
139 COMPILE_ASSERT(0x04 == Node::DOCUMENT_POSITION_FOLLOWING, NodeEnumDOCUMENT_POSITION_FOLLOWINGIsWrongUseDontCheckEnums);
140 COMPILE_ASSERT(0x08 == Node::DOCUMENT_POSITION_CONTAINS, NodeEnumDOCUMENT_POSITION_CONTAINSIsWrongUseDontCheckEnums);
141 COMPILE_ASSERT(0x10 == Node::DOCUMENT_POSITION_CONTAINED_BY, NodeEnumDOCUMENT_POSITION_CONTAINED_BYIsWrongUseDontCheckEnums);
142 COMPILE_ASSERT(0x20 == Node::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, NodeEnumDOCUMENT_POSITION_IMPLEMENTATION_SPECIFICIsWrongUseDontCheckEnums);
143
144 const ClassInfo JSNodeConstructor::s_info = { "NodeConstructor", &DOMConstructorObject::s_info, &JSNodeConstructorTable, 0, CREATE_METHOD_TABLE(JSNodeConstructor) };
145
146 JSNodeConstructor::JSNodeConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
147     : DOMConstructorObject(structure, globalObject)
148 {
149 }
150
151 void JSNodeConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
152 {
153     Base::finishCreation(exec->globalData());
154     ASSERT(inherits(&s_info));
155     putDirect(exec->globalData(), exec->propertyNames().prototype, JSNodePrototype::self(exec, globalObject), DontDelete | ReadOnly);
156 }
157
158 bool JSNodeConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
159 {
160     return getStaticValueSlot<JSNodeConstructor, JSDOMWrapper>(exec, &JSNodeConstructorTable, static_cast<JSNodeConstructor*>(cell), propertyName, slot);
161 }
162
163 bool JSNodeConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
164 {
165     return getStaticValueDescriptor<JSNodeConstructor, JSDOMWrapper>(exec, &JSNodeConstructorTable, static_cast<JSNodeConstructor*>(object), propertyName, descriptor);
166 }
167
168 /* Hash table for prototype */
169 #if ENABLE(JIT)
170 #define THUNK_GENERATOR(generator) , generator
171 #else
172 #define THUNK_GENERATOR(generator)
173 #endif
174 #if ENABLE(DFG_JIT)
175 #define INTRINSIC(intrinsic) , intrinsic
176 #else
177 #define INTRINSIC(intrinsic)
178 #endif
179
180 static const HashTableValue JSNodePrototypeTableValues[] =
181 {
182     { "ELEMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeELEMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
183     { "ATTRIBUTE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeATTRIBUTE_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
184     { "TEXT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeTEXT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
185     { "CDATA_SECTION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeCDATA_SECTION_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
186     { "ENTITY_REFERENCE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeENTITY_REFERENCE_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
187     { "ENTITY_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeENTITY_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
188     { "PROCESSING_INSTRUCTION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodePROCESSING_INSTRUCTION_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
189     { "COMMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeCOMMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
190     { "DOCUMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
191     { "DOCUMENT_TYPE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_TYPE_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
192     { "DOCUMENT_FRAGMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_FRAGMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
193     { "NOTATION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNOTATION_NODE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
194     { "DOCUMENT_POSITION_DISCONNECTED", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_DISCONNECTED), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
195     { "DOCUMENT_POSITION_PRECEDING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_PRECEDING), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
196     { "DOCUMENT_POSITION_FOLLOWING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_FOLLOWING), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
197     { "DOCUMENT_POSITION_CONTAINS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_CONTAINS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
198     { "DOCUMENT_POSITION_CONTAINED_BY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_CONTAINED_BY), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
199     { "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
200     { "insertBefore", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionInsertBefore), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
201     { "replaceChild", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionReplaceChild), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
202     { "removeChild", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionRemoveChild), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
203     { "appendChild", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionAppendChild), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
204     { "hasChildNodes", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionHasChildNodes), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
205     { "cloneNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionCloneNode), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
206     { "normalize", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionNormalize), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
207     { "isSupported", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionIsSupported), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
208     { "hasAttributes", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionHasAttributes), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
209     { "isSameNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionIsSameNode), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
210     { "isEqualNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionIsEqualNode), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
211     { "lookupPrefix", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionLookupPrefix), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
212     { "isDefaultNamespace", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionIsDefaultNamespace), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
213     { "lookupNamespaceURI", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionLookupNamespaceURI), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
214     { "compareDocumentPosition", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionCompareDocumentPosition), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
215     { "contains", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionContains), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
216     { "addEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
217     { "removeEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
218     { "dispatchEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionDispatchEvent), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
219     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
220 };
221
222 #undef THUNK_GENERATOR
223 static const HashTable JSNodePrototypeTable = { 134, 127, JSNodePrototypeTableValues, 0 };
224 const ClassInfo JSNodePrototype::s_info = { "NodePrototype", &JSC::JSNonFinalObject::s_info, &JSNodePrototypeTable, 0, CREATE_METHOD_TABLE(JSNodePrototype) };
225
226 JSObject* JSNodePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
227 {
228     return getDOMPrototype<JSNode>(exec, globalObject);
229 }
230
231 bool JSNodePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
232 {
233     JSNodePrototype* thisObject = jsCast<JSNodePrototype*>(cell);
234     return getStaticPropertySlot<JSNodePrototype, JSObject>(exec, &JSNodePrototypeTable, thisObject, propertyName, slot);
235 }
236
237 bool JSNodePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
238 {
239     JSNodePrototype* thisObject = jsCast<JSNodePrototype*>(object);
240     return getStaticPropertyDescriptor<JSNodePrototype, JSObject>(exec, &JSNodePrototypeTable, thisObject, propertyName, descriptor);
241 }
242
243 const ClassInfo JSNode::s_info = { "Node", &JSDOMWrapper::s_info, &JSNodeTable, 0 , CREATE_METHOD_TABLE(JSNode) };
244
245 JSNode::JSNode(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Node> impl)
246     : JSDOMWrapper(structure, globalObject)
247     , m_impl(impl.leakRef())
248 {
249 }
250
251 void JSNode::finishCreation(JSGlobalData& globalData)
252 {
253     Base::finishCreation(globalData);
254     ASSERT(inherits(&s_info));
255 }
256
257 JSObject* JSNode::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
258 {
259     return JSNodePrototype::create(exec->globalData(), globalObject, JSNodePrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
260 }
261
262 JSValue jsNodeNodeName(ExecState* exec, JSValue slotBase, const Identifier&)
263 {
264     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
265     UNUSED_PARAM(exec);
266     Node* imp = static_cast<Node*>(castedThis->impl());
267     JSValue result = jsStringOrNull(exec, imp->nodeName());
268     return result;
269 }
270
271
272 JSValue jsNodeNodeValue(ExecState* exec, JSValue slotBase, const Identifier&)
273 {
274     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
275     UNUSED_PARAM(exec);
276     Node* imp = static_cast<Node*>(castedThis->impl());
277     JSValue result = jsStringOrNull(exec, imp->nodeValue());
278     return result;
279 }
280
281
282 JSValue jsNodeNodeType(ExecState* exec, JSValue slotBase, const Identifier&)
283 {
284     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
285     UNUSED_PARAM(exec);
286     Node* imp = static_cast<Node*>(castedThis->impl());
287     JSValue result = jsNumber(imp->nodeType());
288     return result;
289 }
290
291
292 JSValue jsNodeParentNode(ExecState* exec, JSValue slotBase, const Identifier&)
293 {
294     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
295     UNUSED_PARAM(exec);
296     Node* imp = static_cast<Node*>(castedThis->impl());
297     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentNode()));
298     return result;
299 }
300
301
302 JSValue jsNodeChildNodes(ExecState* exec, JSValue slotBase, const Identifier&)
303 {
304     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
305     UNUSED_PARAM(exec);
306     Node* imp = static_cast<Node*>(castedThis->impl());
307     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->childNodes()));
308     return result;
309 }
310
311
312 JSValue jsNodeFirstChild(ExecState* exec, JSValue slotBase, const Identifier&)
313 {
314     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
315     UNUSED_PARAM(exec);
316     Node* imp = static_cast<Node*>(castedThis->impl());
317     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->firstChild()));
318     return result;
319 }
320
321
322 JSValue jsNodeLastChild(ExecState* exec, JSValue slotBase, const Identifier&)
323 {
324     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
325     UNUSED_PARAM(exec);
326     Node* imp = static_cast<Node*>(castedThis->impl());
327     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->lastChild()));
328     return result;
329 }
330
331
332 JSValue jsNodePreviousSibling(ExecState* exec, JSValue slotBase, const Identifier&)
333 {
334     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
335     UNUSED_PARAM(exec);
336     Node* imp = static_cast<Node*>(castedThis->impl());
337     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->previousSibling()));
338     return result;
339 }
340
341
342 JSValue jsNodeNextSibling(ExecState* exec, JSValue slotBase, const Identifier&)
343 {
344     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
345     UNUSED_PARAM(exec);
346     Node* imp = static_cast<Node*>(castedThis->impl());
347     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->nextSibling()));
348     return result;
349 }
350
351
352 JSValue jsNodeAttributes(ExecState* exec, JSValue slotBase, const Identifier&)
353 {
354     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
355     UNUSED_PARAM(exec);
356     Node* imp = static_cast<Node*>(castedThis->impl());
357     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->attributes()));
358     return result;
359 }
360
361
362 JSValue jsNodeOwnerDocument(ExecState* exec, JSValue slotBase, const Identifier&)
363 {
364     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
365     UNUSED_PARAM(exec);
366     Node* imp = static_cast<Node*>(castedThis->impl());
367     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->ownerDocument()));
368     return result;
369 }
370
371
372 JSValue jsNodeNamespaceURI(ExecState* exec, JSValue slotBase, const Identifier&)
373 {
374     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
375     UNUSED_PARAM(exec);
376     Node* imp = static_cast<Node*>(castedThis->impl());
377     JSValue result = jsStringOrNull(exec, imp->namespaceURI());
378     return result;
379 }
380
381
382 JSValue jsNodePrefix(ExecState* exec, JSValue slotBase, const Identifier&)
383 {
384     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
385     UNUSED_PARAM(exec);
386     Node* imp = static_cast<Node*>(castedThis->impl());
387     JSValue result = jsStringOrNull(exec, imp->prefix());
388     return result;
389 }
390
391
392 JSValue jsNodeLocalName(ExecState* exec, JSValue slotBase, const Identifier&)
393 {
394     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
395     UNUSED_PARAM(exec);
396     Node* imp = static_cast<Node*>(castedThis->impl());
397     JSValue result = jsStringOrNull(exec, imp->localName());
398     return result;
399 }
400
401
402 JSValue jsNodeBaseURI(ExecState* exec, JSValue slotBase, const Identifier&)
403 {
404     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
405     UNUSED_PARAM(exec);
406     Node* imp = static_cast<Node*>(castedThis->impl());
407     JSValue result = jsStringOrNull(exec, imp->baseURI());
408     return result;
409 }
410
411
412 JSValue jsNodeTextContent(ExecState* exec, JSValue slotBase, const Identifier&)
413 {
414     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
415     UNUSED_PARAM(exec);
416     Node* imp = static_cast<Node*>(castedThis->impl());
417     JSValue result = jsStringOrNull(exec, imp->textContent());
418     return result;
419 }
420
421
422 JSValue jsNodeParentElement(ExecState* exec, JSValue slotBase, const Identifier&)
423 {
424     JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
425     UNUSED_PARAM(exec);
426     Node* imp = static_cast<Node*>(castedThis->impl());
427     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentElement()));
428     return result;
429 }
430
431
432 JSValue jsNodeConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
433 {
434     JSNode* domObject = static_cast<JSNode*>(asObject(slotBase));
435     return JSNode::getConstructor(exec, domObject->globalObject());
436 }
437
438 void JSNode::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
439 {
440     JSNode* thisObject = jsCast<JSNode*>(cell);
441     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
442     lookupPut<JSNode, Base>(exec, propertyName, value, &JSNodeTable, thisObject, slot);
443 }
444
445 void setJSNodeNodeValue(ExecState* exec, JSObject* thisObject, JSValue value)
446 {
447     JSNode* castedThis = static_cast<JSNode*>(thisObject);
448     Node* imp = static_cast<Node*>(castedThis->impl());
449     ExceptionCode ec = 0;
450     imp->setNodeValue(valueToStringWithNullCheck(exec, value), ec);
451     setDOMException(exec, ec);
452 }
453
454
455 void setJSNodePrefix(ExecState* exec, JSObject* thisObject, JSValue value)
456 {
457     JSNode* castedThis = static_cast<JSNode*>(thisObject);
458     Node* imp = static_cast<Node*>(castedThis->impl());
459     ExceptionCode ec = 0;
460     imp->setPrefix(valueToStringWithNullCheck(exec, value), ec);
461     setDOMException(exec, ec);
462 }
463
464
465 void setJSNodeTextContent(ExecState* exec, JSObject* thisObject, JSValue value)
466 {
467     JSNode* castedThis = static_cast<JSNode*>(thisObject);
468     Node* imp = static_cast<Node*>(castedThis->impl());
469     ExceptionCode ec = 0;
470     imp->setTextContent(valueToStringWithNullCheck(exec, value), ec);
471     setDOMException(exec, ec);
472 }
473
474
475 JSValue JSNode::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
476 {
477     return getDOMConstructor<JSNodeConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
478 }
479
480 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionInsertBefore(ExecState* exec)
481 {
482     JSValue thisValue = exec->hostThisValue();
483     if (!thisValue.inherits(&JSNode::s_info))
484         return throwVMTypeError(exec);
485     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
486     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
487     return JSValue::encode(castedThis->insertBefore(exec));
488 }
489
490 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionReplaceChild(ExecState* exec)
491 {
492     JSValue thisValue = exec->hostThisValue();
493     if (!thisValue.inherits(&JSNode::s_info))
494         return throwVMTypeError(exec);
495     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
496     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
497     return JSValue::encode(castedThis->replaceChild(exec));
498 }
499
500 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionRemoveChild(ExecState* exec)
501 {
502     JSValue thisValue = exec->hostThisValue();
503     if (!thisValue.inherits(&JSNode::s_info))
504         return throwVMTypeError(exec);
505     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
506     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
507     return JSValue::encode(castedThis->removeChild(exec));
508 }
509
510 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionAppendChild(ExecState* exec)
511 {
512     JSValue thisValue = exec->hostThisValue();
513     if (!thisValue.inherits(&JSNode::s_info))
514         return throwVMTypeError(exec);
515     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
516     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
517     return JSValue::encode(castedThis->appendChild(exec));
518 }
519
520 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionHasChildNodes(ExecState* exec)
521 {
522     JSValue thisValue = exec->hostThisValue();
523     if (!thisValue.inherits(&JSNode::s_info))
524         return throwVMTypeError(exec);
525     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
526     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
527     Node* imp = static_cast<Node*>(castedThis->impl());
528
529     JSC::JSValue result = jsBoolean(imp->hasChildNodes());
530     return JSValue::encode(result);
531 }
532
533 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionCloneNode(ExecState* exec)
534 {
535     JSValue thisValue = exec->hostThisValue();
536     if (!thisValue.inherits(&JSNode::s_info))
537         return throwVMTypeError(exec);
538     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
539     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
540     Node* imp = static_cast<Node*>(castedThis->impl());
541     bool deep(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toBoolean(exec));
542     if (exec->hadException())
543         return JSValue::encode(jsUndefined());
544
545     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->cloneNode(deep)));
546     return JSValue::encode(result);
547 }
548
549 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionNormalize(ExecState* exec)
550 {
551     JSValue thisValue = exec->hostThisValue();
552     if (!thisValue.inherits(&JSNode::s_info))
553         return throwVMTypeError(exec);
554     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
555     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
556     Node* imp = static_cast<Node*>(castedThis->impl());
557     imp->normalize();
558     return JSValue::encode(jsUndefined());
559 }
560
561 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsSupported(ExecState* exec)
562 {
563     JSValue thisValue = exec->hostThisValue();
564     if (!thisValue.inherits(&JSNode::s_info))
565         return throwVMTypeError(exec);
566     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
567     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
568     Node* imp = static_cast<Node*>(castedThis->impl());
569     const String& feature(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)));
570     if (exec->hadException())
571         return JSValue::encode(jsUndefined());
572     const String& version(valueToStringWithNullCheck(exec, MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined)));
573     if (exec->hadException())
574         return JSValue::encode(jsUndefined());
575
576     JSC::JSValue result = jsBoolean(imp->isSupported(feature, version));
577     return JSValue::encode(result);
578 }
579
580 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionHasAttributes(ExecState* exec)
581 {
582     JSValue thisValue = exec->hostThisValue();
583     if (!thisValue.inherits(&JSNode::s_info))
584         return throwVMTypeError(exec);
585     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
586     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
587     Node* imp = static_cast<Node*>(castedThis->impl());
588
589     JSC::JSValue result = jsBoolean(imp->hasAttributes());
590     return JSValue::encode(result);
591 }
592
593 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsSameNode(ExecState* exec)
594 {
595     JSValue thisValue = exec->hostThisValue();
596     if (!thisValue.inherits(&JSNode::s_info))
597         return throwVMTypeError(exec);
598     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
599     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
600     Node* imp = static_cast<Node*>(castedThis->impl());
601     Node* other(toNode(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
602     if (exec->hadException())
603         return JSValue::encode(jsUndefined());
604
605     JSC::JSValue result = jsBoolean(imp->isSameNode(other));
606     return JSValue::encode(result);
607 }
608
609 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsEqualNode(ExecState* exec)
610 {
611     JSValue thisValue = exec->hostThisValue();
612     if (!thisValue.inherits(&JSNode::s_info))
613         return throwVMTypeError(exec);
614     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
615     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
616     Node* imp = static_cast<Node*>(castedThis->impl());
617     Node* other(toNode(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
618     if (exec->hadException())
619         return JSValue::encode(jsUndefined());
620
621     JSC::JSValue result = jsBoolean(imp->isEqualNode(other));
622     return JSValue::encode(result);
623 }
624
625 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionLookupPrefix(ExecState* exec)
626 {
627     JSValue thisValue = exec->hostThisValue();
628     if (!thisValue.inherits(&JSNode::s_info))
629         return throwVMTypeError(exec);
630     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
631     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
632     Node* imp = static_cast<Node*>(castedThis->impl());
633     const String& namespaceURI(valueToStringWithNullCheck(exec, MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
634     if (exec->hadException())
635         return JSValue::encode(jsUndefined());
636
637     JSC::JSValue result = jsStringOrNull(exec, imp->lookupPrefix(namespaceURI));
638     return JSValue::encode(result);
639 }
640
641 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsDefaultNamespace(ExecState* exec)
642 {
643     JSValue thisValue = exec->hostThisValue();
644     if (!thisValue.inherits(&JSNode::s_info))
645         return throwVMTypeError(exec);
646     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
647     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
648     Node* imp = static_cast<Node*>(castedThis->impl());
649     const String& namespaceURI(valueToStringWithNullCheck(exec, MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
650     if (exec->hadException())
651         return JSValue::encode(jsUndefined());
652
653     JSC::JSValue result = jsBoolean(imp->isDefaultNamespace(namespaceURI));
654     return JSValue::encode(result);
655 }
656
657 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionLookupNamespaceURI(ExecState* exec)
658 {
659     JSValue thisValue = exec->hostThisValue();
660     if (!thisValue.inherits(&JSNode::s_info))
661         return throwVMTypeError(exec);
662     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
663     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
664     Node* imp = static_cast<Node*>(castedThis->impl());
665     const String& prefix(valueToStringWithNullCheck(exec, MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
666     if (exec->hadException())
667         return JSValue::encode(jsUndefined());
668
669     JSC::JSValue result = jsStringOrNull(exec, imp->lookupNamespaceURI(prefix));
670     return JSValue::encode(result);
671 }
672
673 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionCompareDocumentPosition(ExecState* exec)
674 {
675     JSValue thisValue = exec->hostThisValue();
676     if (!thisValue.inherits(&JSNode::s_info))
677         return throwVMTypeError(exec);
678     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
679     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
680     Node* imp = static_cast<Node*>(castedThis->impl());
681     Node* other(toNode(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
682     if (exec->hadException())
683         return JSValue::encode(jsUndefined());
684
685     JSC::JSValue result = jsNumber(imp->compareDocumentPosition(other));
686     return JSValue::encode(result);
687 }
688
689 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionContains(ExecState* exec)
690 {
691     JSValue thisValue = exec->hostThisValue();
692     if (!thisValue.inherits(&JSNode::s_info))
693         return throwVMTypeError(exec);
694     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
695     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
696     Node* imp = static_cast<Node*>(castedThis->impl());
697     Node* other(toNode(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
698     if (exec->hadException())
699         return JSValue::encode(jsUndefined());
700
701     JSC::JSValue result = jsBoolean(imp->contains(other));
702     return JSValue::encode(result);
703 }
704
705 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionAddEventListener(ExecState* exec)
706 {
707     JSValue thisValue = exec->hostThisValue();
708     if (!thisValue.inherits(&JSNode::s_info))
709         return throwVMTypeError(exec);
710     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
711     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
712     Node* imp = static_cast<Node*>(castedThis->impl());
713     if (exec->argumentCount() < 2)
714         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
715     JSValue listener = exec->argument(1);
716     if (!listener.isObject())
717         return JSValue::encode(jsUndefined());
718     imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));
719     return JSValue::encode(jsUndefined());
720 }
721
722 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionRemoveEventListener(ExecState* exec)
723 {
724     JSValue thisValue = exec->hostThisValue();
725     if (!thisValue.inherits(&JSNode::s_info))
726         return throwVMTypeError(exec);
727     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
728     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
729     Node* imp = static_cast<Node*>(castedThis->impl());
730     if (exec->argumentCount() < 2)
731         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
732     JSValue listener = exec->argument(1);
733     if (!listener.isObject())
734         return JSValue::encode(jsUndefined());
735     imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
736     return JSValue::encode(jsUndefined());
737 }
738
739 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionDispatchEvent(ExecState* exec)
740 {
741     JSValue thisValue = exec->hostThisValue();
742     if (!thisValue.inherits(&JSNode::s_info))
743         return throwVMTypeError(exec);
744     JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue));
745     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNode::s_info);
746     Node* imp = static_cast<Node*>(castedThis->impl());
747     if (exec->argumentCount() < 1)
748         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
749     ExceptionCode ec = 0;
750     Event* event(toEvent(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined)));
751     if (exec->hadException())
752         return JSValue::encode(jsUndefined());
753
754     JSC::JSValue result = jsBoolean(imp->dispatchEvent(event, ec));
755     setDOMException(exec, ec);
756     return JSValue::encode(result);
757 }
758
759 // Constant getters
760
761 JSValue jsNodeELEMENT_NODE(ExecState* exec, JSValue, const Identifier&)
762 {
763     UNUSED_PARAM(exec);
764     return jsNumber(static_cast<int>(1));
765 }
766
767 JSValue jsNodeATTRIBUTE_NODE(ExecState* exec, JSValue, const Identifier&)
768 {
769     UNUSED_PARAM(exec);
770     return jsNumber(static_cast<int>(2));
771 }
772
773 JSValue jsNodeTEXT_NODE(ExecState* exec, JSValue, const Identifier&)
774 {
775     UNUSED_PARAM(exec);
776     return jsNumber(static_cast<int>(3));
777 }
778
779 JSValue jsNodeCDATA_SECTION_NODE(ExecState* exec, JSValue, const Identifier&)
780 {
781     UNUSED_PARAM(exec);
782     return jsNumber(static_cast<int>(4));
783 }
784
785 JSValue jsNodeENTITY_REFERENCE_NODE(ExecState* exec, JSValue, const Identifier&)
786 {
787     UNUSED_PARAM(exec);
788     return jsNumber(static_cast<int>(5));
789 }
790
791 JSValue jsNodeENTITY_NODE(ExecState* exec, JSValue, const Identifier&)
792 {
793     UNUSED_PARAM(exec);
794     return jsNumber(static_cast<int>(6));
795 }
796
797 JSValue jsNodePROCESSING_INSTRUCTION_NODE(ExecState* exec, JSValue, const Identifier&)
798 {
799     UNUSED_PARAM(exec);
800     return jsNumber(static_cast<int>(7));
801 }
802
803 JSValue jsNodeCOMMENT_NODE(ExecState* exec, JSValue, const Identifier&)
804 {
805     UNUSED_PARAM(exec);
806     return jsNumber(static_cast<int>(8));
807 }
808
809 JSValue jsNodeDOCUMENT_NODE(ExecState* exec, JSValue, const Identifier&)
810 {
811     UNUSED_PARAM(exec);
812     return jsNumber(static_cast<int>(9));
813 }
814
815 JSValue jsNodeDOCUMENT_TYPE_NODE(ExecState* exec, JSValue, const Identifier&)
816 {
817     UNUSED_PARAM(exec);
818     return jsNumber(static_cast<int>(10));
819 }
820
821 JSValue jsNodeDOCUMENT_FRAGMENT_NODE(ExecState* exec, JSValue, const Identifier&)
822 {
823     UNUSED_PARAM(exec);
824     return jsNumber(static_cast<int>(11));
825 }
826
827 JSValue jsNodeNOTATION_NODE(ExecState* exec, JSValue, const Identifier&)
828 {
829     UNUSED_PARAM(exec);
830     return jsNumber(static_cast<int>(12));
831 }
832
833 JSValue jsNodeDOCUMENT_POSITION_DISCONNECTED(ExecState* exec, JSValue, const Identifier&)
834 {
835     UNUSED_PARAM(exec);
836     return jsNumber(static_cast<int>(0x01));
837 }
838
839 JSValue jsNodeDOCUMENT_POSITION_PRECEDING(ExecState* exec, JSValue, const Identifier&)
840 {
841     UNUSED_PARAM(exec);
842     return jsNumber(static_cast<int>(0x02));
843 }
844
845 JSValue jsNodeDOCUMENT_POSITION_FOLLOWING(ExecState* exec, JSValue, const Identifier&)
846 {
847     UNUSED_PARAM(exec);
848     return jsNumber(static_cast<int>(0x04));
849 }
850
851 JSValue jsNodeDOCUMENT_POSITION_CONTAINS(ExecState* exec, JSValue, const Identifier&)
852 {
853     UNUSED_PARAM(exec);
854     return jsNumber(static_cast<int>(0x08));
855 }
856
857 JSValue jsNodeDOCUMENT_POSITION_CONTAINED_BY(ExecState* exec, JSValue, const Identifier&)
858 {
859     UNUSED_PARAM(exec);
860     return jsNumber(static_cast<int>(0x10));
861 }
862
863 JSValue jsNodeDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC(ExecState* exec, JSValue, const Identifier&)
864 {
865     UNUSED_PARAM(exec);
866     return jsNumber(static_cast<int>(0x20));
867 }
868
869 Node* toNode(JSC::JSValue value)
870 {
871     return value.inherits(&JSNode::s_info) ? static_cast<JSNode*>(asObject(value))->impl() : 0;
872 }
873
874 }