您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ toJS函数代码示例

51自学网 2021-06-03 08:53:00
  C++
这篇教程C++ toJS函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中toJS函数的典型用法代码示例。如果您正苦于以下问题:C++ toJS函数的具体用法?C++ toJS怎么用?C++ toJS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了toJS函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getOrCreate

RefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(JSContextRef, JSObjectRef object){    Node* node = JSNode::toWrapped(toJS(object));    return getOrCreate(node);}
开发者ID:eocanha,项目名称:webkit,代码行数:5,


示例2: switch

JSValue* JSSVGFEFloodElement::getValueProperty(ExecState* exec, int token) const{    switch (token) {    case In1AttrNum: {        SVGFEFloodElement* imp = static_cast<SVGFEFloodElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedString> obj = imp->in1Animated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedString>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case XAttrNum: {        SVGFEFloodElement* imp = static_cast<SVGFEFloodElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->xAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case YAttrNum: {        SVGFEFloodElement* imp = static_cast<SVGFEFloodElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->yAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case WidthAttrNum: {        SVGFEFloodElement* imp = static_cast<SVGFEFloodElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->widthAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case HeightAttrNum: {        SVGFEFloodElement* imp = static_cast<SVGFEFloodElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->heightAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case ResultAttrNum: {        SVGFEFloodElement* imp = static_cast<SVGFEFloodElement*>(impl());//.........这里部分代码省略.........
开发者ID:FilipBE,项目名称:qtextended,代码行数:101,


示例3: ASSERT_GC_OBJECT_INHERITS

EncodedJSValue JSNodeList::indexGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, unsigned index){    JSNodeList* thisObj = jsCast<JSNodeList*>(JSValue::decode(slotBase));    ASSERT_GC_OBJECT_INHERITS(thisObj, info());    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().item(index)));}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:6,


示例4: toJS

JSValue JSNamedNodeMap::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot){    JSNamedNodeMap* thisObj = static_cast<JSNamedNodeMap*>(asObject(slot.slotBase()));    return toJS(exec, thisObj->impl()->getNamedItem(propertyName));}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:5,


示例5: toJS

JSValue* JSNodeList::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot){    JSNodeList* thisObj = static_cast<JSNodeList*>(slot.slotBase());    return toJS(exec, thisObj->impl()->itemWithName(propertyName));}
开发者ID:Czerrr,项目名称:ISeeBrowser,代码行数:5,


示例6: ASSERT

void JSDOMWindowBase::updateDocument(){    ASSERT(m_impl->document());    ExecState* exec = globalExec();    symbolTablePutWithAttributes(exec->globalData(), Identifier(exec, "document"), toJS(exec, this, m_impl->document()), DontDelete | ReadOnly);}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:6,


示例7: throwError

JSValue* JSSVGTransformListPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args){    if (!thisObj->inherits(&JSSVGTransformList::info))      return throwError(exec, TypeError);    SVGTransformList* imp = static_cast<SVGTransformList*>(static_cast<JSSVGTransformList*>(thisObj)->impl());    switch (id) {    case JSSVGTransformList::ClearFuncNum: {        ExceptionCode ec = 0;        imp->clear(ec);        setDOMException(exec, ec);        return jsUndefined();    }    case JSSVGTransformList::InitializeFuncNum: {        ExceptionCode ec = 0;        SVGTransform item = toSVGTransform(args[0]);        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->initialize(item, ec)));        setDOMException(exec, ec);        return result;    }    case JSSVGTransformList::GetItemFuncNum: {        ExceptionCode ec = 0;        bool indexOk;        unsigned index = args[0]->toInt32(exec, indexOk);        if (!indexOk) {            setDOMException(exec, TYPE_MISMATCH_ERR);            return jsUndefined();        }        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->getItem(index, ec)));        setDOMException(exec, ec);        return result;    }    case JSSVGTransformList::InsertItemBeforeFuncNum: {        ExceptionCode ec = 0;        SVGTransform item = toSVGTransform(args[0]);        bool indexOk;        unsigned index = args[1]->toInt32(exec, indexOk);        if (!indexOk) {            setDOMException(exec, TYPE_MISMATCH_ERR);            return jsUndefined();        }        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->insertItemBefore(item, index, ec)));        setDOMException(exec, ec);        return result;    }    case JSSVGTransformList::ReplaceItemFuncNum: {        ExceptionCode ec = 0;        SVGTransform item = toSVGTransform(args[0]);        bool indexOk;        unsigned index = args[1]->toInt32(exec, indexOk);        if (!indexOk) {            setDOMException(exec, TYPE_MISMATCH_ERR);            return jsUndefined();        }        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->replaceItem(item, index, ec)));        setDOMException(exec, ec);        return result;    }    case JSSVGTransformList::RemoveItemFuncNum: {        ExceptionCode ec = 0;        bool indexOk;        unsigned index = args[0]->toInt32(exec, indexOk);        if (!indexOk) {            setDOMException(exec, TYPE_MISMATCH_ERR);            return jsUndefined();        }        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->removeItem(index, ec)));        setDOMException(exec, ec);        return result;    }    case JSSVGTransformList::AppendItemFuncNum: {        ExceptionCode ec = 0;        SVGTransform item = toSVGTransform(args[0]);        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->appendItem(item, ec)));        setDOMException(exec, ec);        return result;    }    case JSSVGTransformList::CreateSVGTransformFromMatrixFuncNum: {        AffineTransform matrix = toSVGMatrix(args[0]);        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->createSVGTransformFromMatrix(matrix)));        return result;    }    case JSSVGTransformList::ConsolidateFuncNum: {//.........这里部分代码省略.........
开发者ID:FilipBE,项目名称:qtextended,代码行数:101,


示例8: switch

JSValue* JSSVGFilterElement::getValueProperty(ExecState* exec, int token) const{    switch (token) {    case FilterUnitsAttrNum: {        SVGFilterElement* imp = static_cast<SVGFilterElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedEnumeration> obj = imp->filterUnitsAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedEnumeration>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedEnumeration>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedEnumeration>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case PrimitiveUnitsAttrNum: {        SVGFilterElement* imp = static_cast<SVGFilterElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedEnumeration> obj = imp->primitiveUnitsAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedEnumeration>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedEnumeration>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedEnumeration>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case XAttrNum: {        SVGFilterElement* imp = static_cast<SVGFilterElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->xAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case YAttrNum: {        SVGFilterElement* imp = static_cast<SVGFilterElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->yAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case WidthAttrNum: {        SVGFilterElement* imp = static_cast<SVGFilterElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->widthAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case HeightAttrNum: {        SVGFilterElement* imp = static_cast<SVGFilterElement*>(impl());//.........这里部分代码省略.........
开发者ID:FilipBE,项目名称:qtextended,代码行数:101,


示例9: throwError

JSValue* JSSVGPathElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args){    if (!thisObj->inherits(&JSSVGPathElement::info))      return throwError(exec, TypeError);    SVGPathElement* imp = static_cast<SVGPathElement*>(static_cast<JSSVGPathElement*>(thisObj)->impl());    switch (id) {    case JSSVGPathElement::GetTotalLengthFuncNum: {        KJS::JSValue* result = jsNumber(imp->getTotalLength());        return result;    }    case JSSVGPathElement::GetPointAtLengthFuncNum: {        float distance = args[0]->toFloat(exec);        KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatPoint>(imp->getPointAtLength(distance)));        return result;    }    case JSSVGPathElement::GetPathSegAtLengthFuncNum: {        float distance = args[0]->toFloat(exec);        KJS::JSValue* result = jsNumber(imp->getPathSegAtLength(distance));        return result;    }    case JSSVGPathElement::CreateSVGPathSegClosePathFuncNum: {        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createSVGPathSegClosePath()));        return result;    }    case JSSVGPathElement::CreateSVGPathSegMovetoAbsFuncNum: {        float x = args[0]->toFloat(exec);        float y = args[1]->toFloat(exec);        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createSVGPathSegMovetoAbs(x, y)));        return result;    }    case JSSVGPathElement::CreateSVGPathSegMovetoRelFuncNum: {        float x = args[0]->toFloat(exec);        float y = args[1]->toFloat(exec);        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createSVGPathSegMovetoRel(x, y)));        return result;    }    case JSSVGPathElement::CreateSVGPathSegLinetoAbsFuncNum: {        float x = args[0]->toFloat(exec);        float y = args[1]->toFloat(exec);        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createSVGPathSegLinetoAbs(x, y)));        return result;    }    case JSSVGPathElement::CreateSVGPathSegLinetoRelFuncNum: {        float x = args[0]->toFloat(exec);        float y = args[1]->toFloat(exec);        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createSVGPathSegLinetoRel(x, y)));        return result;    }    case JSSVGPathElement::CreateSVGPathSegCurvetoCubicAbsFuncNum: {        float x = args[0]->toFloat(exec);        float y = args[1]->toFloat(exec);        float x1 = args[2]->toFloat(exec);        float y1 = args[3]->toFloat(exec);        float x2 = args[4]->toFloat(exec);        float y2 = args[5]->toFloat(exec);        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2)));        return result;    }    case JSSVGPathElement::CreateSVGPathSegCurvetoCubicRelFuncNum: {        float x = args[0]->toFloat(exec);        float y = args[1]->toFloat(exec);        float x1 = args[2]->toFloat(exec);        float y1 = args[3]->toFloat(exec);        float x2 = args[4]->toFloat(exec);        float y2 = args[5]->toFloat(exec);        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2)));        return result;    }    case JSSVGPathElement::CreateSVGPathSegCurvetoQuadraticAbsFuncNum: {        float x = args[0]->toFloat(exec);        float y = args[1]->toFloat(exec);        float x1 = args[2]->toFloat(exec);        float y1 = args[3]->toFloat(exec);        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1)));        return result;    }//.........这里部分代码省略.........
开发者ID:FilipBE,项目名称:qtextended,代码行数:101,


