2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
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.
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.
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.
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
29 #include "JSDocument.h"
30 #include "JSElement.h"
32 #include "JSEventListener.h"
33 #include "JSNamedNodeMap.h"
35 #include "JSNodeList.h"
37 #include "NameNodeList.h"
38 #include "NamedNodeMap.h"
41 #include <runtime/Error.h>
42 #include <wtf/GetPtr.h>
48 ASSERT_CLASS_FITS_IN_CELL(JSNode);
52 #define THUNK_GENERATOR(generator) , generator
54 #define THUNK_GENERATOR(generator)
57 #define INTRINSIC(intrinsic) , intrinsic
59 #define INTRINSIC(intrinsic)
62 static const HashTableValue JSNodeTableValues[] =
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) }
85 #undef THUNK_GENERATOR
86 static const HashTable JSNodeTable = { 68, 63, JSNodeTableValues, 0 };
87 /* Hash table for constructor */
89 #define THUNK_GENERATOR(generator) , generator
91 #define THUNK_GENERATOR(generator)
94 #define INTRINSIC(intrinsic) , intrinsic
96 #define INTRINSIC(intrinsic)
99 static const HashTableValue JSNodeConstructorTableValues[] =
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) }
122 #undef THUNK_GENERATOR
123 static const HashTable JSNodeConstructorTable = { 67, 63, JSNodeConstructorTableValues, 0 };
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);
144 const ClassInfo JSNodeConstructor::s_info = { "NodeConstructor", &DOMConstructorObject::s_info, &JSNodeConstructorTable, 0, CREATE_METHOD_TABLE(JSNodeConstructor) };
146 JSNodeConstructor::JSNodeConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
147 : DOMConstructorObject(structure, globalObject)
151 void JSNodeConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
153 Base::finishCreation(exec->globalData());
154 ASSERT(inherits(&s_info));
155 putDirect(exec->globalData(), exec->propertyNames().prototype, JSNodePrototype::self(exec, globalObject), DontDelete | ReadOnly);
158 bool JSNodeConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
160 return getStaticValueSlot<JSNodeConstructor, JSDOMWrapper>(exec, &JSNodeConstructorTable, static_cast<JSNodeConstructor*>(cell), propertyName, slot);
163 bool JSNodeConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
165 return getStaticValueDescriptor<JSNodeConstructor, JSDOMWrapper>(exec, &JSNodeConstructorTable, static_cast<JSNodeConstructor*>(object), propertyName, descriptor);
168 /* Hash table for prototype */
170 #define THUNK_GENERATOR(generator) , generator
172 #define THUNK_GENERATOR(generator)
175 #define INTRINSIC(intrinsic) , intrinsic
177 #define INTRINSIC(intrinsic)
180 static const HashTableValue JSNodePrototypeTableValues[] =
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) }
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) };
226 JSObject* JSNodePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
228 return getDOMPrototype<JSNode>(exec, globalObject);
231 bool JSNodePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
233 JSNodePrototype* thisObject = jsCast<JSNodePrototype*>(cell);
234 return getStaticPropertySlot<JSNodePrototype, JSObject>(exec, &JSNodePrototypeTable, thisObject, propertyName, slot);
237 bool JSNodePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
239 JSNodePrototype* thisObject = jsCast<JSNodePrototype*>(object);
240 return getStaticPropertyDescriptor<JSNodePrototype, JSObject>(exec, &JSNodePrototypeTable, thisObject, propertyName, descriptor);
243 const ClassInfo JSNode::s_info = { "Node", &JSDOMWrapper::s_info, &JSNodeTable, 0 , CREATE_METHOD_TABLE(JSNode) };
245 JSNode::JSNode(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Node> impl)
246 : JSDOMWrapper(structure, globalObject)
247 , m_impl(impl.leakRef())
251 void JSNode::finishCreation(JSGlobalData& globalData)
253 Base::finishCreation(globalData);
254 ASSERT(inherits(&s_info));
257 JSObject* JSNode::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
259 return JSNodePrototype::create(exec->globalData(), globalObject, JSNodePrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
262 JSValue jsNodeNodeName(ExecState* exec, JSValue slotBase, const Identifier&)
264 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
266 Node* imp = static_cast<Node*>(castedThis->impl());
267 JSValue result = jsStringOrNull(exec, imp->nodeName());
272 JSValue jsNodeNodeValue(ExecState* exec, JSValue slotBase, const Identifier&)
274 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
276 Node* imp = static_cast<Node*>(castedThis->impl());
277 JSValue result = jsStringOrNull(exec, imp->nodeValue());
282 JSValue jsNodeNodeType(ExecState* exec, JSValue slotBase, const Identifier&)
284 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
286 Node* imp = static_cast<Node*>(castedThis->impl());
287 JSValue result = jsNumber(imp->nodeType());
292 JSValue jsNodeParentNode(ExecState* exec, JSValue slotBase, const Identifier&)
294 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
296 Node* imp = static_cast<Node*>(castedThis->impl());
297 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentNode()));
302 JSValue jsNodeChildNodes(ExecState* exec, JSValue slotBase, const Identifier&)
304 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
306 Node* imp = static_cast<Node*>(castedThis->impl());
307 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->childNodes()));
312 JSValue jsNodeFirstChild(ExecState* exec, JSValue slotBase, const Identifier&)
314 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
316 Node* imp = static_cast<Node*>(castedThis->impl());
317 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->firstChild()));
322 JSValue jsNodeLastChild(ExecState* exec, JSValue slotBase, const Identifier&)
324 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
326 Node* imp = static_cast<Node*>(castedThis->impl());
327 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->lastChild()));
332 JSValue jsNodePreviousSibling(ExecState* exec, JSValue slotBase, const Identifier&)
334 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
336 Node* imp = static_cast<Node*>(castedThis->impl());
337 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->previousSibling()));
342 JSValue jsNodeNextSibling(ExecState* exec, JSValue slotBase, const Identifier&)
344 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
346 Node* imp = static_cast<Node*>(castedThis->impl());
347 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->nextSibling()));
352 JSValue jsNodeAttributes(ExecState* exec, JSValue slotBase, const Identifier&)
354 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
356 Node* imp = static_cast<Node*>(castedThis->impl());
357 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->attributes()));
362 JSValue jsNodeOwnerDocument(ExecState* exec, JSValue slotBase, const Identifier&)
364 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
366 Node* imp = static_cast<Node*>(castedThis->impl());
367 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->ownerDocument()));
372 JSValue jsNodeNamespaceURI(ExecState* exec, JSValue slotBase, const Identifier&)
374 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
376 Node* imp = static_cast<Node*>(castedThis->impl());
377 JSValue result = jsStringOrNull(exec, imp->namespaceURI());
382 JSValue jsNodePrefix(ExecState* exec, JSValue slotBase, const Identifier&)
384 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
386 Node* imp = static_cast<Node*>(castedThis->impl());
387 JSValue result = jsStringOrNull(exec, imp->prefix());
392 JSValue jsNodeLocalName(ExecState* exec, JSValue slotBase, const Identifier&)
394 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
396 Node* imp = static_cast<Node*>(castedThis->impl());
397 JSValue result = jsStringOrNull(exec, imp->localName());
402 JSValue jsNodeBaseURI(ExecState* exec, JSValue slotBase, const Identifier&)
404 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
406 Node* imp = static_cast<Node*>(castedThis->impl());
407 JSValue result = jsStringOrNull(exec, imp->baseURI());
412 JSValue jsNodeTextContent(ExecState* exec, JSValue slotBase, const Identifier&)
414 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
416 Node* imp = static_cast<Node*>(castedThis->impl());
417 JSValue result = jsStringOrNull(exec, imp->textContent());
422 JSValue jsNodeParentElement(ExecState* exec, JSValue slotBase, const Identifier&)
424 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase));
426 Node* imp = static_cast<Node*>(castedThis->impl());
427 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentElement()));
432 JSValue jsNodeConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
434 JSNode* domObject = static_cast<JSNode*>(asObject(slotBase));
435 return JSNode::getConstructor(exec, domObject->globalObject());
438 void JSNode::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
440 JSNode* thisObject = jsCast<JSNode*>(cell);
441 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
442 lookupPut<JSNode, Base>(exec, propertyName, value, &JSNodeTable, thisObject, slot);
445 void setJSNodeNodeValue(ExecState* exec, JSObject* thisObject, JSValue value)
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);
455 void setJSNodePrefix(ExecState* exec, JSObject* thisObject, JSValue value)
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);
465 void setJSNodeTextContent(ExecState* exec, JSObject* thisObject, JSValue value)
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);
475 JSValue JSNode::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
477 return getDOMConstructor<JSNodeConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
480 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionInsertBefore(ExecState* exec)
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));
490 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionReplaceChild(ExecState* exec)
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));
500 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionRemoveChild(ExecState* exec)
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));
510 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionAppendChild(ExecState* exec)
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));
520 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionHasChildNodes(ExecState* exec)
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());
529 JSC::JSValue result = jsBoolean(imp->hasChildNodes());
530 return JSValue::encode(result);
533 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionCloneNode(ExecState* exec)
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());
545 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->cloneNode(deep)));
546 return JSValue::encode(result);
549 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionNormalize(ExecState* exec)
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());
558 return JSValue::encode(jsUndefined());
561 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsSupported(ExecState* exec)
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());
576 JSC::JSValue result = jsBoolean(imp->isSupported(feature, version));
577 return JSValue::encode(result);
580 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionHasAttributes(ExecState* exec)
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());
589 JSC::JSValue result = jsBoolean(imp->hasAttributes());
590 return JSValue::encode(result);
593 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsSameNode(ExecState* exec)
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());
605 JSC::JSValue result = jsBoolean(imp->isSameNode(other));
606 return JSValue::encode(result);
609 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsEqualNode(ExecState* exec)
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());
621 JSC::JSValue result = jsBoolean(imp->isEqualNode(other));
622 return JSValue::encode(result);
625 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionLookupPrefix(ExecState* exec)
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());
637 JSC::JSValue result = jsStringOrNull(exec, imp->lookupPrefix(namespaceURI));
638 return JSValue::encode(result);
641 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsDefaultNamespace(ExecState* exec)
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());
653 JSC::JSValue result = jsBoolean(imp->isDefaultNamespace(namespaceURI));
654 return JSValue::encode(result);
657 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionLookupNamespaceURI(ExecState* exec)
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());
669 JSC::JSValue result = jsStringOrNull(exec, imp->lookupNamespaceURI(prefix));
670 return JSValue::encode(result);
673 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionCompareDocumentPosition(ExecState* exec)
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());
685 JSC::JSValue result = jsNumber(imp->compareDocumentPosition(other));
686 return JSValue::encode(result);
689 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionContains(ExecState* exec)
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());
701 JSC::JSValue result = jsBoolean(imp->contains(other));
702 return JSValue::encode(result);
705 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionAddEventListener(ExecState* exec)
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());
722 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionRemoveEventListener(ExecState* exec)
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());
739 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionDispatchEvent(ExecState* exec)
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());
754 JSC::JSValue result = jsBoolean(imp->dispatchEvent(event, ec));
755 setDOMException(exec, ec);
756 return JSValue::encode(result);
761 JSValue jsNodeELEMENT_NODE(ExecState* exec, JSValue, const Identifier&)
764 return jsNumber(static_cast<int>(1));
767 JSValue jsNodeATTRIBUTE_NODE(ExecState* exec, JSValue, const Identifier&)
770 return jsNumber(static_cast<int>(2));
773 JSValue jsNodeTEXT_NODE(ExecState* exec, JSValue, const Identifier&)
776 return jsNumber(static_cast<int>(3));
779 JSValue jsNodeCDATA_SECTION_NODE(ExecState* exec, JSValue, const Identifier&)
782 return jsNumber(static_cast<int>(4));
785 JSValue jsNodeENTITY_REFERENCE_NODE(ExecState* exec, JSValue, const Identifier&)
788 return jsNumber(static_cast<int>(5));
791 JSValue jsNodeENTITY_NODE(ExecState* exec, JSValue, const Identifier&)
794 return jsNumber(static_cast<int>(6));
797 JSValue jsNodePROCESSING_INSTRUCTION_NODE(ExecState* exec, JSValue, const Identifier&)
800 return jsNumber(static_cast<int>(7));
803 JSValue jsNodeCOMMENT_NODE(ExecState* exec, JSValue, const Identifier&)
806 return jsNumber(static_cast<int>(8));
809 JSValue jsNodeDOCUMENT_NODE(ExecState* exec, JSValue, const Identifier&)
812 return jsNumber(static_cast<int>(9));
815 JSValue jsNodeDOCUMENT_TYPE_NODE(ExecState* exec, JSValue, const Identifier&)
818 return jsNumber(static_cast<int>(10));
821 JSValue jsNodeDOCUMENT_FRAGMENT_NODE(ExecState* exec, JSValue, const Identifier&)
824 return jsNumber(static_cast<int>(11));
827 JSValue jsNodeNOTATION_NODE(ExecState* exec, JSValue, const Identifier&)
830 return jsNumber(static_cast<int>(12));
833 JSValue jsNodeDOCUMENT_POSITION_DISCONNECTED(ExecState* exec, JSValue, const Identifier&)
836 return jsNumber(static_cast<int>(0x01));
839 JSValue jsNodeDOCUMENT_POSITION_PRECEDING(ExecState* exec, JSValue, const Identifier&)
842 return jsNumber(static_cast<int>(0x02));
845 JSValue jsNodeDOCUMENT_POSITION_FOLLOWING(ExecState* exec, JSValue, const Identifier&)
848 return jsNumber(static_cast<int>(0x04));
851 JSValue jsNodeDOCUMENT_POSITION_CONTAINS(ExecState* exec, JSValue, const Identifier&)
854 return jsNumber(static_cast<int>(0x08));
857 JSValue jsNodeDOCUMENT_POSITION_CONTAINED_BY(ExecState* exec, JSValue, const Identifier&)
860 return jsNumber(static_cast<int>(0x10));
863 JSValue jsNodeDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC(ExecState* exec, JSValue, const Identifier&)
866 return jsNumber(static_cast<int>(0x20));
869 Node* toNode(JSC::JSValue value)
871 return value.inherits(&JSNode::s_info) ? static_cast<JSNode*>(asObject(value))->impl() : 0;