WebCore/generated/JSXMLHttpRequestUpload.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 "JSXMLHttpRequestUpload.h"
       
    23 
       
    24 #include "Event.h"
       
    25 #include "EventListener.h"
       
    26 #include "JSEvent.h"
       
    27 #include "JSEventListener.h"
       
    28 #include "RegisteredEventListener.h"
       
    29 #include "XMLHttpRequestUpload.h"
       
    30 #include <runtime/Error.h>
       
    31 #include <wtf/GetPtr.h>
       
    32 
       
    33 using namespace JSC;
       
    34 
       
    35 namespace WebCore {
       
    36 
       
    37 ASSERT_CLASS_FITS_IN_CELL(JSXMLHttpRequestUpload);
       
    38 
       
    39 /* Hash table */
       
    40 #if ENABLE(JIT)
       
    41 #define THUNK_GENERATOR(generator) , generator
       
    42 #else
       
    43 #define THUNK_GENERATOR(generator)
       
    44 #endif
       
    45 
       
    46 static const HashTableValue JSXMLHttpRequestUploadTableValues[7] =
       
    47 {
       
    48     { "onabort", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestUploadOnabort), (intptr_t)setJSXMLHttpRequestUploadOnabort THUNK_GENERATOR(0) },
       
    49     { "onerror", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestUploadOnerror), (intptr_t)setJSXMLHttpRequestUploadOnerror THUNK_GENERATOR(0) },
       
    50     { "onload", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestUploadOnload), (intptr_t)setJSXMLHttpRequestUploadOnload THUNK_GENERATOR(0) },
       
    51     { "onloadstart", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestUploadOnloadstart), (intptr_t)setJSXMLHttpRequestUploadOnloadstart THUNK_GENERATOR(0) },
       
    52     { "onprogress", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestUploadOnprogress), (intptr_t)setJSXMLHttpRequestUploadOnprogress THUNK_GENERATOR(0) },
       
    53     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestUploadConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    54     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    55 };
       
    56 
       
    57 #undef THUNK_GENERATOR
       
    58 static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestUploadTable = { 16, 15, JSXMLHttpRequestUploadTableValues, 0 };
       
    59 /* Hash table for constructor */
       
    60 #if ENABLE(JIT)
       
    61 #define THUNK_GENERATOR(generator) , generator
       
    62 #else
       
    63 #define THUNK_GENERATOR(generator)
       
    64 #endif
       
    65 
       
    66 static const HashTableValue JSXMLHttpRequestUploadConstructorTableValues[1] =
       
    67 {
       
    68     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    69 };
       
    70 
       
    71 #undef THUNK_GENERATOR
       
    72 static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestUploadConstructorTable = { 1, 0, JSXMLHttpRequestUploadConstructorTableValues, 0 };
       
    73 class JSXMLHttpRequestUploadConstructor : public DOMConstructorObject {
       
    74 public:
       
    75     JSXMLHttpRequestUploadConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    76 
       
    77     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    78     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    79     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
    80     static const JSC::ClassInfo s_info;
       
    81     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
    82     {
       
    83         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
    84     }
       
    85 protected:
       
    86     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
    87 };
       
    88 
       
    89 const ClassInfo JSXMLHttpRequestUploadConstructor::s_info = { "XMLHttpRequestUploadConstructor", 0, &JSXMLHttpRequestUploadConstructorTable, 0 };
       
    90 
       
    91 JSXMLHttpRequestUploadConstructor::JSXMLHttpRequestUploadConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    92     : DOMConstructorObject(JSXMLHttpRequestUploadConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    93 {
       
    94     putDirect(exec->propertyNames().prototype, JSXMLHttpRequestUploadPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    95 }
       
    96 
       
    97 bool JSXMLHttpRequestUploadConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    98 {
       
    99     return getStaticValueSlot<JSXMLHttpRequestUploadConstructor, DOMObject>(exec, &JSXMLHttpRequestUploadConstructorTable, this, propertyName, slot);
       
   100 }
       
   101 
       
   102 bool JSXMLHttpRequestUploadConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   103 {
       
   104     return getStaticValueDescriptor<JSXMLHttpRequestUploadConstructor, DOMObject>(exec, &JSXMLHttpRequestUploadConstructorTable, this, propertyName, descriptor);
       
   105 }
       
   106 
       
   107 /* Hash table for prototype */
       
   108 #if ENABLE(JIT)
       
   109 #define THUNK_GENERATOR(generator) , generator
       
   110 #else
       
   111 #define THUNK_GENERATOR(generator)
       
   112 #endif
       
   113 
       
   114 static const HashTableValue JSXMLHttpRequestUploadPrototypeTableValues[4] =
       
   115 {
       
   116     { "addEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestUploadPrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) },
       
   117     { "removeEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestUploadPrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) },
       
   118     { "dispatchEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestUploadPrototypeFunctionDispatchEvent), (intptr_t)1 THUNK_GENERATOR(0) },
       
   119     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   120 };
       
   121 
       
   122 #undef THUNK_GENERATOR
       
   123 static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestUploadPrototypeTable = { 8, 7, JSXMLHttpRequestUploadPrototypeTableValues, 0 };
       
   124 static const HashTable* getJSXMLHttpRequestUploadPrototypeTable(ExecState* exec)
       
   125 {
       
   126     return getHashTableForGlobalData(exec->globalData(), &JSXMLHttpRequestUploadPrototypeTable);
       
   127 }
       
   128 const ClassInfo JSXMLHttpRequestUploadPrototype::s_info = { "XMLHttpRequestUploadPrototype", 0, 0, getJSXMLHttpRequestUploadPrototypeTable };
       
   129 
       
   130 JSObject* JSXMLHttpRequestUploadPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   131 {
       
   132     return getDOMPrototype<JSXMLHttpRequestUpload>(exec, globalObject);
       
   133 }
       
   134 
       
   135 bool JSXMLHttpRequestUploadPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   136 {
       
   137     return getStaticFunctionSlot<JSObject>(exec, getJSXMLHttpRequestUploadPrototypeTable(exec), this, propertyName, slot);
       
   138 }
       
   139 
       
   140 bool JSXMLHttpRequestUploadPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   141 {
       
   142     return getStaticFunctionDescriptor<JSObject>(exec, getJSXMLHttpRequestUploadPrototypeTable(exec), this, propertyName, descriptor);
       
   143 }
       
   144 
       
   145 static const HashTable* getJSXMLHttpRequestUploadTable(ExecState* exec)
       
   146 {
       
   147     return getHashTableForGlobalData(exec->globalData(), &JSXMLHttpRequestUploadTable);
       
   148 }
       
   149 const ClassInfo JSXMLHttpRequestUpload::s_info = { "XMLHttpRequestUpload", 0, 0, getJSXMLHttpRequestUploadTable };
       
   150 
       
   151 JSXMLHttpRequestUpload::JSXMLHttpRequestUpload(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<XMLHttpRequestUpload> impl)
       
   152     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   153     , m_impl(impl)
       
   154 {
       
   155 }
       
   156 
       
   157 JSXMLHttpRequestUpload::~JSXMLHttpRequestUpload()
       
   158 {
       
   159     impl()->invalidateJSEventListeners(this);
       
   160     forgetDOMObject(this, impl());
       
   161 }
       
   162 
       
   163 JSObject* JSXMLHttpRequestUpload::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   164 {
       
   165     return new (exec) JSXMLHttpRequestUploadPrototype(globalObject, JSXMLHttpRequestUploadPrototype::createStructure(globalObject->objectPrototype()));
       
   166 }
       
   167 
       
   168 bool JSXMLHttpRequestUpload::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   169 {
       
   170     return getStaticValueSlot<JSXMLHttpRequestUpload, Base>(exec, getJSXMLHttpRequestUploadTable(exec), this, propertyName, slot);
       
   171 }
       
   172 
       
   173 bool JSXMLHttpRequestUpload::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   174 {
       
   175     return getStaticValueDescriptor<JSXMLHttpRequestUpload, Base>(exec, getJSXMLHttpRequestUploadTable(exec), this, propertyName, descriptor);
       
   176 }
       
   177 
       
   178 JSValue jsXMLHttpRequestUploadOnabort(ExecState* exec, JSValue slotBase, const Identifier&)
       
   179 {
       
   180     JSXMLHttpRequestUpload* castedThis = static_cast<JSXMLHttpRequestUpload*>(asObject(slotBase));
       
   181     UNUSED_PARAM(exec);
       
   182     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(castedThis->impl());
       
   183     if (EventListener* listener = imp->onabort()) {
       
   184         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
       
   185             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
       
   186                 return jsFunction;
       
   187         }
       
   188     }
       
   189     return jsNull();
       
   190 }
       
   191 
       
   192 JSValue jsXMLHttpRequestUploadOnerror(ExecState* exec, JSValue slotBase, const Identifier&)
       
   193 {
       
   194     JSXMLHttpRequestUpload* castedThis = static_cast<JSXMLHttpRequestUpload*>(asObject(slotBase));
       
   195     UNUSED_PARAM(exec);
       
   196     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(castedThis->impl());
       
   197     if (EventListener* listener = imp->onerror()) {
       
   198         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
       
   199             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
       
   200                 return jsFunction;
       
   201         }
       
   202     }
       
   203     return jsNull();
       
   204 }
       
   205 
       
   206 JSValue jsXMLHttpRequestUploadOnload(ExecState* exec, JSValue slotBase, const Identifier&)
       
   207 {
       
   208     JSXMLHttpRequestUpload* castedThis = static_cast<JSXMLHttpRequestUpload*>(asObject(slotBase));
       
   209     UNUSED_PARAM(exec);
       
   210     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(castedThis->impl());
       
   211     if (EventListener* listener = imp->onload()) {
       
   212         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
       
   213             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
       
   214                 return jsFunction;
       
   215         }
       
   216     }
       
   217     return jsNull();
       
   218 }
       
   219 
       
   220 JSValue jsXMLHttpRequestUploadOnloadstart(ExecState* exec, JSValue slotBase, const Identifier&)
       
   221 {
       
   222     JSXMLHttpRequestUpload* castedThis = static_cast<JSXMLHttpRequestUpload*>(asObject(slotBase));
       
   223     UNUSED_PARAM(exec);
       
   224     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(castedThis->impl());
       
   225     if (EventListener* listener = imp->onloadstart()) {
       
   226         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
       
   227             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
       
   228                 return jsFunction;
       
   229         }
       
   230     }
       
   231     return jsNull();
       
   232 }
       
   233 
       
   234 JSValue jsXMLHttpRequestUploadOnprogress(ExecState* exec, JSValue slotBase, const Identifier&)
       
   235 {
       
   236     JSXMLHttpRequestUpload* castedThis = static_cast<JSXMLHttpRequestUpload*>(asObject(slotBase));
       
   237     UNUSED_PARAM(exec);
       
   238     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(castedThis->impl());
       
   239     if (EventListener* listener = imp->onprogress()) {
       
   240         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
       
   241             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
       
   242                 return jsFunction;
       
   243         }
       
   244     }
       
   245     return jsNull();
       
   246 }
       
   247 
       
   248 JSValue jsXMLHttpRequestUploadConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   249 {
       
   250     JSXMLHttpRequestUpload* domObject = static_cast<JSXMLHttpRequestUpload*>(asObject(slotBase));
       
   251     return JSXMLHttpRequestUpload::getConstructor(exec, domObject->globalObject());
       
   252 }
       
   253 void JSXMLHttpRequestUpload::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   254 {
       
   255     lookupPut<JSXMLHttpRequestUpload, Base>(exec, propertyName, value, getJSXMLHttpRequestUploadTable(exec), this, slot);
       
   256 }
       
   257 
       
   258 void setJSXMLHttpRequestUploadOnabort(ExecState* exec, JSObject* thisObject, JSValue value)
       
   259 {
       
   260     UNUSED_PARAM(exec);
       
   261     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl());
       
   262     imp->setOnabort(createJSAttributeEventListener(exec, value, thisObject));
       
   263 }
       
   264 
       
   265 void setJSXMLHttpRequestUploadOnerror(ExecState* exec, JSObject* thisObject, JSValue value)
       
   266 {
       
   267     UNUSED_PARAM(exec);
       
   268     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl());
       
   269     imp->setOnerror(createJSAttributeEventListener(exec, value, thisObject));
       
   270 }
       
   271 
       
   272 void setJSXMLHttpRequestUploadOnload(ExecState* exec, JSObject* thisObject, JSValue value)
       
   273 {
       
   274     UNUSED_PARAM(exec);
       
   275     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl());
       
   276     imp->setOnload(createJSAttributeEventListener(exec, value, thisObject));
       
   277 }
       
   278 
       
   279 void setJSXMLHttpRequestUploadOnloadstart(ExecState* exec, JSObject* thisObject, JSValue value)
       
   280 {
       
   281     UNUSED_PARAM(exec);
       
   282     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl());
       
   283     imp->setOnloadstart(createJSAttributeEventListener(exec, value, thisObject));
       
   284 }
       
   285 
       
   286 void setJSXMLHttpRequestUploadOnprogress(ExecState* exec, JSObject* thisObject, JSValue value)
       
   287 {
       
   288     UNUSED_PARAM(exec);
       
   289     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl());
       
   290     imp->setOnprogress(createJSAttributeEventListener(exec, value, thisObject));
       
   291 }
       
   292 
       
   293 JSValue JSXMLHttpRequestUpload::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   294 {
       
   295     return getDOMConstructor<JSXMLHttpRequestUploadConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   296 }
       
   297 
       
   298 EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestUploadPrototypeFunctionAddEventListener(ExecState* exec)
       
   299 {
       
   300     JSValue thisValue = exec->hostThisValue();
       
   301     if (!thisValue.inherits(&JSXMLHttpRequestUpload::s_info))
       
   302         return throwVMTypeError(exec);
       
   303     JSXMLHttpRequestUpload* castedThis = static_cast<JSXMLHttpRequestUpload*>(asObject(thisValue));
       
   304     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(castedThis->impl());
       
   305     JSValue listener = exec->argument(1);
       
   306     if (!listener.isObject())
       
   307         return JSValue::encode(jsUndefined());
       
   308     imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));
       
   309     return JSValue::encode(jsUndefined());
       
   310 }
       
   311 
       
   312 EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestUploadPrototypeFunctionRemoveEventListener(ExecState* exec)
       
   313 {
       
   314     JSValue thisValue = exec->hostThisValue();
       
   315     if (!thisValue.inherits(&JSXMLHttpRequestUpload::s_info))
       
   316         return throwVMTypeError(exec);
       
   317     JSXMLHttpRequestUpload* castedThis = static_cast<JSXMLHttpRequestUpload*>(asObject(thisValue));
       
   318     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(castedThis->impl());
       
   319     JSValue listener = exec->argument(1);
       
   320     if (!listener.isObject())
       
   321         return JSValue::encode(jsUndefined());
       
   322     imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
       
   323     return JSValue::encode(jsUndefined());
       
   324 }
       
   325 
       
   326 EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestUploadPrototypeFunctionDispatchEvent(ExecState* exec)
       
   327 {
       
   328     JSValue thisValue = exec->hostThisValue();
       
   329     if (!thisValue.inherits(&JSXMLHttpRequestUpload::s_info))
       
   330         return throwVMTypeError(exec);
       
   331     JSXMLHttpRequestUpload* castedThis = static_cast<JSXMLHttpRequestUpload*>(asObject(thisValue));
       
   332     XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(castedThis->impl());
       
   333     ExceptionCode ec = 0;
       
   334     Event* evt = toEvent(exec->argument(0));
       
   335 
       
   336 
       
   337     JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec));
       
   338     setDOMException(exec, ec);
       
   339     return JSValue::encode(result);
       
   340 }
       
   341 
       
   342 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XMLHttpRequestUpload* object)
       
   343 {
       
   344     return getDOMObjectWrapper<JSXMLHttpRequestUpload>(exec, globalObject, object);
       
   345 }
       
   346 XMLHttpRequestUpload* toXMLHttpRequestUpload(JSC::JSValue value)
       
   347 {
       
   348     return value.inherits(&JSXMLHttpRequestUpload::s_info) ? static_cast<JSXMLHttpRequestUpload*>(asObject(value))->impl() : 0;
       
   349 }
       
   350 
       
   351 }