示例10: ASSERT

void JSDOMWindowBase::updateDocument(){    ASSERT(m_impl->document());    ExecState* exec = globalExec();    symbolTablePutWithAttributes(this, exec->vm(), exec->vm().propertyNames->document, toJS(exec, this, m_impl->document()), DontDelete | ReadOnly);}
开发者ID:webOS-ports,项目名称:webkit,代码行数:6,


示例11: toJS

KJS::JSValue* JSNodeList::nameGetter(KJS::ExecState* exec, KJS::JSObject* originalObject, const KJS::Identifier& propertyName, const KJS::PropertySlot& slot){    JSNodeList* thisObj = static_cast<JSNodeList*>(slot.slotBase());    return toJS(exec, thisObj->impl()->itemWithName(propertyName));}
开发者ID:Crawping,项目名称:davinci,代码行数:5,


示例12: jsHTMLIFrameElementContentDocument

JSValue jsHTMLIFrameElementContentDocument(ExecState* exec, JSValue slotBase, const Identifier&){    JSHTMLIFrameElement* castedThis = static_cast<JSHTMLIFrameElement*>(asObject(slotBase));    HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(castedThis->impl());    return checkNodeSecurity(exec, imp->contentDocument()) ? toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->contentDocument())) : jsUndefined();}
开发者ID:13W,项目名称:phantomjs,代码行数:6,


