Exemple #1
0
JSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionRemoveEventListener(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSWorkerContext::s_info))
        return throwError(exec, TypeError);
    JSWorkerContext* castedThisObj = static_cast<JSWorkerContext*>(asObject(thisValue));
    return castedThisObj->removeEventListener(exec, args);
}
Exemple #2
0
JSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionPostMessage(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSWorkerContext::s_info))
        return throwError(exec, TypeError);
    JSWorkerContext* castedThisObj = static_cast<JSWorkerContext*>(asObject(thisValue));
    WorkerContext* imp = static_cast<WorkerContext*>(castedThisObj->impl());
    const UString& message = args.at(0).toString(exec);

    imp->postMessage(message);
    return jsUndefined();
}
Exemple #3
0
JSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionClearInterval(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSWorkerContext::s_info))
        return throwError(exec, TypeError);
    JSWorkerContext* castedThisObj = static_cast<JSWorkerContext*>(asObject(thisValue));
    WorkerContext* imp = static_cast<WorkerContext*>(castedThisObj->impl());
    int handle = args.at(0).toInt32(exec);

    imp->clearInterval(handle);
    return jsUndefined();
}
Exemple #4
0
JSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionDispatchEvent(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSWorkerContext::s_info))
        return throwError(exec, TypeError);
    JSWorkerContext* castedThisObj = static_cast<JSWorkerContext*>(asObject(thisValue));
    WorkerContext* imp = static_cast<WorkerContext*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    Event* evt = toEvent(args.at(0));


    JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec));
    setDOMException(exec, ec);
    return result;
}
void JSWorkerContext::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
    JSWorkerContext* thisObject = jsCast<JSWorkerContext*>(cell);
    ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
    Base::visitChildren(thisObject, visitor);

    if (WorkerLocation* location = thisObject->impl()->optionalLocation())
        visitor.addOpaqueRoot(location);
    if (WorkerNavigator* navigator = thisObject->impl()->optionalNavigator())
        visitor.addOpaqueRoot(navigator);

    thisObject->impl()->visitJSEventListeners(visitor);
}