当前位置: 首页>>代码示例>>C++>>正文


C++ JSDOMWindow::put方法代码示例

本文整理汇总了C++中JSDOMWindow::put方法的典型用法代码示例。如果您正苦于以下问题:C++ JSDOMWindow::put方法的具体用法?C++ JSDOMWindow::put怎么用?C++ JSDOMWindow::put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JSDOMWindow的用法示例。


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

示例1: attachExtensionObjectToFrame

// FIXME: Revisit the creation of this class and make sure this is the best way to approach it.
void attachExtensionObjectToFrame(Frame* frame, WebPageClient* client)
{
    JSC::JSLock lock(JSC::SilenceAssertionsOnly);

    JSDOMWindow* window = frame->script()->windowShell(mainThreadNormalWorld())->window();

    JSC::ExecState* exec = window->globalExec();
    JSContextRef scriptCtx = toRef(exec);

    JSClassDefinition definition = kJSClassDefinitionEmpty;
    definition.staticValues = clientExtensionStaticValues;
    definition.staticFunctions = clientExtensionStaticFunctions;
    definition.initialize = clientExtensionInitialize;
    definition.finalize = clientExtensionFinalize;
    JSClassRef clientClass = JSClassCreate(&definition);

    JSObjectRef clientClassObject = JSObjectMake(scriptCtx, clientClass, 0);
    JSObjectSetPrivate(clientClassObject, reinterpret_cast<void*>(client));

    JSC::UString name("qnx");

    JSC::PutPropertySlot slot;
    window->put(window, exec, JSC::Identifier(exec, name), toJS(clientClassObject), slot);

    JSClassRelease(clientClass);
}
开发者ID:Moondee,项目名称:Artemis,代码行数:27,代码来源:ClientExtension.cpp

示例2: addToJSWindowObject

void WebFrame::addToJSWindowObject(const char* name, void *object)
{
    KJS::JSLock lock(false);
    JSDOMWindow *window = toJSDOMWindow(core(this));
    if (!window)
        return;
    KJS::Bindings::RootObject *root = core(this)->bindingRootObject();

    KJS::ExecState* exec = window->globalExec();
    KJS::JSObject *runtimeObject = KJS::Bindings::Instance::createRuntimeObject(exec, KJS::Bindings::BalInstance::create(static_cast<BalObject*>(object), root));

    window->put(exec, KJS::Identifier(exec, name), runtimeObject);
}
开发者ID:acss,项目名称:owb-mirror,代码行数:13,代码来源:WebFrame.cpp

示例3: addToJavaScriptWindowObject

