|
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 "JSLocation.h" |
|
23 |
|
24 #include "JSLocationCustom.h" |
|
25 #include "KURL.h" |
|
26 #include "Location.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(JSLocation); |
|
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 JSLocationTableValues[9] = |
|
45 { |
|
46 { "href", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsLocationHref), (intptr_t)setJSLocationHref THUNK_GENERATOR(0) }, |
|
47 { "protocol", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsLocationProtocol), (intptr_t)setJSLocationProtocol THUNK_GENERATOR(0) }, |
|
48 { "host", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsLocationHost), (intptr_t)setJSLocationHost THUNK_GENERATOR(0) }, |
|
49 { "hostname", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsLocationHostname), (intptr_t)setJSLocationHostname THUNK_GENERATOR(0) }, |
|
50 { "port", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsLocationPort), (intptr_t)setJSLocationPort THUNK_GENERATOR(0) }, |
|
51 { "pathname", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsLocationPathname), (intptr_t)setJSLocationPathname THUNK_GENERATOR(0) }, |
|
52 { "search", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsLocationSearch), (intptr_t)setJSLocationSearch THUNK_GENERATOR(0) }, |
|
53 { "hash", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsLocationHash), (intptr_t)setJSLocationHash THUNK_GENERATOR(0) }, |
|
54 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
55 }; |
|
56 |
|
57 #undef THUNK_GENERATOR |
|
58 static JSC_CONST_HASHTABLE HashTable JSLocationTable = { 19, 15, JSLocationTableValues, 0 }; |
|
59 /* Hash table for prototype */ |
|
60 #if ENABLE(JIT) |
|
61 #define THUNK_GENERATOR(generator) , generator |
|
62 #else |
|
63 #define THUNK_GENERATOR(generator) |
|
64 #endif |
|
65 |
|
66 static const HashTableValue JSLocationPrototypeTableValues[5] = |
|
67 { |
|
68 { "assign", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsLocationPrototypeFunctionAssign), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
69 { "replace", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsLocationPrototypeFunctionReplace), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
70 { "reload", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsLocationPrototypeFunctionReload), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
71 { "toString", DontDelete | DontEnum | Function, (intptr_t)static_cast<NativeFunction>(jsLocationPrototypeFunctionToString), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
72 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
73 }; |
|
74 |
|
75 #undef THUNK_GENERATOR |
|
76 static JSC_CONST_HASHTABLE HashTable JSLocationPrototypeTable = { 9, 7, JSLocationPrototypeTableValues, 0 }; |
|
77 const ClassInfo JSLocationPrototype::s_info = { "LocationPrototype", 0, &JSLocationPrototypeTable, 0 }; |
|
78 |
|
79 JSObject* JSLocationPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
80 { |
|
81 return getDOMPrototype<JSLocation>(exec, globalObject); |
|
82 } |
|
83 |
|
84 bool JSLocationPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
85 { |
|
86 return getStaticFunctionSlot<JSObject>(exec, &JSLocationPrototypeTable, this, propertyName, slot); |
|
87 } |
|
88 |
|
89 bool JSLocationPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
90 { |
|
91 return getStaticFunctionDescriptor<JSObject>(exec, &JSLocationPrototypeTable, this, propertyName, descriptor); |
|
92 } |
|
93 |
|
94 void JSLocationPrototype::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
95 { |
|
96 if (putDelegate(exec, propertyName, value, slot)) |
|
97 return; |
|
98 Base::put(exec, propertyName, value, slot); |
|
99 } |
|
100 |
|
101 const ClassInfo JSLocation::s_info = { "Location", 0, &JSLocationTable, 0 }; |
|
102 |
|
103 JSLocation::JSLocation(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Location> impl) |
|
104 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
105 , m_impl(impl) |
|
106 { |
|
107 } |
|
108 |
|
109 JSLocation::~JSLocation() |
|
110 { |
|
111 forgetDOMObject(this, impl()); |
|
112 } |
|
113 |
|
114 JSObject* JSLocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
115 { |
|
116 return new (exec) JSLocationPrototype(globalObject, JSLocationPrototype::createStructure(globalObject->objectPrototype())); |
|
117 } |
|
118 |
|
119 bool JSLocation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
120 { |
|
121 if (getOwnPropertySlotDelegate(exec, propertyName, slot)) |
|
122 return true; |
|
123 return getStaticValueSlot<JSLocation, Base>(exec, &JSLocationTable, this, propertyName, slot); |
|
124 } |
|
125 |
|
126 bool JSLocation::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
127 { |
|
128 if (getOwnPropertyDescriptorDelegate(exec, propertyName, descriptor)) |
|
129 return true; |
|
130 return getStaticValueDescriptor<JSLocation, Base>(exec, &JSLocationTable, this, propertyName, descriptor); |
|
131 } |
|
132 |
|
133 JSValue jsLocationHref(ExecState* exec, JSValue slotBase, const Identifier&) |
|
134 { |
|
135 JSLocation* castedThis = static_cast<JSLocation*>(asObject(slotBase)); |
|
136 UNUSED_PARAM(exec); |
|
137 Location* imp = static_cast<Location*>(castedThis->impl()); |
|
138 JSValue result = jsString(exec, imp->href()); |
|
139 return result; |
|
140 } |
|
141 |
|
142 JSValue jsLocationProtocol(ExecState* exec, JSValue slotBase, const Identifier&) |
|
143 { |
|
144 JSLocation* castedThis = static_cast<JSLocation*>(asObject(slotBase)); |
|
145 UNUSED_PARAM(exec); |
|
146 Location* imp = static_cast<Location*>(castedThis->impl()); |
|
147 JSValue result = jsString(exec, imp->protocol()); |
|
148 return result; |
|
149 } |
|
150 |
|
151 JSValue jsLocationHost(ExecState* exec, JSValue slotBase, const Identifier&) |
|
152 { |
|
153 JSLocation* castedThis = static_cast<JSLocation*>(asObject(slotBase)); |
|
154 UNUSED_PARAM(exec); |
|
155 Location* imp = static_cast<Location*>(castedThis->impl()); |
|
156 JSValue result = jsString(exec, imp->host()); |
|
157 return result; |
|
158 } |
|
159 |
|
160 JSValue jsLocationHostname(ExecState* exec, JSValue slotBase, const Identifier&) |
|
161 { |
|
162 JSLocation* castedThis = static_cast<JSLocation*>(asObject(slotBase)); |
|
163 UNUSED_PARAM(exec); |
|
164 Location* imp = static_cast<Location*>(castedThis->impl()); |
|
165 JSValue result = jsString(exec, imp->hostname()); |
|
166 return result; |
|
167 } |
|
168 |
|
169 JSValue jsLocationPort(ExecState* exec, JSValue slotBase, const Identifier&) |
|
170 { |
|
171 JSLocation* castedThis = static_cast<JSLocation*>(asObject(slotBase)); |
|
172 UNUSED_PARAM(exec); |
|
173 Location* imp = static_cast<Location*>(castedThis->impl()); |
|
174 JSValue result = jsString(exec, imp->port()); |
|
175 return result; |
|
176 } |
|
177 |
|
178 JSValue jsLocationPathname(ExecState* exec, JSValue slotBase, const Identifier&) |
|
179 { |
|
180 JSLocation* castedThis = static_cast<JSLocation*>(asObject(slotBase)); |
|
181 UNUSED_PARAM(exec); |
|
182 Location* imp = static_cast<Location*>(castedThis->impl()); |
|
183 JSValue result = jsString(exec, imp->pathname()); |
|
184 return result; |
|
185 } |
|
186 |
|
187 JSValue jsLocationSearch(ExecState* exec, JSValue slotBase, const Identifier&) |
|
188 { |
|
189 JSLocation* castedThis = static_cast<JSLocation*>(asObject(slotBase)); |
|
190 UNUSED_PARAM(exec); |
|
191 Location* imp = static_cast<Location*>(castedThis->impl()); |
|
192 JSValue result = jsString(exec, imp->search()); |
|
193 return result; |
|
194 } |
|
195 |
|
196 JSValue jsLocationHash(ExecState* exec, JSValue slotBase, const Identifier&) |
|
197 { |
|
198 JSLocation* castedThis = static_cast<JSLocation*>(asObject(slotBase)); |
|
199 UNUSED_PARAM(exec); |
|
200 Location* imp = static_cast<Location*>(castedThis->impl()); |
|
201 JSValue result = jsString(exec, imp->hash()); |
|
202 return result; |
|
203 } |
|
204 |
|
205 void JSLocation::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
206 { |
|
207 if (putDelegate(exec, propertyName, value, slot)) |
|
208 return; |
|
209 lookupPut<JSLocation, Base>(exec, propertyName, value, &JSLocationTable, this, slot); |
|
210 } |
|
211 |
|
212 void setJSLocationHref(ExecState* exec, JSObject* thisObject, JSValue value) |
|
213 { |
|
214 static_cast<JSLocation*>(thisObject)->setHref(exec, value); |
|
215 } |
|
216 |
|
217 void setJSLocationProtocol(ExecState* exec, JSObject* thisObject, JSValue value) |
|
218 { |
|
219 static_cast<JSLocation*>(thisObject)->setProtocol(exec, value); |
|
220 } |
|
221 |
|
222 void setJSLocationHost(ExecState* exec, JSObject* thisObject, JSValue value) |
|
223 { |
|
224 static_cast<JSLocation*>(thisObject)->setHost(exec, value); |
|
225 } |
|
226 |
|
227 void setJSLocationHostname(ExecState* exec, JSObject* thisObject, JSValue value) |
|
228 { |
|
229 static_cast<JSLocation*>(thisObject)->setHostname(exec, value); |
|
230 } |
|
231 |
|
232 void setJSLocationPort(ExecState* exec, JSObject* thisObject, JSValue value) |
|
233 { |
|
234 static_cast<JSLocation*>(thisObject)->setPort(exec, value); |
|
235 } |
|
236 |
|
237 void setJSLocationPathname(ExecState* exec, JSObject* thisObject, JSValue value) |
|
238 { |
|
239 static_cast<JSLocation*>(thisObject)->setPathname(exec, value); |
|
240 } |
|
241 |
|
242 void setJSLocationSearch(ExecState* exec, JSObject* thisObject, JSValue value) |
|
243 { |
|
244 static_cast<JSLocation*>(thisObject)->setSearch(exec, value); |
|
245 } |
|
246 |
|
247 void setJSLocationHash(ExecState* exec, JSObject* thisObject, JSValue value) |
|
248 { |
|
249 static_cast<JSLocation*>(thisObject)->setHash(exec, value); |
|
250 } |
|
251 |
|
252 EncodedJSValue JSC_HOST_CALL jsLocationPrototypeFunctionAssign(ExecState* exec) |
|
253 { |
|
254 JSValue thisValue = exec->hostThisValue(); |
|
255 if (!thisValue.inherits(&JSLocation::s_info)) |
|
256 return throwVMTypeError(exec); |
|
257 JSLocation* castedThis = static_cast<JSLocation*>(asObject(thisValue)); |
|
258 return JSValue::encode(castedThis->assign(exec)); |
|
259 } |
|
260 |
|
261 EncodedJSValue JSC_HOST_CALL jsLocationPrototypeFunctionReplace(ExecState* exec) |
|
262 { |
|
263 JSValue thisValue = exec->hostThisValue(); |
|
264 if (!thisValue.inherits(&JSLocation::s_info)) |
|
265 return throwVMTypeError(exec); |
|
266 JSLocation* castedThis = static_cast<JSLocation*>(asObject(thisValue)); |
|
267 return JSValue::encode(castedThis->replace(exec)); |
|
268 } |
|
269 |
|
270 EncodedJSValue JSC_HOST_CALL jsLocationPrototypeFunctionReload(ExecState* exec) |
|
271 { |
|
272 JSValue thisValue = exec->hostThisValue(); |
|
273 if (!thisValue.inherits(&JSLocation::s_info)) |
|
274 return throwVMTypeError(exec); |
|
275 JSLocation* castedThis = static_cast<JSLocation*>(asObject(thisValue)); |
|
276 return JSValue::encode(castedThis->reload(exec)); |
|
277 } |
|
278 |
|
279 EncodedJSValue JSC_HOST_CALL jsLocationPrototypeFunctionToString(ExecState* exec) |
|
280 { |
|
281 JSValue thisValue = exec->hostThisValue(); |
|
282 if (!thisValue.inherits(&JSLocation::s_info)) |
|
283 return throwVMTypeError(exec); |
|
284 JSLocation* castedThis = static_cast<JSLocation*>(asObject(thisValue)); |
|
285 return JSValue::encode(castedThis->toString(exec)); |
|
286 } |
|
287 |
|
288 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Location* object) |
|
289 { |
|
290 return getDOMObjectWrapper<JSLocation>(exec, globalObject, object); |
|
291 } |
|
292 Location* toLocation(JSC::JSValue value) |
|
293 { |
|
294 return value.inherits(&JSLocation::s_info) ? static_cast<JSLocation*>(asObject(value))->impl() : 0; |
|
295 } |
|
296 |
|
297 } |