WebCore/generated/JSHistory.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 "JSHistory.h"
       
    23 
       
    24 #include "History.h"
       
    25 #include "JSHistoryCustom.h"
       
    26 #include <runtime/Error.h>
       
    27 #include <runtime/JSNumberCell.h>
       
    28 #include <wtf/GetPtr.h>
       
    29 
       
    30 using namespace JSC;
       
    31 
       
    32 namespace WebCore {
       
    33 
       
    34 ASSERT_CLASS_FITS_IN_CELL(JSHistory);
       
    35 
       
    36 /* Hash table */
       
    37 #if ENABLE(JIT)
       
    38 #define THUNK_GENERATOR(generator) , generator
       
    39 #else
       
    40 #define THUNK_GENERATOR(generator)
       
    41 #endif
       
    42 
       
    43 static const HashTableValue JSHistoryTableValues[2] =
       
    44 {
       
    45     { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHistoryLength), (intptr_t)0 THUNK_GENERATOR(0) },
       
    46     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    47 };
       
    48 
       
    49 #undef THUNK_GENERATOR
       
    50 static JSC_CONST_HASHTABLE HashTable JSHistoryTable = { 2, 1, JSHistoryTableValues, 0 };
       
    51 /* Hash table for prototype */
       
    52 #if ENABLE(JIT)
       
    53 #define THUNK_GENERATOR(generator) , generator
       
    54 #else
       
    55 #define THUNK_GENERATOR(generator)
       
    56 #endif
       
    57 
       
    58 static const HashTableValue JSHistoryPrototypeTableValues[6] =
       
    59 {
       
    60     { "back", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionBack), (intptr_t)0 THUNK_GENERATOR(0) },
       
    61     { "forward", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionForward), (intptr_t)0 THUNK_GENERATOR(0) },
       
    62     { "go", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionGo), (intptr_t)1 THUNK_GENERATOR(0) },
       
    63     { "pushState", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionPushState), (intptr_t)3 THUNK_GENERATOR(0) },
       
    64     { "replaceState", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHistoryPrototypeFunctionReplaceState), (intptr_t)3 THUNK_GENERATOR(0) },
       
    65     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    66 };
       
    67 
       
    68 #undef THUNK_GENERATOR
       
    69 static JSC_CONST_HASHTABLE HashTable JSHistoryPrototypeTable = { 17, 15, JSHistoryPrototypeTableValues, 0 };
       
    70 const ClassInfo JSHistoryPrototype::s_info = { "HistoryPrototype", 0, &JSHistoryPrototypeTable, 0 };
       
    71 
       
    72 JSObject* JSHistoryPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
    73 {
       
    74     return getDOMPrototype<JSHistory>(exec, globalObject);
       
    75 }
       
    76 
       
    77 bool JSHistoryPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    78 {
       
    79     return getStaticFunctionSlot<JSObject>(exec, &JSHistoryPrototypeTable, this, propertyName, slot);
       
    80 }
       
    81 
       
    82 bool JSHistoryPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
    83 {
       
    84     return getStaticFunctionDescriptor<JSObject>(exec, &JSHistoryPrototypeTable, this, propertyName, descriptor);
       
    85 }
       
    86 
       
    87 const ClassInfo JSHistory::s_info = { "History", 0, &JSHistoryTable, 0 };
       
    88 
       
    89 JSHistory::JSHistory(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<History> impl)
       
    90     : DOMObjectWithGlobalPointer(structure, globalObject)
       
    91     , m_impl(impl)
       
    92 {
       
    93 }
       
    94 
       
    95 JSHistory::~JSHistory()
       
    96 {
       
    97     forgetDOMObject(this, impl());
       
    98 }
       
    99 
       
   100 JSObject* JSHistory::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   101 {
       
   102     return new (exec) JSHistoryPrototype(globalObject, JSHistoryPrototype::createStructure(globalObject->objectPrototype()));
       
   103 }
       
   104 
       
   105 bool JSHistory::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   106 {
       
   107     if (getOwnPropertySlotDelegate(exec, propertyName, slot))
       
   108         return true;
       
   109     return getStaticValueSlot<JSHistory, Base>(exec, &JSHistoryTable, this, propertyName, slot);
       
   110 }
       
   111 
       
   112 bool JSHistory::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   113 {
       
   114     if (getOwnPropertyDescriptorDelegate(exec, propertyName, descriptor))
       
   115         return true;
       
   116     return getStaticValueDescriptor<JSHistory, Base>(exec, &JSHistoryTable, this, propertyName, descriptor);
       
   117 }
       
   118 
       
   119 JSValue jsHistoryLength(ExecState* exec, JSValue slotBase, const Identifier&)
       
   120 {
       
   121     JSHistory* castedThis = static_cast<JSHistory*>(asObject(slotBase));
       
   122     UNUSED_PARAM(exec);
       
   123     History* imp = static_cast<History*>(castedThis->impl());
       
   124     JSValue result = jsNumber(exec, imp->length());
       
   125     return result;
       
   126 }
       
   127 
       
   128 void JSHistory::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   129 {
       
   130     if (putDelegate(exec, propertyName, value, slot))
       
   131         return;
       
   132     Base::put(exec, propertyName, value, slot);
       
   133 }
       
   134 
       
   135 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionBack(ExecState* exec)
       
   136 {
       
   137     JSValue thisValue = exec->hostThisValue();
       
   138     if (!thisValue.inherits(&JSHistory::s_info))
       
   139         return throwVMTypeError(exec);
       
   140     JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
       
   141     History* imp = static_cast<History*>(castedThis->impl());
       
   142 
       
   143     imp->back();
       
   144     return JSValue::encode(jsUndefined());
       
   145 }
       
   146 
       
   147 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionForward(ExecState* exec)
       
   148 {
       
   149     JSValue thisValue = exec->hostThisValue();
       
   150     if (!thisValue.inherits(&JSHistory::s_info))
       
   151         return throwVMTypeError(exec);
       
   152     JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
       
   153     History* imp = static_cast<History*>(castedThis->impl());
       
   154 
       
   155     imp->forward();
       
   156     return JSValue::encode(jsUndefined());
       
   157 }
       
   158 
       
   159 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionGo(ExecState* exec)
       
   160 {
       
   161     JSValue thisValue = exec->hostThisValue();
       
   162     if (!thisValue.inherits(&JSHistory::s_info))
       
   163         return throwVMTypeError(exec);
       
   164     JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
       
   165     History* imp = static_cast<History*>(castedThis->impl());
       
   166     int distance = exec->argument(0).toInt32(exec);
       
   167 
       
   168     imp->go(distance);
       
   169     return JSValue::encode(jsUndefined());
       
   170 }
       
   171 
       
   172 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionPushState(ExecState* exec)
       
   173 {
       
   174     JSValue thisValue = exec->hostThisValue();
       
   175     if (!thisValue.inherits(&JSHistory::s_info))
       
   176         return throwVMTypeError(exec);
       
   177     JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
       
   178     return JSValue::encode(castedThis->pushState(exec));
       
   179 }
       
   180 
       
   181 EncodedJSValue JSC_HOST_CALL jsHistoryPrototypeFunctionReplaceState(ExecState* exec)
       
   182 {
       
   183     JSValue thisValue = exec->hostThisValue();
       
   184     if (!thisValue.inherits(&JSHistory::s_info))
       
   185         return throwVMTypeError(exec);
       
   186     JSHistory* castedThis = static_cast<JSHistory*>(asObject(thisValue));
       
   187     return JSValue::encode(castedThis->replaceState(exec));
       
   188 }
       
   189 
       
   190 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, History* object)
       
   191 {
       
   192     return getDOMObjectWrapper<JSHistory>(exec, globalObject, object);
       
   193 }
       
   194 History* toHistory(JSC::JSValue value)
       
   195 {
       
   196     return value.inherits(&JSHistory::s_info) ? static_cast<JSHistory*>(asObject(value))->impl() : 0;
       
   197 }
       
   198 
       
   199 }