示例13: toJS

static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, WebGLExtension* extension){    if (!extension)        return jsNull();    switch (extension->getName()) {    case WebGLExtension::WebGLLoseContextName:        return toJS(exec, globalObject, static_cast<WebGLLoseContext*>(extension));    case WebGLExtension::EXTDrawBuffersName:        return toJS(exec, globalObject, static_cast<EXTDrawBuffers*>(extension));    case WebGLExtension::EXTTextureFilterAnisotropicName:        return toJS(exec, globalObject, static_cast<EXTTextureFilterAnisotropic*>(extension));    case WebGLExtension::OESStandardDerivativesName:        return toJS(exec, globalObject, static_cast<OESStandardDerivatives*>(extension));    case WebGLExtension::OESTextureFloatName:        return toJS(exec, globalObject, static_cast<OESTextureFloat*>(extension));    case WebGLExtension::OESTextureHalfFloatName:        return toJS(exec, globalObject, static_cast<OESTextureHalfFloat*>(extension));    case WebGLExtension::OESVertexArrayObjectName:        return toJS(exec, globalObject, static_cast<OESVertexArrayObject*>(extension));    case WebGLExtension::OESElementIndexUintName:        return toJS(exec, globalObject, static_cast<OESElementIndexUint*>(extension));    case WebGLExtension::WebGLDebugRendererInfoName:        return toJS(exec, globalObject, static_cast<WebGLDebugRendererInfo*>(extension));    case WebGLExtension::WebGLDebugShadersName:        return toJS(exec, globalObject, static_cast<WebGLDebugShaders*>(extension));    case WebGLExtension::WebGLCompressedTextureATCName:        return toJS(exec, globalObject, static_cast<WebGLCompressedTextureATC*>(extension));    case WebGLExtension::WebGLCompressedTextureS3TCName:        return toJS(exec, globalObject, static_cast<WebGLCompressedTextureS3TC*>(extension));    case WebGLExtension::WebGLDepthTextureName:        return toJS(exec, globalObject, static_cast<WebGLDepthTexture*>(extension));    }    ASSERT_NOT_REACHED();    return jsNull();}
开发者ID:jbat100,项目名称:webkit,代码行数:35,


