WebCore/generated/JSInjectedScriptHost.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 
       
    23 #if ENABLE(INSPECTOR)
       
    24 
       
    25 #include "JSInjectedScriptHost.h"
       
    26 
       
    27 #include "InjectedScriptHost.h"
       
    28 #include <runtime/Error.h>
       
    29 #include <runtime/JSNumberCell.h>
       
    30 #include <wtf/GetPtr.h>
       
    31 
       
    32 using namespace JSC;
       
    33 
       
    34 namespace WebCore {
       
    35 
       
    36 ASSERT_CLASS_FITS_IN_CELL(JSInjectedScriptHost);
       
    37 
       
    38 /* Hash table */
       
    39 #if ENABLE(JIT)
       
    40 #define THUNK_GENERATOR(generator) , generator
       
    41 #else
       
    42 #define THUNK_GENERATOR(generator)
       
    43 #endif
       
    44 
       
    45 static const HashTableValue JSInjectedScriptHostTableValues[2] =
       
    46 {
       
    47     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsInjectedScriptHostConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    48     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    49 };
       
    50 
       
    51 #undef THUNK_GENERATOR
       
    52 static JSC_CONST_HASHTABLE HashTable JSInjectedScriptHostTable = { 2, 1, JSInjectedScriptHostTableValues, 0 };
       
    53 /* Hash table for constructor */
       
    54 #if ENABLE(JIT)
       
    55 #define THUNK_GENERATOR(generator) , generator
       
    56 #else
       
    57 #define THUNK_GENERATOR(generator)
       
    58 #endif
       
    59 
       
    60 static const HashTableValue JSInjectedScriptHostConstructorTableValues[1] =
       
    61 {
       
    62     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    63 };
       
    64 
       
    65 #undef THUNK_GENERATOR
       
    66 static JSC_CONST_HASHTABLE HashTable JSInjectedScriptHostConstructorTable = { 1, 0, JSInjectedScriptHostConstructorTableValues, 0 };
       
    67 class JSInjectedScriptHostConstructor : public DOMConstructorObject {
       
    68 public:
       
    69     JSInjectedScriptHostConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    70 
       
    71     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    72     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    73     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
    74     static const JSC::ClassInfo s_info;
       
    75     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
    76     {
       
    77         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
    78     }
       
    79 protected:
       
    80     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
    81 };
       
    82 
       
    83 const ClassInfo JSInjectedScriptHostConstructor::s_info = { "InjectedScriptHostConstructor", 0, &JSInjectedScriptHostConstructorTable, 0 };
       
    84 
       
    85 JSInjectedScriptHostConstructor::JSInjectedScriptHostConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    86     : DOMConstructorObject(JSInjectedScriptHostConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    87 {
       
    88     putDirect(exec->propertyNames().prototype, JSInjectedScriptHostPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    89 }
       
    90 
       
    91 bool JSInjectedScriptHostConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    92 {
       
    93     return getStaticValueSlot<JSInjectedScriptHostConstructor, DOMObject>(exec, &JSInjectedScriptHostConstructorTable, this, propertyName, slot);
       
    94 }
       
    95 
       
    96 bool JSInjectedScriptHostConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
    97 {
       
    98     return getStaticValueDescriptor<JSInjectedScriptHostConstructor, DOMObject>(exec, &JSInjectedScriptHostConstructorTable, this, propertyName, descriptor);
       
    99 }
       
   100 
       
   101 /* Hash table for prototype */
       
   102 #if ENABLE(JIT)
       
   103 #define THUNK_GENERATOR(generator) , generator
       
   104 #else
       
   105 #define THUNK_GENERATOR(generator)
       
   106 #endif
       
   107 
       
   108 static const HashTableValue JSInjectedScriptHostPrototypeTableValues[14] =
       
   109 {
       
   110     { "clearConsoleMessages", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionClearConsoleMessages), (intptr_t)0 THUNK_GENERATOR(0) },
       
   111     { "copyText", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionCopyText), (intptr_t)1 THUNK_GENERATOR(0) },
       
   112     { "nodeForId", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionNodeForId), (intptr_t)1 THUNK_GENERATOR(0) },
       
   113     { "pushNodePathToFrontend", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionPushNodePathToFrontend), (intptr_t)3 THUNK_GENERATOR(0) },
       
   114     { "inspectedNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionInspectedNode), (intptr_t)1 THUNK_GENERATOR(0) },
       
   115     { "currentCallFrame", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionCurrentCallFrame), (intptr_t)0 THUNK_GENERATOR(0) },
       
   116     { "databaseForId", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionDatabaseForId), (intptr_t)1 THUNK_GENERATOR(0) },
       
   117     { "selectDatabase", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionSelectDatabase), (intptr_t)1 THUNK_GENERATOR(0) },
       
   118     { "selectDOMStorage", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionSelectDOMStorage), (intptr_t)1 THUNK_GENERATOR(0) },
       
   119     { "didCreateWorker", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionDidCreateWorker), (intptr_t)3 THUNK_GENERATOR(0) },
       
   120     { "didDestroyWorker", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionDidDestroyWorker), (intptr_t)1 THUNK_GENERATOR(0) },
       
   121     { "nextWorkerId", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionNextWorkerId), (intptr_t)0 THUNK_GENERATOR(0) },
       
   122     { "reportDidDispatchOnInjectedScript", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInjectedScriptHostPrototypeFunctionReportDidDispatchOnInjectedScript), (intptr_t)3 THUNK_GENERATOR(0) },
       
   123     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   124 };
       
   125 
       
   126 #undef THUNK_GENERATOR
       
   127 static JSC_CONST_HASHTABLE HashTable JSInjectedScriptHostPrototypeTable = { 33, 31, JSInjectedScriptHostPrototypeTableValues, 0 };
       
   128 const ClassInfo JSInjectedScriptHostPrototype::s_info = { "InjectedScriptHostPrototype", 0, &JSInjectedScriptHostPrototypeTable, 0 };
       
   129 
       
   130 JSObject* JSInjectedScriptHostPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   131 {
       
   132     return getDOMPrototype<JSInjectedScriptHost>(exec, globalObject);
       
   133 }
       
   134 
       
   135 bool JSInjectedScriptHostPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   136 {
       
   137     return getStaticFunctionSlot<JSObject>(exec, &JSInjectedScriptHostPrototypeTable, this, propertyName, slot);
       
   138 }
       
   139 
       
   140 bool JSInjectedScriptHostPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   141 {
       
   142     return getStaticFunctionDescriptor<JSObject>(exec, &JSInjectedScriptHostPrototypeTable, this, propertyName, descriptor);
       
   143 }
       
   144 
       
   145 const ClassInfo JSInjectedScriptHost::s_info = { "InjectedScriptHost", 0, &JSInjectedScriptHostTable, 0 };
       
   146 
       
   147 JSInjectedScriptHost::JSInjectedScriptHost(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<InjectedScriptHost> impl)
       
   148     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   149     , m_impl(impl)
       
   150 {
       
   151 }
       
   152 
       
   153 JSInjectedScriptHost::~JSInjectedScriptHost()
       
   154 {
       
   155     forgetDOMObject(this, impl());
       
   156 }
       
   157 
       
   158 JSObject* JSInjectedScriptHost::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   159 {
       
   160     return new (exec) JSInjectedScriptHostPrototype(globalObject, JSInjectedScriptHostPrototype::createStructure(globalObject->objectPrototype()));
       
   161 }
       
   162 
       
   163 bool JSInjectedScriptHost::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   164 {
       
   165     return getStaticValueSlot<JSInjectedScriptHost, Base>(exec, &JSInjectedScriptHostTable, this, propertyName, slot);
       
   166 }
       
   167 
       
   168 bool JSInjectedScriptHost::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   169 {
       
   170     return getStaticValueDescriptor<JSInjectedScriptHost, Base>(exec, &JSInjectedScriptHostTable, this, propertyName, descriptor);
       
   171 }
       
   172 
       
   173 JSValue jsInjectedScriptHostConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   174 {
       
   175     JSInjectedScriptHost* domObject = static_cast<JSInjectedScriptHost*>(asObject(slotBase));
       
   176     return JSInjectedScriptHost::getConstructor(exec, domObject->globalObject());
       
   177 }
       
   178 JSValue JSInjectedScriptHost::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   179 {
       
   180     return getDOMConstructor<JSInjectedScriptHostConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   181 }
       
   182 
       
   183 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionClearConsoleMessages(ExecState* exec)
       
   184 {
       
   185     JSValue thisValue = exec->hostThisValue();
       
   186     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   187         return throwVMTypeError(exec);
       
   188     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   189     InjectedScriptHost* imp = static_cast<InjectedScriptHost*>(castedThis->impl());
       
   190 
       
   191     imp->clearConsoleMessages();
       
   192     return JSValue::encode(jsUndefined());
       
   193 }
       
   194 
       
   195 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionCopyText(ExecState* exec)
       
   196 {
       
   197     JSValue thisValue = exec->hostThisValue();
       
   198     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   199         return throwVMTypeError(exec);
       
   200     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   201     InjectedScriptHost* imp = static_cast<InjectedScriptHost*>(castedThis->impl());
       
   202     const String& text = ustringToString(exec->argument(0).toString(exec));
       
   203 
       
   204     imp->copyText(text);
       
   205     return JSValue::encode(jsUndefined());
       
   206 }
       
   207 
       
   208 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionNodeForId(ExecState* exec)
       
   209 {
       
   210     JSValue thisValue = exec->hostThisValue();
       
   211     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   212         return throwVMTypeError(exec);
       
   213     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   214     return JSValue::encode(castedThis->nodeForId(exec));
       
   215 }
       
   216 
       
   217 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionPushNodePathToFrontend(ExecState* exec)
       
   218 {
       
   219     JSValue thisValue = exec->hostThisValue();
       
   220     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   221         return throwVMTypeError(exec);
       
   222     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   223     return JSValue::encode(castedThis->pushNodePathToFrontend(exec));
       
   224 }
       
   225 
       
   226 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionInspectedNode(ExecState* exec)
       
   227 {
       
   228     JSValue thisValue = exec->hostThisValue();
       
   229     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   230         return throwVMTypeError(exec);
       
   231     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   232     InjectedScriptHost* imp = static_cast<InjectedScriptHost*>(castedThis->impl());
       
   233     unsigned num = exec->argument(0).toInt32(exec);
       
   234 
       
   235 
       
   236     JSC::JSValue result = jsNumber(exec, imp->inspectedNode(num));
       
   237     return JSValue::encode(result);
       
   238 }
       
   239 
       
   240 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionCurrentCallFrame(ExecState* exec)
       
   241 {
       
   242     JSValue thisValue = exec->hostThisValue();
       
   243     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   244         return throwVMTypeError(exec);
       
   245     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   246     return JSValue::encode(castedThis->currentCallFrame(exec));
       
   247 }
       
   248 
       
   249 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionDatabaseForId(ExecState* exec)
       
   250 {
       
   251     JSValue thisValue = exec->hostThisValue();
       
   252     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   253         return throwVMTypeError(exec);
       
   254     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   255     return JSValue::encode(castedThis->databaseForId(exec));
       
   256 }
       
   257 
       
   258 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionSelectDatabase(ExecState* exec)
       
   259 {
       
   260     JSValue thisValue = exec->hostThisValue();
       
   261     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   262         return throwVMTypeError(exec);
       
   263     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   264     return JSValue::encode(castedThis->selectDatabase(exec));
       
   265 }
       
   266 
       
   267 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionSelectDOMStorage(ExecState* exec)
       
   268 {
       
   269     JSValue thisValue = exec->hostThisValue();
       
   270     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   271         return throwVMTypeError(exec);
       
   272     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   273     return JSValue::encode(castedThis->selectDOMStorage(exec));
       
   274 }
       
   275 
       
   276 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionDidCreateWorker(ExecState* exec)
       
   277 {
       
   278     JSValue thisValue = exec->hostThisValue();
       
   279     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   280         return throwVMTypeError(exec);
       
   281     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   282     InjectedScriptHost* imp = static_cast<InjectedScriptHost*>(castedThis->impl());
       
   283     int id = exec->argument(0).toInt32(exec);
       
   284     const String& url = ustringToString(exec->argument(1).toString(exec));
       
   285     bool isFakeWorker = exec->argument(2).toBoolean(exec);
       
   286 
       
   287     imp->didCreateWorker(id, url, isFakeWorker);
       
   288     return JSValue::encode(jsUndefined());
       
   289 }
       
   290 
       
   291 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionDidDestroyWorker(ExecState* exec)
       
   292 {
       
   293     JSValue thisValue = exec->hostThisValue();
       
   294     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   295         return throwVMTypeError(exec);
       
   296     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   297     InjectedScriptHost* imp = static_cast<InjectedScriptHost*>(castedThis->impl());
       
   298     int id = exec->argument(0).toInt32(exec);
       
   299 
       
   300     imp->didDestroyWorker(id);
       
   301     return JSValue::encode(jsUndefined());
       
   302 }
       
   303 
       
   304 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionNextWorkerId(ExecState* exec)
       
   305 {
       
   306     JSValue thisValue = exec->hostThisValue();
       
   307     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   308         return throwVMTypeError(exec);
       
   309     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   310     InjectedScriptHost* imp = static_cast<InjectedScriptHost*>(castedThis->impl());
       
   311 
       
   312 
       
   313     JSC::JSValue result = jsNumber(exec, imp->nextWorkerId());
       
   314     return JSValue::encode(result);
       
   315 }
       
   316 
       
   317 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionReportDidDispatchOnInjectedScript(ExecState* exec)
       
   318 {
       
   319     JSValue thisValue = exec->hostThisValue();
       
   320     if (!thisValue.inherits(&JSInjectedScriptHost::s_info))
       
   321         return throwVMTypeError(exec);
       
   322     JSInjectedScriptHost* castedThis = static_cast<JSInjectedScriptHost*>(asObject(thisValue));
       
   323     return JSValue::encode(castedThis->reportDidDispatchOnInjectedScript(exec));
       
   324 }
       
   325 
       
   326 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, InjectedScriptHost* object)
       
   327 {
       
   328     return getDOMObjectWrapper<JSInjectedScriptHost>(exec, globalObject, object);
       
   329 }
       
   330 InjectedScriptHost* toInjectedScriptHost(JSC::JSValue value)
       
   331 {
       
   332     return value.inherits(&JSInjectedScriptHost::s_info) ? static_cast<JSInjectedScriptHost*>(asObject(value))->impl() : 0;
       
   333 }
       
   334 
       
   335 }
       
   336 
       
   337 #endif // ENABLE(INSPECTOR)