80
77
return getStaticFunctionSlot<JSObject>(exec, &JSGeolocationPrototypeTable, this, propertyName, slot);
80
bool JSGeolocationPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
82
return getStaticFunctionDescriptor<JSObject>(exec, &JSGeolocationPrototypeTable, this, propertyName, descriptor);
83
85
const ClassInfo JSGeolocation::s_info = { "Geolocation", 0, &JSGeolocationTable, 0 };
85
JSGeolocation::JSGeolocation(PassRefPtr<Structure> structure, PassRefPtr<Geolocation> impl)
86
: DOMObject(structure)
87
JSGeolocation::JSGeolocation(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Geolocation> impl)
88
: DOMObjectWithGlobalPointer(structure, globalObject)
91
93
JSGeolocation::~JSGeolocation()
93
forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get());
95
forgetDOMObject(*Heap::heap(this)->globalData(), impl());
97
98
JSObject* JSGeolocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
104
105
return getStaticValueSlot<JSGeolocation, Base>(exec, &JSGeolocationTable, this, propertyName, slot);
107
JSValuePtr jsGeolocationLastPosition(ExecState* exec, const Identifier&, const PropertySlot& slot)
109
Geolocation* imp = static_cast<Geolocation*>(static_cast<JSGeolocation*>(asObject(slot.slotBase()))->impl());
110
return toJS(exec, WTF::getPtr(imp->lastPosition()));
113
JSValuePtr jsGeolocationPrototypeFunctionGetCurrentPosition(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
115
if (!thisValue->isObject(&JSGeolocation::s_info))
108
bool JSGeolocation::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
110
return getStaticValueDescriptor<JSGeolocation, Base>(exec, &JSGeolocationTable, this, propertyName, descriptor);
113
JSValue jsGeolocationLastPosition(ExecState* exec, const Identifier&, const PropertySlot& slot)
115
JSGeolocation* castedThis = static_cast<JSGeolocation*>(asObject(slot.slotBase()));
117
Geolocation* imp = static_cast<Geolocation*>(castedThis->impl());
118
return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->lastPosition()));
121
JSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionGetCurrentPosition(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
124
if (!thisValue.inherits(&JSGeolocation::s_info))
116
125
return throwError(exec, TypeError);
117
126
JSGeolocation* castedThisObj = static_cast<JSGeolocation*>(asObject(thisValue));
118
127
return castedThisObj->getCurrentPosition(exec, args);
121
JSValuePtr jsGeolocationPrototypeFunctionWatchPosition(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
130
JSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionWatchPosition(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
123
if (!thisValue->isObject(&JSGeolocation::s_info))
133
if (!thisValue.inherits(&JSGeolocation::s_info))
124
134
return throwError(exec, TypeError);
125
135
JSGeolocation* castedThisObj = static_cast<JSGeolocation*>(asObject(thisValue));
126
136
return castedThisObj->watchPosition(exec, args);
129
JSValuePtr jsGeolocationPrototypeFunctionClearWatch(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
139
JSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionClearWatch(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
131
if (!thisValue->isObject(&JSGeolocation::s_info))
142
if (!thisValue.inherits(&JSGeolocation::s_info))
132
143
return throwError(exec, TypeError);
133
144
JSGeolocation* castedThisObj = static_cast<JSGeolocation*>(asObject(thisValue));
134
145
Geolocation* imp = static_cast<Geolocation*>(castedThisObj->impl());
135
int watchId = args.at(exec, 0)->toInt32(exec);
146
int watchId = args.at(0).toInt32(exec);
137
148
imp->clearWatch(watchId);
138
149
return jsUndefined();
141
JSC::JSValuePtr toJS(JSC::ExecState* exec, Geolocation* object)
152
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Geolocation* object)
143
return getDOMObjectWrapper<JSGeolocation>(exec, object);
154
return getDOMObjectWrapper<JSGeolocation>(exec, globalObject, object);
145
Geolocation* toGeolocation(JSC::JSValuePtr value)
156
Geolocation* toGeolocation(JSC::JSValue value)
147
return value->isObject(&JSGeolocation::s_info) ? static_cast<JSGeolocation*>(asObject(value))->impl() : 0;
158
return value.inherits(&JSGeolocation::s_info) ? static_cast<JSGeolocation*>(asObject(value))->impl() : 0;