示例14: ASSERT

JSObject* JSLazyEventListener::initializeJSFunction(ScriptExecutionContext* executionContext) const{    ASSERT(is<Document>(executionContext));    if (!executionContext)        return nullptr;    ASSERT(!m_code.isNull());    ASSERT(!m_eventParameterName.isNull());    if (m_code.isNull() || m_eventParameterName.isNull())        return nullptr;    Document& document = downcast<Document>(*executionContext);    if (!document.frame())        return nullptr;    if (!document.contentSecurityPolicy()->allowInlineEventHandlers(m_sourceURL, m_sourcePosition.m_line))        return nullptr;    ScriptController& script = document.frame()->script();    if (!script.canExecuteScripts(AboutToExecuteScript) || script.isPaused())        return nullptr;    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, isolatedWorld());    if (!globalObject)        return nullptr;    VM& vm = globalObject->vm();    JSLockHolder lock(vm);    auto scope = DECLARE_CATCH_SCOPE(vm);    ExecState* exec = globalObject->globalExec();    MarkedArgumentBuffer args;    args.append(jsNontrivialString(exec, m_eventParameterName));    args.append(jsStringWithCache(exec, m_code));    // We want all errors to refer back to the line on which our attribute was    // declared, regardless of any newlines in our JavaScript source text.    int overrideLineNumber = m_sourcePosition.m_line.oneBasedInt();    JSObject* jsFunction = constructFunctionSkippingEvalEnabledCheck(        exec, exec->lexicalGlobalObject(), args, Identifier::fromString(exec, m_functionName),        m_sourceURL, m_sourcePosition, overrideLineNumber);    if (UNLIKELY(scope.exception())) {        reportCurrentException(exec);        scope.clearException();        return nullptr;    }    JSFunction* listenerAsFunction = jsCast<JSFunction*>(jsFunction);    if (m_originalNode) {        if (!wrapper()) {            // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.            // FIXME: Should pass the global object associated with the node            setWrapper(vm, asObject(toJS(exec, globalObject, *m_originalNode)));        }        // Add the event's home element to the scope        // (and the document, and the form - see JSHTMLElement::eventHandlerScope)        listenerAsFunction->setScope(vm, jsCast<JSNode*>(wrapper())->pushEventHandlerScope(exec, listenerAsFunction->scope()));    }    return jsFunction;}
开发者ID:eocanha,项目名称:webkit,代码行数:65,


示例15: ASSERT_GC_OBJECT_INHERITS

JSValue JSHTMLCollection::indexGetter(ExecState* exec, JSValue slotBase, unsigned index){    JSHTMLCollection* thisObj = static_cast<JSHTMLCollection*>(asObject(slotBase));    ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);    return toJS(exec, thisObj->globalObject(), static_cast<HTMLCollection*>(thisObj->impl())->item(index));}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:6,


