WebCore/generated/JSWorkerContext.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(WORKERS)
       
    24 
       
    25 #include "JSWorkerContext.h"
       
    26 
       
    27 #include "Database.h"
       
    28 #include "DatabaseSync.h"
       
    29 #include "Event.h"
       
    30 #include "EventListener.h"
       
    31 #include "JSEvent.h"
       
    32 #include "JSEventListener.h"
       
    33 #include "JSEventSource.h"
       
    34 #include "JSMessageChannel.h"
       
    35 #include "JSMessageEvent.h"
       
    36 #include "JSNotificationCenter.h"
       
    37 #include "JSWebSocket.h"
       
    38 #include "JSWorkerContext.h"
       
    39 #include "JSWorkerContextErrorHandler.h"
       
    40 #include "JSWorkerLocation.h"
       
    41 #include "JSWorkerNavigator.h"
       
    42 #include "JSXMLHttpRequest.h"
       
    43 #include "NotificationCenter.h"
       
    44 #include "RegisteredEventListener.h"
       
    45 #include "WorkerContext.h"
       
    46 #include "WorkerLocation.h"
       
    47 #include "WorkerNavigator.h"
       
    48 #include <runtime/Error.h>
       
    49 #include <wtf/GetPtr.h>
       
    50 
       
    51 using namespace JSC;
       
    52 
       
    53 namespace WebCore {
       
    54 
       
    55 ASSERT_CLASS_FITS_IN_CELL(JSWorkerContext);
       
    56 
       
    57 /* Hash table */
       
    58 #if ENABLE(JIT)
       
    59 #define THUNK_GENERATOR(generator) , generator
       
    60 #else
       
    61 #define THUNK_GENERATOR(generator)
       
    62 #endif
       
    63 
       
    64 static const HashTableValue JSWorkerContextTableValues[12] =
       
    65 {
       
    66     { "self", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextSelf), (intptr_t)setJSWorkerContextSelf THUNK_GENERATOR(0) },
       
    67     { "location", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextLocation), (intptr_t)setJSWorkerContextLocation THUNK_GENERATOR(0) },
       
    68     { "onerror", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextOnerror), (intptr_t)setJSWorkerContextOnerror THUNK_GENERATOR(0) },
       
    69     { "navigator", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextNavigator), (intptr_t)setJSWorkerContextNavigator THUNK_GENERATOR(0) },
       
    70     { "webkitNotifications", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextWebkitNotifications), (intptr_t)0 THUNK_GENERATOR(0) },
       
    71     { "MessageEvent", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextMessageEventConstructor), (intptr_t)setJSWorkerContextMessageEventConstructor THUNK_GENERATOR(0) },
       
    72     { "WorkerLocation", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextWorkerLocationConstructor), (intptr_t)setJSWorkerContextWorkerLocationConstructor THUNK_GENERATOR(0) },
       
    73     { "MessageChannel", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextMessageChannelConstructor), (intptr_t)setJSWorkerContextMessageChannelConstructor THUNK_GENERATOR(0) },
       
    74     { "EventSource", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextEventSourceConstructor), (intptr_t)setJSWorkerContextEventSourceConstructor THUNK_GENERATOR(0) },
       
    75     { "XMLHttpRequest", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextXMLHttpRequestConstructor), (intptr_t)setJSWorkerContextXMLHttpRequestConstructor THUNK_GENERATOR(0) },
       
    76     { "WebSocket", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerContextWebSocketConstructor), (intptr_t)setJSWorkerContextWebSocketConstructor THUNK_GENERATOR(0) },
       
    77     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    78 };
       
    79 
       
    80 #undef THUNK_GENERATOR
       
    81 static JSC_CONST_HASHTABLE HashTable JSWorkerContextTable = { 35, 31, JSWorkerContextTableValues, 0 };
       
    82 /* Hash table for prototype */
       
    83 #if ENABLE(JIT)
       
    84 #define THUNK_GENERATOR(generator) , generator
       
    85 #else
       
    86 #define THUNK_GENERATOR(generator)
       
    87 #endif
       
    88 
       
    89 static const HashTableValue JSWorkerContextPrototypeTableValues[12] =
       
    90 {
       
    91     { "close", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionClose), (intptr_t)0 THUNK_GENERATOR(0) },
       
    92     { "importScripts", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionImportScripts), (intptr_t)0 THUNK_GENERATOR(0) },
       
    93     { "openDatabase", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionOpenDatabase), (intptr_t)5 THUNK_GENERATOR(0) },
       
    94     { "openDatabaseSync", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionOpenDatabaseSync), (intptr_t)5 THUNK_GENERATOR(0) },
       
    95     { "setTimeout", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionSetTimeout), (intptr_t)2 THUNK_GENERATOR(0) },
       
    96     { "clearTimeout", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionClearTimeout), (intptr_t)1 THUNK_GENERATOR(0) },
       
    97     { "setInterval", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionSetInterval), (intptr_t)2 THUNK_GENERATOR(0) },
       
    98     { "clearInterval", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionClearInterval), (intptr_t)1 THUNK_GENERATOR(0) },
       
    99     { "addEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) },
       
   100     { "removeEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) },
       
   101     { "dispatchEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWorkerContextPrototypeFunctionDispatchEvent), (intptr_t)1 THUNK_GENERATOR(0) },
       
   102     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   103 };
       
   104 
       
   105 #undef THUNK_GENERATOR
       
   106 static JSC_CONST_HASHTABLE HashTable JSWorkerContextPrototypeTable = { 35, 31, JSWorkerContextPrototypeTableValues, 0 };
       
   107 static const HashTable* getJSWorkerContextPrototypeTable(ExecState* exec)
       
   108 {
       
   109     return getHashTableForGlobalData(exec->globalData(), &JSWorkerContextPrototypeTable);
       
   110 }
       
   111 const ClassInfo JSWorkerContextPrototype::s_info = { "WorkerContextPrototype", 0, 0, getJSWorkerContextPrototypeTable };
       
   112 
       
   113 void* JSWorkerContextPrototype::operator new(size_t size, JSGlobalData* globalData)
       
   114 {
       
   115     return globalData->heap.allocate(size);
       
   116 }
       
   117 
       
   118 bool JSWorkerContextPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   119 {
       
   120     return getStaticFunctionSlot<JSObject>(exec, getJSWorkerContextPrototypeTable(exec), this, propertyName, slot);
       
   121 }
       
   122 
       
   123 bool JSWorkerContextPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   124 {
       
   125     return getStaticFunctionDescriptor<JSObject>(exec, getJSWorkerContextPrototypeTable(exec), this, propertyName, descriptor);
       
   126 }
       
   127 
       
   128 static const HashTable* getJSWorkerContextTable(ExecState* exec)
       
   129 {
       
   130     return getHashTableForGlobalData(exec->globalData(), &JSWorkerContextTable);
       
   131 }
       
   132 const ClassInfo JSWorkerContext::s_info = { "WorkerContext", &JSWorkerContextBase::s_info, 0, getJSWorkerContextTable };
       
   133 
       
   134 JSWorkerContext::JSWorkerContext(NonNullPassRefPtr<Structure> structure, PassRefPtr<WorkerContext> impl)
       
   135     : JSWorkerContextBase(structure, impl)
       
   136 {
       
   137 }
       
   138 
       
   139 JSWorkerContext::~JSWorkerContext()
       
   140 {
       
   141     impl()->invalidateJSEventListeners(this);
       
   142 }
       
   143 
       
   144 bool JSWorkerContext::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   145 {
       
   146     if (getOwnPropertySlotDelegate(exec, propertyName, slot))
       
   147         return true;
       
   148     return getStaticValueSlot<JSWorkerContext, Base>(exec, getJSWorkerContextTable(exec), this, propertyName, slot);
       
   149 }
       
   150 
       
   151 bool JSWorkerContext::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   152 {
       
   153     if (getOwnPropertyDescriptorDelegate(exec, propertyName, descriptor))
       
   154         return true;
       
   155     return getStaticValueDescriptor<JSWorkerContext, Base>(exec, getJSWorkerContextTable(exec), this, propertyName, descriptor);
       
   156 }
       
   157 
       
   158 JSValue jsWorkerContextSelf(ExecState* exec, JSValue slotBase, const Identifier&)
       
   159 {
       
   160     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   161     UNUSED_PARAM(exec);
       
   162     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   163     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->self()));
       
   164     return result;
       
   165 }
       
   166 
       
   167 JSValue jsWorkerContextLocation(ExecState* exec, JSValue slotBase, const Identifier&)
       
   168 {
       
   169     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   170     UNUSED_PARAM(exec);
       
   171     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   172     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->location()));
       
   173     return result;
       
   174 }
       
   175 
       
   176 JSValue jsWorkerContextOnerror(ExecState* exec, JSValue slotBase, const Identifier&)
       
   177 {
       
   178     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   179     UNUSED_PARAM(exec);
       
   180     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   181     if (EventListener* listener = imp->onerror()) {
       
   182         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
       
   183             if (JSObject* jsFunction = jsListener->jsFunction(imp))
       
   184                 return jsFunction;
       
   185         }
       
   186     }
       
   187     return jsNull();
       
   188 }
       
   189 
       
   190 JSValue jsWorkerContextNavigator(ExecState* exec, JSValue slotBase, const Identifier&)
       
   191 {
       
   192     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   193     UNUSED_PARAM(exec);
       
   194     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   195     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->navigator()));
       
   196     return result;
       
   197 }
       
   198 
       
   199 JSValue jsWorkerContextWebkitNotifications(ExecState* exec, JSValue slotBase, const Identifier&)
       
   200 {
       
   201     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   202     UNUSED_PARAM(exec);
       
   203     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   204     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->webkitNotifications()));
       
   205     return result;
       
   206 }
       
   207 
       
   208 JSValue jsWorkerContextMessageEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   209 {
       
   210     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   211     return JSMessageEvent::getConstructor(exec, castedThis);
       
   212 }
       
   213 
       
   214 JSValue jsWorkerContextWorkerLocationConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   215 {
       
   216     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   217     return JSWorkerLocation::getConstructor(exec, castedThis);
       
   218 }
       
   219 
       
   220 JSValue jsWorkerContextMessageChannelConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   221 {
       
   222     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   223     return castedThis->messageChannel(exec);
       
   224 }
       
   225 
       
   226 JSValue jsWorkerContextEventSourceConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   227 {
       
   228     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   229     return castedThis->eventSource(exec);
       
   230 }
       
   231 
       
   232 JSValue jsWorkerContextXMLHttpRequestConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   233 {
       
   234     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   235     return castedThis->xmlHttpRequest(exec);
       
   236 }
       
   237 
       
   238 JSValue jsWorkerContextWebSocketConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   239 {
       
   240     JSWorkerContext* castedThis = static_cast<JSWorkerContext*>(asObject(slotBase));
       
   241     return castedThis->webSocket(exec);
       
   242 }
       
   243 
       
   244 void JSWorkerContext::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   245 {
       
   246     lookupPut<JSWorkerContext, Base>(exec, propertyName, value, getJSWorkerContextTable(exec), this, slot);
       
   247 }
       
   248 
       
   249 void setJSWorkerContextSelf(ExecState* exec, JSObject* thisObject, JSValue value)
       
   250 {
       
   251     // Shadowing a built-in object
       
   252     static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "self"), value);
       
   253 }
       
   254 
       
   255 void setJSWorkerContextLocation(ExecState* exec, JSObject* thisObject, JSValue value)
       
   256 {
       
   257     // Shadowing a built-in object
       
   258     static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "location"), value);
       
   259 }
       
   260 
       
   261 void setJSWorkerContextOnerror(ExecState* exec, JSObject* thisObject, JSValue value)
       
   262 {
       
   263     UNUSED_PARAM(exec);
       
   264     WorkerContext* imp = static_cast<WorkerContext*>(static_cast<JSWorkerContext*>(thisObject)->impl());
       
   265     imp->setOnerror(createJSWorkerContextErrorHandler(exec, value, thisObject));
       
   266 }
       
   267 
       
   268 void setJSWorkerContextNavigator(ExecState* exec, JSObject* thisObject, JSValue value)
       
   269 {
       
   270     // Shadowing a built-in object
       
   271     static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "navigator"), value);
       
   272 }
       
   273 
       
   274 void setJSWorkerContextMessageEventConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
       
   275 {
       
   276     // Shadowing a built-in constructor
       
   277     static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "MessageEvent"), value);
       
   278 }
       
   279 
       
   280 void setJSWorkerContextWorkerLocationConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
       
   281 {
       
   282     // Shadowing a built-in constructor
       
   283     static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "WorkerLocation"), value);
       
   284 }
       
   285 
       
   286 void setJSWorkerContextMessageChannelConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
       
   287 {
       
   288     // Shadowing a built-in constructor
       
   289     static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "MessageChannel"), value);
       
   290 }
       
   291 
       
   292 void setJSWorkerContextEventSourceConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
       
   293 {
       
   294     // Shadowing a built-in constructor
       
   295     static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "EventSource"), value);
       
   296 }
       
   297 
       
   298 void setJSWorkerContextXMLHttpRequestConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
       
   299 {
       
   300     // Shadowing a built-in constructor
       
   301     static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "XMLHttpRequest"), value);
       
   302 }
       
   303 
       
   304 void setJSWorkerContextWebSocketConstructor(ExecState* exec, JSObject* thisObject, JSValue value)
       
   305 {
       
   306     // Shadowing a built-in constructor
       
   307     static_cast<JSWorkerContext*>(thisObject)->putDirect(Identifier(exec, "WebSocket"), value);
       
   308 }
       
   309 
       
   310 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionClose(ExecState* exec)
       
   311 {
       
   312     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   313     if (!castedThis)
       
   314         return throwVMTypeError(exec);
       
   315     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   316 
       
   317     imp->close();
       
   318     return JSValue::encode(jsUndefined());
       
   319 }
       
   320 
       
   321 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionImportScripts(ExecState* exec)
       
   322 {
       
   323     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   324     if (!castedThis)
       
   325         return throwVMTypeError(exec);
       
   326     return JSValue::encode(castedThis->importScripts(exec));
       
   327 }
       
   328 
       
   329 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionOpenDatabase(ExecState* exec)
       
   330 {
       
   331     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   332     if (!castedThis)
       
   333         return throwVMTypeError(exec);
       
   334     return JSValue::encode(castedThis->openDatabase(exec));
       
   335 }
       
   336 
       
   337 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionOpenDatabaseSync(ExecState* exec)
       
   338 {
       
   339     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   340     if (!castedThis)
       
   341         return throwVMTypeError(exec);
       
   342     return JSValue::encode(castedThis->openDatabaseSync(exec));
       
   343 }
       
   344 
       
   345 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionSetTimeout(ExecState* exec)
       
   346 {
       
   347     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   348     if (!castedThis)
       
   349         return throwVMTypeError(exec);
       
   350     return JSValue::encode(castedThis->setTimeout(exec));
       
   351 }
       
   352 
       
   353 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionClearTimeout(ExecState* exec)
       
   354 {
       
   355     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   356     if (!castedThis)
       
   357         return throwVMTypeError(exec);
       
   358     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   359     int handle = exec->argument(0).toInt32(exec);
       
   360 
       
   361     imp->clearTimeout(handle);
       
   362     return JSValue::encode(jsUndefined());
       
   363 }
       
   364 
       
   365 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionSetInterval(ExecState* exec)
       
   366 {
       
   367     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   368     if (!castedThis)
       
   369         return throwVMTypeError(exec);
       
   370     return JSValue::encode(castedThis->setInterval(exec));
       
   371 }
       
   372 
       
   373 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionClearInterval(ExecState* exec)
       
   374 {
       
   375     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   376     if (!castedThis)
       
   377         return throwVMTypeError(exec);
       
   378     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   379     int handle = exec->argument(0).toInt32(exec);
       
   380 
       
   381     imp->clearInterval(handle);
       
   382     return JSValue::encode(jsUndefined());
       
   383 }
       
   384 
       
   385 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionAddEventListener(ExecState* exec)
       
   386 {
       
   387     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   388     if (!castedThis)
       
   389         return throwVMTypeError(exec);
       
   390     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   391     JSValue listener = exec->argument(1);
       
   392     if (!listener.isObject())
       
   393         return JSValue::encode(jsUndefined());
       
   394     imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));
       
   395     return JSValue::encode(jsUndefined());
       
   396 }
       
   397 
       
   398 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionRemoveEventListener(ExecState* exec)
       
   399 {
       
   400     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   401     if (!castedThis)
       
   402         return throwVMTypeError(exec);
       
   403     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   404     JSValue listener = exec->argument(1);
       
   405     if (!listener.isObject())
       
   406         return JSValue::encode(jsUndefined());
       
   407     imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
       
   408     return JSValue::encode(jsUndefined());
       
   409 }
       
   410 
       
   411 EncodedJSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionDispatchEvent(ExecState* exec)
       
   412 {
       
   413     JSWorkerContext* castedThis = toJSWorkerContext(exec->hostThisValue().toThisObject(exec));
       
   414     if (!castedThis)
       
   415         return throwVMTypeError(exec);
       
   416     WorkerContext* imp = static_cast<WorkerContext*>(castedThis->impl());
       
   417     ExceptionCode ec = 0;
       
   418     Event* evt = toEvent(exec->argument(0));
       
   419 
       
   420 
       
   421     JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec));
       
   422     setDOMException(exec, ec);
       
   423     return JSValue::encode(result);
       
   424 }
       
   425 
       
   426 
       
   427 }
       
   428 
       
   429 #endif // ENABLE(WORKERS)