2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
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.
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.
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.
22 #include "JSHistory.h"
24 #include "ExceptionCode.h"
26 #include "JSDOMBinding.h"
27 #include "JSHistoryCustom.h"
28 #include <runtime/Error.h>
29 #include <wtf/GetPtr.h>
35 ASSERT_CLASS_FITS_IN_CELL(JSHistory);
39 #define THUNK_GENERATOR(generator) , generator
41 #define THUNK_GENERATOR(generator)
44 #define INTRINSIC(intrinsic) , intrinsic
46 #define INTRINSIC(intrinsic)
49 static const HashTableValue JSHistoryTableValues[] =
51 { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHistoryLength), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
52 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
55 #undef THUNK_GENERATOR
56 static const HashTable JSHistoryTable = { 2, 1, JSHistoryTableValues, 0 };
57 /* Hash table for prototype */
59 #define THUNK_GENERATOR(generator) , generator
61 #define THUNK_GENERATOR(generator)
64 #define INTRINSIC(intrinsic) , intrinsic
66 #define INTRINSIC(intrinsic)
69 static const HashTableValue JSHistoryPrototypeTableValues[] =
71 { "back", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionBack), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
72 { "forward", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionForward), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
73 { "go", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionGo), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
74 { "pushState", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionPushState), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
75 { "replaceState", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionReplaceState), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
76 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
79 #undef THUNK_GENERATOR
80 static const HashTable JSHistoryPrototypeTable = { 17, 15, JSHistoryPrototypeTableValues, 0 };
81 const ClassInfo JSHistoryPrototype::s_info = { "HistoryPrototype", &JSC::JSNonFinalObject::s_info, &JSHistoryPrototypeTable, 0, CREATE_METHOD_TABLE(JSHistoryPrototype) };
83 JSObject* JSHistoryPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
85 return getDOMPrototype<JSHistory>(exec, globalObject);
88 bool JSHistoryPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
90 JSHistoryPrototype* thisObject = jsCast<JSHistoryPrototype*>(cell);
91 return getStaticFunctionSlot<JSObject>(exec, &JSHistoryPrototypeTable, thisObject, propertyName, slot);
94 bool JSHistoryPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
96 JSHistoryPrototype* thisObject = jsCast<JSHistoryPrototype*>(object);
97 return getStaticFunctionDescriptor<JSObject>(exec, &JSHistoryPrototypeTable, thisObject, propertyName, descriptor);
100 const ClassInfo JSHistory::s_info = { "History", &JSDOMWrapper::s_info, &JSHistoryTable, 0 , CREATE_METHOD_TABLE(JSHistory) };
102 JSHistory::JSHistory(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<History> impl)
103 : JSDOMWrapper(structure, globalObject)
104 , m_impl(impl.leakRef())
108 void JSHistory::finishCreation(JSGlobalData& globalData)
110 Base::finishCreation(globalData);
111 ASSERT(inherits(&s_info));
114 JSObject* JSHistory::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
116 return JSHistoryPrototype::create(exec->globalData(), globalObject, JSHistoryPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
119 bool JSHistory::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
121 JSHistory* thisObject = jsCast<JSHistory*>(cell);
122 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
123 if (thisObject->getOwnPropertySlotDelegate(exec, propertyName, slot))
125 return getStaticValueSlot<JSHistory, Base>(exec, &JSHistoryTable, thisObject, propertyName, slot);
128 bool JSHistory::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
130 JSHistory* thisObject = jsCast<JSHistory*>(object);
131 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
132 if (thisObject->getOwnPropertyDescriptorDelegate(exec, propertyName, descriptor))
134 return getStaticValueDescriptor<JSHistory, Base>(exec, &JSHistoryTable, thisObject, propertyName, descriptor);
137 JSValue jsHistoryLength(ExecState* exec, JSValue slotBase, const Identifier&)
139 JSHistory* castedThis = static_cast<JSHistory*>(asObject(slotBase));
141 History* imp = static_cast<History*>(castedThis->impl());
142 JSValue result = jsNumber(imp->length());
147 void JSHistory::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
149 JSHistory* thisObject = jsCast<JSHistory*>(cell);
150 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
151 if (thisObject->putDelegate(exec, propertyName, value, slot))
153 Base::put(thisObject, exec, propertyName, value, slot);
156 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionBack(ExecState* exec)
158 JSValue thisValue = exec->hostThisValue();
159 if (!thisValue.inherits(&JSHistory::s_info))
160 return throwVMTypeError(exec);
161 JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
162 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHistory::s_info);
163 History* imp = static_cast<History*>(castedThis->impl());
164 ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
166 return JSValue::encode(jsUndefined());
167 imp->back(scriptContext);
168 return JSValue::encode(jsUndefined());
171 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionForward(ExecState* exec)
173 JSValue thisValue = exec->hostThisValue();
174 if (!thisValue.inherits(&JSHistory::s_info))
175 return throwVMTypeError(exec);
176 JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
177 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHistory::s_info);
178 History* imp = static_cast<History*>(castedThis->impl());
179 ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
181 return JSValue::encode(jsUndefined());
182 imp->forward(scriptContext);
183 return JSValue::encode(jsUndefined());
186 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionGo(ExecState* exec)
188 JSValue thisValue = exec->hostThisValue();
189 if (!thisValue.inherits(&JSHistory::s_info))
190 return throwVMTypeError(exec);
191 JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
192 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHistory::s_info);
193 History* imp = static_cast<History*>(castedThis->impl());
194 ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
196 return JSValue::encode(jsUndefined());
197 int distance(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toInt32(exec));
198 if (exec->hadException())
199 return JSValue::encode(jsUndefined());
200 imp->go(scriptContext, distance);
201 return JSValue::encode(jsUndefined());
204 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionPushState(ExecState* exec)
206 JSValue thisValue = exec->hostThisValue();
207 if (!thisValue.inherits(&JSHistory::s_info))
208 return throwVMTypeError(exec);
209 JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
210 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHistory::s_info);
211 return JSValue::encode(castedThis->pushState(exec));
214 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionReplaceState(ExecState* exec)
216 JSValue thisValue = exec->hostThisValue();
217 if (!thisValue.inherits(&JSHistory::s_info))
218 return throwVMTypeError(exec);
219 JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
220 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHistory::s_info);
221 return JSValue::encode(castedThis->replaceState(exec));
224 static inline bool isObservable(JSHistory* jsHistory)
226 if (jsHistory->hasCustomProperties())
231 bool JSHistoryOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
233 JSHistory* jsHistory = static_cast<JSHistory*>(handle.get().asCell());
234 if (!isObservable(jsHistory))
236 Frame* root = jsHistory->impl()->frame();
239 return visitor.containsOpaqueRoot(root);
242 void JSHistoryOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
244 JSHistory* jsHistory = static_cast<JSHistory*>(handle.get().asCell());
245 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
246 uncacheWrapper(world, jsHistory->impl(), jsHistory);
247 jsHistory->releaseImpl();
250 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, History* impl)
252 return wrap<JSHistory>(exec, globalObject, impl);
255 History* toHistory(JSC::JSValue value)
257 return value.inherits(&JSHistory::s_info) ? static_cast<JSHistory*>(asObject(value))->impl() : 0;