/*!
    \fn void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership own)
    \overload

    Make \a object available under \a name from within the frame's JavaScript
    context. The \a object will be inserted as a child of the frame's window
    object.

    Qt properties will be exposed as JavaScript properties and slots as
    JavaScript methods.

    If you want to ensure that your QObjects remain accessible after loading a
    new URL, you should add them in a slot connected to the
    javaScriptWindowObjectCleared() signal.

    The ownership of \a object is specified using \a own.
*/
void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership)
{
    JSC::JSLock lock(false);
    JSDOMWindow* window = toJSDOMWindow(d->frame);
    JSC::Bindings::RootObject* root = d->frame->script()->bindingRootObject();
    if (!window) {
        qDebug() << "Warning: couldn't get window object";
        return;
    }

    JSC::ExecState* exec = window->globalExec();

    JSC::JSObject*runtimeObject =
        JSC::Bindings::Instance::createRuntimeObject(exec, JSC::Bindings::QtInstance::getQtInstance(object, root, ownership));

    JSC::PutPropertySlot slot;
    window->put(exec, JSC::Identifier(exec, (const UChar *) name.constData(), name.length()), runtimeObject, slot);
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例4: addToJSWindowObject

void WebFrame::addToJSWindowObject(const char* name, void *object)
{
    JSC::JSLock lock(false);
    JSDOMWindow *window = toJSDOMWindow(core(this));
    if (!window)
        return;
    
    JSC::Bindings::RootObject *root = core(this)->script()->bindingRootObject();
    JSC::ExecState* exec = window->globalExec();
    JSC::PropertySlot pr;

    if (!window->getOwnPropertySlot(exec, JSC::Identifier(exec, name), pr)) {
        //printf("addToJSWindowObject %p name =%s ok \n", core(this), name);
        //JSC::JSObject *runtimeObject = JSC::Bindings::Instance::createRuntimeObject(exec, JSC::Bindings::BalInstance::create(static_cast<BalObject*>(object), root));
        JSC::JSObject *runtimeObject = JSC::Bindings::Instance::createRuntimeObject(exec, JSC::Bindings::BalInstance::getBalInstance(static_cast<BalObject*>(object), root));
        JSC::PutPropertySlot prop;
        window->put(exec, JSC::Identifier(exec, name), runtimeObject, prop);
    }
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:19,代码来源:WebFrame.cpp

示例5: addToJavaScriptWindowObject

/*!
    \fn void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership own)
    \overload

    Make \a object available under \a name from within the frame's JavaScript
    context. The \a object will be inserted as a child of the frame's window
    object.

    Qt properties will be exposed as JavaScript properties and slots as
    JavaScript methods.

    If you want to ensure that your QObjects remain accessible after loading a
    new URL, you should add them in a slot connected to the
    javaScriptWindowObjectCleared() signal.

    If Javascript is not enabled for this page, then this method does nothing.

    The ownership of \a object is specified using \a own.
*/
void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership)
{
    if (!page()->settings()->testAttribute(QWebSettings::JavascriptEnabled))
        return;

    JSC::JSLock lock(JSC::SilenceAssertionsOnly);
    JSDOMWindow* window = toJSDOMWindow(d->frame, mainThreadNormalWorld());
    JSC::Bindings::RootObject* root = d->frame->script()->bindingRootObject();
    if (!window) {
        qDebug() << "Warning: couldn't get window object";
        return;
    }

    JSC::ExecState* exec = window->globalExec();

    JSC::JSObject* runtimeObject =
            JSC::Bindings::QtInstance::getQtInstance(object, root, ownership)->createRuntimeObject(exec);

    JSC::PutPropertySlot slot;
    window->put(exec, JSC::Identifier(exec, (const UChar *) name.constData(), name.length()), runtimeObject, slot);
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:40,代码来源:qwebframe.cpp

示例6: installDOMFunction

void PagePopupBlackBerry::installDOMFunction(Frame* frame)
{
    JSDOMWindow* window = toJSDOMWindow(frame, mainThreadNormalWorld());
    ASSERT(window);

    JSC::ExecState* exec = window->globalExec();
    ASSERT(exec);
    JSC::JSLockHolder lock(exec);

    JSContextRef context = ::toRef(exec);
    JSObjectRef globalObject = JSContextGetGlobalObject(context);
    JSStringRef functionName = JSStringCreateWithUTF8CString(
            "setValueAndClosePopup");
    JSObjectRef function = JSObjectMakeFunctionWithCallback(context,
            functionName, setValueAndClosePopupCallback);
    JSObjectSetProperty(context, globalObject, functionName, function,
            kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly, 0);

    // Register client into DOM
    JSClassDefinition definition = kJSClassDefinitionEmpty;
    definition.staticValues = popUpExtensionStaticValues;
    definition.staticFunctions = popUpExtensionStaticFunctions;
    definition.initialize = popUpExtensionInitialize;
    definition.finalize = popUpExtensionFinalize;
    JSClassRef clientClass = JSClassCreate(&definition);

    JSObjectRef clientClassObject = JSObjectMake(context, clientClass, 0);

    // Add a reference. See popUpExtensionFinalize.
    m_sharedClientPointer->ref();
    JSObjectSetPrivate(clientClassObject, m_sharedClientPointer.get());

    String name("popUp");

    JSC::PutPropertySlot slot;
    window->put(window, exec, JSC::Identifier(exec, name),
            toJS(clientClassObject), slot);

    JSClassRelease(clientClass);
}
开发者ID:dog-god,项目名称:iptv,代码行数:40,代码来源:PagePopupBlackBerry.cpp


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