|
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 "JSXMLSerializer.h" |
|
23 |
|
24 #include "JSNode.h" |
|
25 #include "KURL.h" |
|
26 #include "XMLSerializer.h" |
|
27 #include <runtime/Error.h> |
|
28 #include <runtime/JSString.h> |
|
29 #include <wtf/GetPtr.h> |
|
30 |
|
31 using namespace JSC; |
|
32 |
|
33 namespace WebCore { |
|
34 |
|
35 ASSERT_CLASS_FITS_IN_CELL(JSXMLSerializer); |
|
36 |
|
37 /* Hash table */ |
|
38 #if ENABLE(JIT) |
|
39 #define THUNK_GENERATOR(generator) , generator |
|
40 #else |
|
41 #define THUNK_GENERATOR(generator) |
|
42 #endif |
|
43 |
|
44 static const HashTableValue JSXMLSerializerTableValues[2] = |
|
45 { |
|
46 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLSerializerConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
47 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
48 }; |
|
49 |
|
50 #undef THUNK_GENERATOR |
|
51 static JSC_CONST_HASHTABLE HashTable JSXMLSerializerTable = { 2, 1, JSXMLSerializerTableValues, 0 }; |
|
52 /* Hash table for constructor */ |
|
53 #if ENABLE(JIT) |
|
54 #define THUNK_GENERATOR(generator) , generator |
|
55 #else |
|
56 #define THUNK_GENERATOR(generator) |
|
57 #endif |
|
58 |
|
59 static const HashTableValue JSXMLSerializerConstructorTableValues[1] = |
|
60 { |
|
61 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
62 }; |
|
63 |
|
64 #undef THUNK_GENERATOR |
|
65 static JSC_CONST_HASHTABLE HashTable JSXMLSerializerConstructorTable = { 1, 0, JSXMLSerializerConstructorTableValues, 0 }; |
|
66 class JSXMLSerializerConstructor : public DOMConstructorObject { |
|
67 public: |
|
68 JSXMLSerializerConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
69 |
|
70 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
71 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
72 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
73 static const JSC::ClassInfo s_info; |
|
74 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
75 { |
|
76 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
77 } |
|
78 protected: |
|
79 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
80 static JSC::EncodedJSValue JSC_HOST_CALL constructJSXMLSerializer(JSC::ExecState*); |
|
81 virtual JSC::ConstructType getConstructData(JSC::ConstructData&); |
|
82 }; |
|
83 |
|
84 const ClassInfo JSXMLSerializerConstructor::s_info = { "XMLSerializerConstructor", 0, &JSXMLSerializerConstructorTable, 0 }; |
|
85 |
|
86 JSXMLSerializerConstructor::JSXMLSerializerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
87 : DOMConstructorObject(JSXMLSerializerConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
88 { |
|
89 putDirect(exec->propertyNames().prototype, JSXMLSerializerPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
90 } |
|
91 |
|
92 bool JSXMLSerializerConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
93 { |
|
94 return getStaticValueSlot<JSXMLSerializerConstructor, DOMObject>(exec, &JSXMLSerializerConstructorTable, this, propertyName, slot); |
|
95 } |
|
96 |
|
97 bool JSXMLSerializerConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
98 { |
|
99 return getStaticValueDescriptor<JSXMLSerializerConstructor, DOMObject>(exec, &JSXMLSerializerConstructorTable, this, propertyName, descriptor); |
|
100 } |
|
101 |
|
102 EncodedJSValue JSC_HOST_CALL JSXMLSerializerConstructor::constructJSXMLSerializer(ExecState* exec) |
|
103 { |
|
104 return JSValue::encode(asObject(toJS(exec, static_cast<JSXMLSerializerConstructor*>(exec->callee())->globalObject(), XMLSerializer::create()))); |
|
105 } |
|
106 |
|
107 ConstructType JSXMLSerializerConstructor::getConstructData(ConstructData& constructData) |
|
108 { |
|
109 constructData.native.function = constructJSXMLSerializer; |
|
110 return ConstructTypeHost; |
|
111 } |
|
112 |
|
113 /* Hash table for prototype */ |
|
114 #if ENABLE(JIT) |
|
115 #define THUNK_GENERATOR(generator) , generator |
|
116 #else |
|
117 #define THUNK_GENERATOR(generator) |
|
118 #endif |
|
119 |
|
120 static const HashTableValue JSXMLSerializerPrototypeTableValues[2] = |
|
121 { |
|
122 { "serializeToString", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLSerializerPrototypeFunctionSerializeToString), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
123 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
124 }; |
|
125 |
|
126 #undef THUNK_GENERATOR |
|
127 static JSC_CONST_HASHTABLE HashTable JSXMLSerializerPrototypeTable = { 2, 1, JSXMLSerializerPrototypeTableValues, 0 }; |
|
128 const ClassInfo JSXMLSerializerPrototype::s_info = { "XMLSerializerPrototype", 0, &JSXMLSerializerPrototypeTable, 0 }; |
|
129 |
|
130 JSObject* JSXMLSerializerPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
131 { |
|
132 return getDOMPrototype<JSXMLSerializer>(exec, globalObject); |
|
133 } |
|
134 |
|
135 bool JSXMLSerializerPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
136 { |
|
137 return getStaticFunctionSlot<JSObject>(exec, &JSXMLSerializerPrototypeTable, this, propertyName, slot); |
|
138 } |
|
139 |
|
140 bool JSXMLSerializerPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
141 { |
|
142 return getStaticFunctionDescriptor<JSObject>(exec, &JSXMLSerializerPrototypeTable, this, propertyName, descriptor); |
|
143 } |
|
144 |
|
145 const ClassInfo JSXMLSerializer::s_info = { "XMLSerializer", 0, &JSXMLSerializerTable, 0 }; |
|
146 |
|
147 JSXMLSerializer::JSXMLSerializer(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<XMLSerializer> impl) |
|
148 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
149 , m_impl(impl) |
|
150 { |
|
151 } |
|
152 |
|
153 JSXMLSerializer::~JSXMLSerializer() |
|
154 { |
|
155 forgetDOMObject(this, impl()); |
|
156 } |
|
157 |
|
158 JSObject* JSXMLSerializer::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
159 { |
|
160 return new (exec) JSXMLSerializerPrototype(globalObject, JSXMLSerializerPrototype::createStructure(globalObject->objectPrototype())); |
|
161 } |
|
162 |
|
163 bool JSXMLSerializer::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
164 { |
|
165 return getStaticValueSlot<JSXMLSerializer, Base>(exec, &JSXMLSerializerTable, this, propertyName, slot); |
|
166 } |
|
167 |
|
168 bool JSXMLSerializer::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
169 { |
|
170 return getStaticValueDescriptor<JSXMLSerializer, Base>(exec, &JSXMLSerializerTable, this, propertyName, descriptor); |
|
171 } |
|
172 |
|
173 JSValue jsXMLSerializerConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
174 { |
|
175 JSXMLSerializer* domObject = static_cast<JSXMLSerializer*>(asObject(slotBase)); |
|
176 return JSXMLSerializer::getConstructor(exec, domObject->globalObject()); |
|
177 } |
|
178 JSValue JSXMLSerializer::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
179 { |
|
180 return getDOMConstructor<JSXMLSerializerConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
181 } |
|
182 |
|
183 EncodedJSValue JSC_HOST_CALL jsXMLSerializerPrototypeFunctionSerializeToString(ExecState* exec) |
|
184 { |
|
185 JSValue thisValue = exec->hostThisValue(); |
|
186 if (!thisValue.inherits(&JSXMLSerializer::s_info)) |
|
187 return throwVMTypeError(exec); |
|
188 JSXMLSerializer* castedThis = static_cast<JSXMLSerializer*>(asObject(thisValue)); |
|
189 XMLSerializer* imp = static_cast<XMLSerializer*>(castedThis->impl()); |
|
190 ExceptionCode ec = 0; |
|
191 Node* node = toNode(exec->argument(0)); |
|
192 |
|
193 |
|
194 JSC::JSValue result = jsString(exec, imp->serializeToString(node, ec)); |
|
195 setDOMException(exec, ec); |
|
196 return JSValue::encode(result); |
|
197 } |
|
198 |
|
199 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XMLSerializer* object) |
|
200 { |
|
201 return getDOMObjectWrapper<JSXMLSerializer>(exec, globalObject, object); |
|
202 } |
|
203 XMLSerializer* toXMLSerializer(JSC::JSValue value) |
|
204 { |
|
205 return value.inherits(&JSXMLSerializer::s_info) ? static_cast<JSXMLSerializer*>(asObject(value))->impl() : 0; |
|
206 } |
|
207 |
|
208 } |