示例16: toJS

JSValue toJS(ExecState* exec, JSDOMGlobalObject*, WorkerGlobalScope* workerGlobalScope){    return toJS(exec, workerGlobalScope);}
开发者ID:hnney,项目名称:webkit,代码行数:4,


示例17: toJS

// JSDOMGlobalObject* is ignored, accessing a window in any context will// use that DOMWindow's prototype chain.JSValue toJS(ExecState* exec, JSDOMGlobalObject*, DOMWindow* domWindow){    return toJS(exec, domWindow);}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:6,


示例18: ASSERT

void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event){    ASSERT(scriptExecutionContext);    if (!scriptExecutionContext || scriptExecutionContext->isJSExecutionForbidden())        return;    VM& vm = scriptExecutionContext->vm();    JSLockHolder lock(vm);    auto scope = DECLARE_CATCH_SCOPE(vm);    // See https://dom.spec.whatwg.org/#dispatching-events spec on calling handleEvent.    // "If this throws an exception, report the exception." It should not propagate the    // exception.    JSObject* jsFunction = this->jsFunction(scriptExecutionContext);    if (!jsFunction)        return;    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, *m_isolatedWorld);    if (!globalObject)        return;    if (scriptExecutionContext->isDocument()) {        JSDOMWindow* window = jsCast<JSDOMWindow*>(globalObject);        if (!window->wrapped().isCurrentlyDisplayedInFrame())            return;        if (wasCreatedFromMarkup() && !scriptExecutionContext->contentSecurityPolicy()->allowInlineEventHandlers(sourceURL(), sourcePosition().m_line))            return;        // FIXME: Is this check needed for other contexts?        ScriptController& script = window->wrapped().frame()->script();        if (!script.canExecuteScripts(AboutToExecuteScript) || script.isPaused())            return;    }    ExecState* exec = globalObject->globalExec();    JSValue handleEventFunction = jsFunction;    CallData callData;    CallType callType = getCallData(handleEventFunction, callData);    // If jsFunction is not actually a function, see if it implements the EventListener interface and use that    if (callType == CallType::None) {        handleEventFunction = jsFunction->get(exec, Identifier::fromString(exec, "handleEvent"));        if (UNLIKELY(scope.exception())) {            auto* exception = scope.exception();            scope.clearException();            event->target()->uncaughtExceptionInEventHandler();            reportException(exec, exception);            return;        }        callType = getCallData(handleEventFunction, callData);    }    if (callType != CallType::None) {        Ref<JSEventListener> protectedThis(*this);        MarkedArgumentBuffer args;        args.append(toJS(exec, globalObject, event));        Event* savedEvent = globalObject->currentEvent();        globalObject->setCurrentEvent(event);        VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject);        InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(scriptExecutionContext, callType, callData);        JSValue thisValue = handleEventFunction == jsFunction ? toJS(exec, globalObject, event->currentTarget()) : jsFunction;        NakedPtr<JSC::Exception> exception;        JSValue retval = scriptExecutionContext->isDocument()            ? JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, handleEventFunction, callType, callData, thisValue, args, exception)            : JSC::profiledCall(exec, JSC::ProfilingReason::Other, handleEventFunction, callType, callData, thisValue, args, exception);        InspectorInstrumentation::didCallFunction(cookie, scriptExecutionContext);        globalObject->setCurrentEvent(savedEvent);        if (is<WorkerGlobalScope>(*scriptExecutionContext)) {            auto scriptController = downcast<WorkerGlobalScope>(*scriptExecutionContext).script();            bool terminatorCausedException = (scope.exception() && isTerminatedExecutionException(scope.exception()));            if (terminatorCausedException || scriptController->isTerminatingExecution())                scriptController->forbidExecution();        }        if (exception) {            event->target()->uncaughtExceptionInEventHandler();            reportException(exec, exception);        } else {            if (!retval.isUndefinedOrNull() && is<BeforeUnloadEvent>(*event))                downcast<BeforeUnloadEvent>(*event).setReturnValue(retval.toWTFString(exec));            if (m_isAttribute) {                if (retval.isFalse())                    event->preventDefault();            }        }    }}
开发者ID:eocanha,项目名称:webkit,代码行数:95,


示例19: constructJSTestNode

EncodedJSValue JSC_HOST_CALL JSTestNodeConstructor::constructJSTestNode(ExecState* exec){    JSTestNodeConstructor* castedThis = jsCast<JSTestNodeConstructor*>(exec->callee());    RefPtr<TestNode> object = TestNode::create();    return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:6,


示例20: switch

JSValue* JSSVGCircleElement::getValueProperty(ExecState* exec, int token) const{    switch (token) {    case CxAttrNum: {        SVGCircleElement* imp = static_cast<SVGCircleElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->cxAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case CyAttrNum: {        SVGCircleElement* imp = static_cast<SVGCircleElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->cyAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case RAttrNum: {        SVGCircleElement* imp = static_cast<SVGCircleElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedLength> obj = imp->rAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);            }        }        return toJS(exec, obj.get());    }    case RequiredFeaturesAttrNum: {        SVGCircleElement* imp = static_cast<SVGCircleElement*>(impl());        return toJS(exec, WTF::getPtr(imp->requiredFeatures()));    }    case RequiredExtensionsAttrNum: {        SVGCircleElement* imp = static_cast<SVGCircleElement*>(impl());        return toJS(exec, WTF::getPtr(imp->requiredExtensions()));    }    case SystemLanguageAttrNum: {        SVGCircleElement* imp = static_cast<SVGCircleElement*>(impl());        return toJS(exec, WTF::getPtr(imp->systemLanguage()));    }    case XmllangAttrNum: {        SVGCircleElement* imp = static_cast<SVGCircleElement*>(impl());        return jsString(imp->xmllang());    }    case XmlspaceAttrNum: {        SVGCircleElement* imp = static_cast<SVGCircleElement*>(impl());        return jsString(imp->xmlspace());    }    case ExternalResourcesRequiredAttrNum: {        SVGCircleElement* imp = static_cast<SVGCircleElement*>(impl());        ASSERT(exec && exec->dynamicInterpreter());        RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated();        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();        if (activeFrame) {            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);            if (extensions) {                if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get()))                    ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp);                else                    extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp);            }//.........这里部分代码省略.........
开发者ID:FilipBE,项目名称:qtextended,代码行数:101,


