|
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 "JSNavigator.h" |
|
23 |
|
24 #include "DOMMimeTypeArray.h" |
|
25 #include "DOMPluginArray.h" |
|
26 #include "Geolocation.h" |
|
27 #include "JSDOMMimeTypeArray.h" |
|
28 #include "JSDOMPluginArray.h" |
|
29 #include "JSGeolocation.h" |
|
30 #include "KURL.h" |
|
31 #include "Navigator.h" |
|
32 #include <runtime/Error.h> |
|
33 #include <runtime/JSString.h> |
|
34 #include <wtf/GetPtr.h> |
|
35 |
|
36 using namespace JSC; |
|
37 |
|
38 namespace WebCore { |
|
39 |
|
40 ASSERT_CLASS_FITS_IN_CELL(JSNavigator); |
|
41 |
|
42 /* Hash table */ |
|
43 #if ENABLE(JIT) |
|
44 #define THUNK_GENERATOR(generator) , generator |
|
45 #else |
|
46 #define THUNK_GENERATOR(generator) |
|
47 #endif |
|
48 |
|
49 static const HashTableValue JSNavigatorTableValues[16] = |
|
50 { |
|
51 { "appCodeName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorAppCodeName), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "appName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorAppName), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { "appVersion", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorAppVersion), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
54 { "language", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorLanguage), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
55 { "userAgent", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorUserAgent), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
56 { "platform", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorPlatform), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
57 { "plugins", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorPlugins), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
58 { "mimeTypes", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorMimeTypes), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
59 { "product", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorProduct), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
60 { "productSub", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorProductSub), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
61 { "vendor", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorVendor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
62 { "vendorSub", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorVendorSub), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
63 { "cookieEnabled", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorCookieEnabled), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
64 { "onLine", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorOnLine), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
65 { "geolocation", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNavigatorGeolocation), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
66 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
67 }; |
|
68 |
|
69 #undef THUNK_GENERATOR |
|
70 static JSC_CONST_HASHTABLE HashTable JSNavigatorTable = { 36, 31, JSNavigatorTableValues, 0 }; |
|
71 /* Hash table for prototype */ |
|
72 #if ENABLE(JIT) |
|
73 #define THUNK_GENERATOR(generator) , generator |
|
74 #else |
|
75 #define THUNK_GENERATOR(generator) |
|
76 #endif |
|
77 |
|
78 static const HashTableValue JSNavigatorPrototypeTableValues[3] = |
|
79 { |
|
80 { "javaEnabled", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNavigatorPrototypeFunctionJavaEnabled), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
81 { "getStorageUpdates", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNavigatorPrototypeFunctionGetStorageUpdates), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
82 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
83 }; |
|
84 |
|
85 #undef THUNK_GENERATOR |
|
86 static JSC_CONST_HASHTABLE HashTable JSNavigatorPrototypeTable = { 4, 3, JSNavigatorPrototypeTableValues, 0 }; |
|
87 const ClassInfo JSNavigatorPrototype::s_info = { "NavigatorPrototype", 0, &JSNavigatorPrototypeTable, 0 }; |
|
88 |
|
89 JSObject* JSNavigatorPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
90 { |
|
91 return getDOMPrototype<JSNavigator>(exec, globalObject); |
|
92 } |
|
93 |
|
94 bool JSNavigatorPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
95 { |
|
96 return getStaticFunctionSlot<JSObject>(exec, &JSNavigatorPrototypeTable, this, propertyName, slot); |
|
97 } |
|
98 |
|
99 bool JSNavigatorPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
100 { |
|
101 return getStaticFunctionDescriptor<JSObject>(exec, &JSNavigatorPrototypeTable, this, propertyName, descriptor); |
|
102 } |
|
103 |
|
104 const ClassInfo JSNavigator::s_info = { "Navigator", 0, &JSNavigatorTable, 0 }; |
|
105 |
|
106 JSNavigator::JSNavigator(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Navigator> impl) |
|
107 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
108 , m_impl(impl) |
|
109 { |
|
110 } |
|
111 |
|
112 JSNavigator::~JSNavigator() |
|
113 { |
|
114 forgetDOMObject(this, impl()); |
|
115 } |
|
116 |
|
117 JSObject* JSNavigator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
118 { |
|
119 return new (exec) JSNavigatorPrototype(globalObject, JSNavigatorPrototype::createStructure(globalObject->objectPrototype())); |
|
120 } |
|
121 |
|
122 bool JSNavigator::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
123 { |
|
124 return getStaticValueSlot<JSNavigator, Base>(exec, &JSNavigatorTable, this, propertyName, slot); |
|
125 } |
|
126 |
|
127 bool JSNavigator::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
128 { |
|
129 return getStaticValueDescriptor<JSNavigator, Base>(exec, &JSNavigatorTable, this, propertyName, descriptor); |
|
130 } |
|
131 |
|
132 JSValue jsNavigatorAppCodeName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
133 { |
|
134 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
135 UNUSED_PARAM(exec); |
|
136 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
137 JSValue result = jsString(exec, imp->appCodeName()); |
|
138 return result; |
|
139 } |
|
140 |
|
141 JSValue jsNavigatorAppName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
142 { |
|
143 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
144 UNUSED_PARAM(exec); |
|
145 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
146 JSValue result = jsString(exec, imp->appName()); |
|
147 return result; |
|
148 } |
|
149 |
|
150 JSValue jsNavigatorAppVersion(ExecState* exec, JSValue slotBase, const Identifier&) |
|
151 { |
|
152 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
153 UNUSED_PARAM(exec); |
|
154 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
155 JSValue result = jsString(exec, imp->appVersion()); |
|
156 return result; |
|
157 } |
|
158 |
|
159 JSValue jsNavigatorLanguage(ExecState* exec, JSValue slotBase, const Identifier&) |
|
160 { |
|
161 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
162 UNUSED_PARAM(exec); |
|
163 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
164 JSValue result = jsString(exec, imp->language()); |
|
165 return result; |
|
166 } |
|
167 |
|
168 JSValue jsNavigatorUserAgent(ExecState* exec, JSValue slotBase, const Identifier&) |
|
169 { |
|
170 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
171 UNUSED_PARAM(exec); |
|
172 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
173 JSValue result = jsString(exec, imp->userAgent()); |
|
174 return result; |
|
175 } |
|
176 |
|
177 JSValue jsNavigatorPlatform(ExecState* exec, JSValue slotBase, const Identifier&) |
|
178 { |
|
179 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
180 UNUSED_PARAM(exec); |
|
181 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
182 JSValue result = jsString(exec, imp->platform()); |
|
183 return result; |
|
184 } |
|
185 |
|
186 JSValue jsNavigatorPlugins(ExecState* exec, JSValue slotBase, const Identifier&) |
|
187 { |
|
188 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
189 UNUSED_PARAM(exec); |
|
190 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
191 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->plugins())); |
|
192 return result; |
|
193 } |
|
194 |
|
195 JSValue jsNavigatorMimeTypes(ExecState* exec, JSValue slotBase, const Identifier&) |
|
196 { |
|
197 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
198 UNUSED_PARAM(exec); |
|
199 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
200 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->mimeTypes())); |
|
201 return result; |
|
202 } |
|
203 |
|
204 JSValue jsNavigatorProduct(ExecState* exec, JSValue slotBase, const Identifier&) |
|
205 { |
|
206 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
207 UNUSED_PARAM(exec); |
|
208 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
209 JSValue result = jsString(exec, imp->product()); |
|
210 return result; |
|
211 } |
|
212 |
|
213 JSValue jsNavigatorProductSub(ExecState* exec, JSValue slotBase, const Identifier&) |
|
214 { |
|
215 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
216 UNUSED_PARAM(exec); |
|
217 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
218 JSValue result = jsString(exec, imp->productSub()); |
|
219 return result; |
|
220 } |
|
221 |
|
222 JSValue jsNavigatorVendor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
223 { |
|
224 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
225 UNUSED_PARAM(exec); |
|
226 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
227 JSValue result = jsString(exec, imp->vendor()); |
|
228 return result; |
|
229 } |
|
230 |
|
231 JSValue jsNavigatorVendorSub(ExecState* exec, JSValue slotBase, const Identifier&) |
|
232 { |
|
233 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
234 UNUSED_PARAM(exec); |
|
235 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
236 JSValue result = jsString(exec, imp->vendorSub()); |
|
237 return result; |
|
238 } |
|
239 |
|
240 JSValue jsNavigatorCookieEnabled(ExecState* exec, JSValue slotBase, const Identifier&) |
|
241 { |
|
242 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
243 UNUSED_PARAM(exec); |
|
244 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
245 JSValue result = jsBoolean(imp->cookieEnabled()); |
|
246 return result; |
|
247 } |
|
248 |
|
249 JSValue jsNavigatorOnLine(ExecState* exec, JSValue slotBase, const Identifier&) |
|
250 { |
|
251 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
252 UNUSED_PARAM(exec); |
|
253 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
254 JSValue result = jsBoolean(imp->onLine()); |
|
255 return result; |
|
256 } |
|
257 |
|
258 JSValue jsNavigatorGeolocation(ExecState* exec, JSValue slotBase, const Identifier&) |
|
259 { |
|
260 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase)); |
|
261 UNUSED_PARAM(exec); |
|
262 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
263 // :HACK: JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->geolocation())); |
|
264 JSValue result; // :HACK: |
|
265 return result; |
|
266 } |
|
267 |
|
268 EncodedJSValue JSC_HOST_CALL jsNavigatorPrototypeFunctionJavaEnabled(ExecState* exec) |
|
269 { |
|
270 JSValue thisValue = exec->hostThisValue(); |
|
271 if (!thisValue.inherits(&JSNavigator::s_info)) |
|
272 return throwVMTypeError(exec); |
|
273 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(thisValue)); |
|
274 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
275 |
|
276 |
|
277 JSC::JSValue result = jsBoolean(imp->javaEnabled()); |
|
278 return JSValue::encode(result); |
|
279 } |
|
280 |
|
281 EncodedJSValue JSC_HOST_CALL jsNavigatorPrototypeFunctionGetStorageUpdates(ExecState* exec) |
|
282 { |
|
283 JSValue thisValue = exec->hostThisValue(); |
|
284 if (!thisValue.inherits(&JSNavigator::s_info)) |
|
285 return throwVMTypeError(exec); |
|
286 JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(thisValue)); |
|
287 Navigator* imp = static_cast<Navigator*>(castedThis->impl()); |
|
288 |
|
289 imp->getStorageUpdates(); |
|
290 return JSValue::encode(jsUndefined()); |
|
291 } |
|
292 |
|
293 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Navigator* object) |
|
294 { |
|
295 return getDOMObjectWrapper<JSNavigator>(exec, globalObject, object); |
|
296 } |
|
297 Navigator* toNavigator(JSC::JSValue value) |
|
298 { |
|
299 return value.inherits(&JSNavigator::s_info) ? static_cast<JSNavigator*>(asObject(value))->impl() : 0; |
|
300 } |
|
301 |
|
302 } |