|
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 |
|
23 #if ENABLE(WORKERS) |
|
24 |
|
25 #include "JSWorkerLocation.h" |
|
26 |
|
27 #include "KURL.h" |
|
28 #include "WorkerLocation.h" |
|
29 #include <runtime/Error.h> |
|
30 #include <runtime/JSString.h> |
|
31 #include <wtf/GetPtr.h> |
|
32 |
|
33 using namespace JSC; |
|
34 |
|
35 namespace WebCore { |
|
36 |
|
37 ASSERT_CLASS_FITS_IN_CELL(JSWorkerLocation); |
|
38 |
|
39 /* Hash table */ |
|
40 #if ENABLE(JIT) |
|
41 #define THUNK_GENERATOR(generator) , generator |
|
42 #else |
|
43 #define THUNK_GENERATOR(generator) |
|
44 #endif |
|
45 |
|
46 static const HashTableValue JSWorkerLocationTableValues[10] = |
|
47 { |
|
48 { "href", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerLocationHref), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
49 { "protocol", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerLocationProtocol), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "host", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerLocationHost), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "hostname", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerLocationHostname), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "port", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerLocationPort), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { "pathname", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerLocationPathname), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
54 { "search", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerLocationSearch), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
55 { "hash", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerLocationHash), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
56 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerLocationConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
57 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
58 }; |
|
59 |
|
60 #undef THUNK_GENERATOR |
|
61 static JSC_CONST_HASHTABLE HashTable JSWorkerLocationTable = { 35, 31, JSWorkerLocationTableValues, 0 }; |
|
62 /* Hash table for constructor */ |
|
63 #if ENABLE(JIT) |
|
64 #define THUNK_GENERATOR(generator) , generator |
|
65 #else |
|
66 #define THUNK_GENERATOR(generator) |
|
67 #endif |
|
68 |
|
69 static const HashTableValue JSWorkerLocationConstructorTableValues[1] = |
|
70 { |
|
71 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
72 }; |
|
73 |
|
74 #undef THUNK_GENERATOR |
|
75 static JSC_CONST_HASHTABLE HashTable JSWorkerLocationConstructorTable = { 1, 0, JSWorkerLocationConstructorTableValues, 0 }; |
|
76 class JSWorkerLocationConstructor : public DOMConstructorObject { |
|
77 public: |
|
78 JSWorkerLocationConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
79 |
|
80 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
81 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
82 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
83 static const JSC::ClassInfo s_info; |
|
84 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
85 { |
|
86 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
87 } |
|
88 protected: |
|
89 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
90 }; |
|
91 |
|
92 const ClassInfo JSWorkerLocationConstructor::s_info = { "WorkerLocationConstructor", 0, &JSWorkerLocationConstructorTable, 0 }; |
|
93 |
|
94 JSWorkerLocationConstructor::JSWorkerLocationConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
95 : DOMConstructorObject(JSWorkerLocationConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
96 { |
|
97 putDirect(exec->propertyNames().prototype, JSWorkerLocationPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
98 } |
|
99 |
|
100 bool JSWorkerLocationConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
101 { |
|
102 return getStaticValueSlot<JSWorkerLocationConstructor, DOMObject>(exec, &JSWorkerLocationConstructorTable, this, propertyName, slot); |
|
103 } |
|
104 |
|
105 bool JSWorkerLocationConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
106 { |
|
107 return getStaticValueDescriptor<JSWorkerLocationConstructor, DOMObject>(exec, &JSWorkerLocationConstructorTable, this, propertyName, descriptor); |
|
108 } |
|
109 |
|
110 /* Hash table for prototype */ |
|
111 #if ENABLE(JIT) |
|
112 #define THUNK_GENERATOR(generator) , generator |
|
113 #else |
|
114 #define THUNK_GENERATOR(generator) |
|
115 #endif |
|
116 |
|
117 static const HashTableValue JSWorkerLocationPrototypeTableValues[2] = |
|
118 { |
|
119 { "toString", DontDelete | DontEnum | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerLocationPrototypeFunctionToString), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
120 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
121 }; |
|
122 |
|
123 #undef THUNK_GENERATOR |
|
124 static JSC_CONST_HASHTABLE HashTable JSWorkerLocationPrototypeTable = { 2, 1, JSWorkerLocationPrototypeTableValues, 0 }; |
|
125 static const HashTable* getJSWorkerLocationPrototypeTable(ExecState* exec) |
|
126 { |
|
127 return getHashTableForGlobalData(exec->globalData(), &JSWorkerLocationPrototypeTable); |
|
128 } |
|
129 const ClassInfo JSWorkerLocationPrototype::s_info = { "WorkerLocationPrototype", 0, 0, getJSWorkerLocationPrototypeTable }; |
|
130 |
|
131 JSObject* JSWorkerLocationPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
132 { |
|
133 return getDOMPrototype<JSWorkerLocation>(exec, globalObject); |
|
134 } |
|
135 |
|
136 bool JSWorkerLocationPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
137 { |
|
138 return getStaticFunctionSlot<JSObject>(exec, getJSWorkerLocationPrototypeTable(exec), this, propertyName, slot); |
|
139 } |
|
140 |
|
141 bool JSWorkerLocationPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
142 { |
|
143 return getStaticFunctionDescriptor<JSObject>(exec, getJSWorkerLocationPrototypeTable(exec), this, propertyName, descriptor); |
|
144 } |
|
145 |
|
146 static const HashTable* getJSWorkerLocationTable(ExecState* exec) |
|
147 { |
|
148 return getHashTableForGlobalData(exec->globalData(), &JSWorkerLocationTable); |
|
149 } |
|
150 const ClassInfo JSWorkerLocation::s_info = { "WorkerLocation", 0, 0, getJSWorkerLocationTable }; |
|
151 |
|
152 JSWorkerLocation::JSWorkerLocation(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<WorkerLocation> impl) |
|
153 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
154 , m_impl(impl) |
|
155 { |
|
156 } |
|
157 |
|
158 JSWorkerLocation::~JSWorkerLocation() |
|
159 { |
|
160 forgetDOMObject(this, impl()); |
|
161 } |
|
162 |
|
163 JSObject* JSWorkerLocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
164 { |
|
165 return new (exec) JSWorkerLocationPrototype(globalObject, JSWorkerLocationPrototype::createStructure(globalObject->objectPrototype())); |
|
166 } |
|
167 |
|
168 bool JSWorkerLocation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
169 { |
|
170 return getStaticValueSlot<JSWorkerLocation, Base>(exec, getJSWorkerLocationTable(exec), this, propertyName, slot); |
|
171 } |
|
172 |
|
173 bool JSWorkerLocation::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
174 { |
|
175 return getStaticValueDescriptor<JSWorkerLocation, Base>(exec, getJSWorkerLocationTable(exec), this, propertyName, descriptor); |
|
176 } |
|
177 |
|
178 JSValue jsWorkerLocationHref(ExecState* exec, JSValue slotBase, const Identifier&) |
|
179 { |
|
180 JSWorkerLocation* castedThis = static_cast<JSWorkerLocation*>(asObject(slotBase)); |
|
181 UNUSED_PARAM(exec); |
|
182 WorkerLocation* imp = static_cast<WorkerLocation*>(castedThis->impl()); |
|
183 JSValue result = jsString(exec, imp->href()); |
|
184 return result; |
|
185 } |
|
186 |
|
187 JSValue jsWorkerLocationProtocol(ExecState* exec, JSValue slotBase, const Identifier&) |
|
188 { |
|
189 JSWorkerLocation* castedThis = static_cast<JSWorkerLocation*>(asObject(slotBase)); |
|
190 UNUSED_PARAM(exec); |
|
191 WorkerLocation* imp = static_cast<WorkerLocation*>(castedThis->impl()); |
|
192 JSValue result = jsString(exec, imp->protocol()); |
|
193 return result; |
|
194 } |
|
195 |
|
196 JSValue jsWorkerLocationHost(ExecState* exec, JSValue slotBase, const Identifier&) |
|
197 { |
|
198 JSWorkerLocation* castedThis = static_cast<JSWorkerLocation*>(asObject(slotBase)); |
|
199 UNUSED_PARAM(exec); |
|
200 WorkerLocation* imp = static_cast<WorkerLocation*>(castedThis->impl()); |
|
201 JSValue result = jsString(exec, imp->host()); |
|
202 return result; |
|
203 } |
|
204 |
|
205 JSValue jsWorkerLocationHostname(ExecState* exec, JSValue slotBase, const Identifier&) |
|
206 { |
|
207 JSWorkerLocation* castedThis = static_cast<JSWorkerLocation*>(asObject(slotBase)); |
|
208 UNUSED_PARAM(exec); |
|
209 WorkerLocation* imp = static_cast<WorkerLocation*>(castedThis->impl()); |
|
210 JSValue result = jsString(exec, imp->hostname()); |
|
211 return result; |
|
212 } |
|
213 |
|
214 JSValue jsWorkerLocationPort(ExecState* exec, JSValue slotBase, const Identifier&) |
|
215 { |
|
216 JSWorkerLocation* castedThis = static_cast<JSWorkerLocation*>(asObject(slotBase)); |
|
217 UNUSED_PARAM(exec); |
|
218 WorkerLocation* imp = static_cast<WorkerLocation*>(castedThis->impl()); |
|
219 JSValue result = jsString(exec, imp->port()); |
|
220 return result; |
|
221 } |
|
222 |
|
223 JSValue jsWorkerLocationPathname(ExecState* exec, JSValue slotBase, const Identifier&) |
|
224 { |
|
225 JSWorkerLocation* castedThis = static_cast<JSWorkerLocation*>(asObject(slotBase)); |
|
226 UNUSED_PARAM(exec); |
|
227 WorkerLocation* imp = static_cast<WorkerLocation*>(castedThis->impl()); |
|
228 JSValue result = jsString(exec, imp->pathname()); |
|
229 return result; |
|
230 } |
|
231 |
|
232 JSValue jsWorkerLocationSearch(ExecState* exec, JSValue slotBase, const Identifier&) |
|
233 { |
|
234 JSWorkerLocation* castedThis = static_cast<JSWorkerLocation*>(asObject(slotBase)); |
|
235 UNUSED_PARAM(exec); |
|
236 WorkerLocation* imp = static_cast<WorkerLocation*>(castedThis->impl()); |
|
237 JSValue result = jsString(exec, imp->search()); |
|
238 return result; |
|
239 } |
|
240 |
|
241 JSValue jsWorkerLocationHash(ExecState* exec, JSValue slotBase, const Identifier&) |
|
242 { |
|
243 JSWorkerLocation* castedThis = static_cast<JSWorkerLocation*>(asObject(slotBase)); |
|
244 UNUSED_PARAM(exec); |
|
245 WorkerLocation* imp = static_cast<WorkerLocation*>(castedThis->impl()); |
|
246 JSValue result = jsString(exec, imp->hash()); |
|
247 return result; |
|
248 } |
|
249 |
|
250 JSValue jsWorkerLocationConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
251 { |
|
252 JSWorkerLocation* domObject = static_cast<JSWorkerLocation*>(asObject(slotBase)); |
|
253 return JSWorkerLocation::getConstructor(exec, domObject->globalObject()); |
|
254 } |
|
255 JSValue JSWorkerLocation::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
256 { |
|
257 return getDOMConstructor<JSWorkerLocationConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
258 } |
|
259 |
|
260 EncodedJSValue JSC_HOST_CALL jsWorkerLocationPrototypeFunctionToString(ExecState* exec) |
|
261 { |
|
262 JSValue thisValue = exec->hostThisValue(); |
|
263 if (!thisValue.inherits(&JSWorkerLocation::s_info)) |
|
264 return throwVMTypeError(exec); |
|
265 JSWorkerLocation* castedThis = static_cast<JSWorkerLocation*>(asObject(thisValue)); |
|
266 WorkerLocation* imp = static_cast<WorkerLocation*>(castedThis->impl()); |
|
267 |
|
268 |
|
269 JSC::JSValue result = jsString(exec, imp->toString()); |
|
270 return JSValue::encode(result); |
|
271 } |
|
272 |
|
273 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WorkerLocation* object) |
|
274 { |
|
275 return getDOMObjectWrapper<JSWorkerLocation>(exec, globalObject, object); |
|
276 } |
|
277 WorkerLocation* toWorkerLocation(JSC::JSValue value) |
|
278 { |
|
279 return value.inherits(&JSWorkerLocation::s_info) ? static_cast<JSWorkerLocation*>(asObject(value))->impl() : 0; |
|
280 } |
|
281 |
|
282 } |
|
283 |
|
284 #endif // ENABLE(WORKERS) |