示例21: constructJSXMLSerializer

EncodedJSValue JSC_HOST_CALL JSXMLSerializerConstructor::constructJSXMLSerializer(ExecState* exec){    return JSValue::encode(asObject(toJS(exec, static_cast<JSXMLSerializerConstructor*>(exec->callee())->globalObject(), XMLSerializer::create())));}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:4,


示例22: toJS

JSValue JSNodeList::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName){    JSNodeList* thisObj = static_cast<JSNodeList*>(asObject(slotBase));    return toJS(exec, thisObj->impl()->itemWithName(identifierToAtomicString(propertyName)));}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:5,


示例23: toJS

JSValue toJS(ExecState* exec, JSDOMGlobalObject*, WorkerContext* workerContext){    return toJS(exec, workerContext);}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:4,


示例24: impl

JSValue* JSEvent::clipboardData(ExecState* exec) const{    return impl()->isClipboardEvent() ? toJS(exec, impl()->clipboardData()) : jsUndefined();}
开发者ID:acss,项目名称:owb-mirror,代码行数:4,


示例25: lock

ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node){    JSLock lock(SilenceAssertionsOnly);    return ScriptValue(state->globalData(), toJS(state, deprecatedGlobalObjectForPrototype(state), node));}
开发者ID:dzhshf,项目名称:WebKit,代码行数:5,


示例26: globalObject

JSValue JSHTMLOptionsCollection::remove(ExecState* exec){    HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());    JSHTMLSelectElement* base = jsCast<JSHTMLSelectElement*>(asObject(toJS(exec, globalObject(), imp->ownerNode())));    return base->remove(exec);}
开发者ID:jiezh,项目名称:h5vcc,代码行数:6,



注:本文中的toJS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ toJson函数代码示例
C++ toInt32函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。