示例#1
0
void JSSharedWorkerOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSSharedWorker* jsSharedWorker = jsCast<JSSharedWorker*>(handle.get().asCell());
    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, &jsSharedWorker->impl(), jsSharedWorker);
    jsSharedWorker->releaseImpl();
}
示例#2
0
EncodedJSValue jsSharedWorkerConstructor(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue, PropertyName)
{
    JSSharedWorker* domObject = jsDynamicCast<JSSharedWorker*>(JSValue::decode(thisValue));
    if (!domObject)
        return throwVMTypeError(exec);
    if (!domObject)
        return throwVMTypeError(exec);
    return JSValue::encode(JSSharedWorker::getConstructor(exec->vm(), domObject->globalObject()));
}
示例#3
0
bool JSSharedWorkerOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSSharedWorker* jsSharedWorker = jsCast<JSSharedWorker*>(handle.get().asCell());
    if (jsSharedWorker->impl().hasPendingActivity())
        return true;
    if (jsSharedWorker->impl().isFiringEventListeners())
        return true;
    UNUSED_PARAM(visitor);
    return false;
}
示例#4
0
void JSSharedWorker::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
    JSSharedWorker* thisObject = jsCast<JSSharedWorker*>(cell);
    ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
    Base::visitChildren(thisObject, visitor);

    if (MessagePort* port = thisObject->impl()->port())
        visitor.addOpaqueRoot(port);
}
示例#5
0
EncodedJSValue jsSharedWorkerPort(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSharedWorker* castedThis = jsDynamicCast<JSSharedWorker*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SharedWorker& impl = castedThis->impl();
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.port()));
    return JSValue::encode(result);
}
示例#6
0
void setJSSharedWorkerOnerror(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
    JSValue value = JSValue::decode(encodedValue);
    UNUSED_PARAM(exec);
    JSSharedWorker* castedThis = jsDynamicCast<JSSharedWorker*>(JSValue::decode(thisValue));
    if (!castedThis) {
        throwVMTypeError(exec);
        return;
    }
    UNUSED_PARAM(exec);
    SharedWorker& impl = castedThis->impl();
    impl.setOnerror(createJSAttributeEventListener(exec, value, castedThis));
}
示例#7
0
EncodedJSValue jsSharedWorkerOnerror(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSharedWorker* castedThis = jsDynamicCast<JSSharedWorker*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SharedWorker& impl = castedThis->impl();
    if (EventListener* listener = impl.onerror()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(impl.scriptExecutionContext()))
                return JSValue::encode(jsFunction);
        }
    }
    return JSValue::encode(jsNull());
}