コード例 #1
0
void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot* root)
{
    HTMLPlugInElement::didAddUserAgentShadowRoot(root);
    if (displayState() >= PreparingPluginReplacement)
        return;

    Page* page = document().page();
    if (!page)
        return;

    // Reset any author styles that may apply as we only want explicit
    // styles defined in the injected user agents stylesheets to specify
    // the look-and-feel of the snapshotted plug-in overlay. 
    root->setResetStyleInheritance(true);
    
    String mimeType = loadedMimeType();

    DOMWrapperWorld& isolatedWorld = plugInImageElementIsolatedWorld();
    document().ensurePlugInsInjectedScript(isolatedWorld);

    ScriptController& scriptController = document().frame()->script();
    JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(isolatedWorld));
    JSC::ExecState* exec = globalObject->globalExec();

    JSC::JSLockHolder lock(exec);

    JSC::MarkedArgumentBuffer argList;
    argList.append(toJS(exec, globalObject, root));
    argList.append(jsString(exec, titleText(page, mimeType)));
    argList.append(jsString(exec, subtitleText(page, mimeType)));
    
    // This parameter determines whether or not the snapshot overlay should always be visible over the plugin snapshot.
    // If no snapshot was found then we want the overlay to be visible.
    argList.append(JSC::jsBoolean(!m_snapshotImage));

    // It is expected the JS file provides a createOverlay(shadowRoot, title, subtitle) function.
    JSC::JSObject* overlay = globalObject->get(exec, JSC::Identifier::fromString(exec, "createOverlay")).toObject(exec);
    if (!overlay) {
        ASSERT(exec->hadException());
        exec->clearException();
        return;
    }
    JSC::CallData callData;
    JSC::CallType callType = overlay->methodTable()->getCallData(overlay, callData);
    if (callType == JSC::CallType::None)
        return;

    JSC::call(exec, overlay, callType, callData, globalObject, argList);
    exec->clearException();
}
コード例 #2
0
ファイル: DragDataApollo.cpp プロジェクト: UIKit0/WebkitAIR
void DragData::asFilenames(Vector<String>& result) const
{
    bool success;
    JSC::JSValue data = m_platformDragData->getData(ClipboardApolloHelper::FILE_LIST_TYPE, success);
    JSC::ExecState *exec = m_platformDragData->execState();
    if (success && data.isObject()) {
        JSC::JSObject* filenameArray = data.toObject(exec);
        uint32_t length = filenameArray->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
        for (uint32_t i=0; i<length; i++) {
            JSC::JSValue fileValue = filenameArray->get(exec, i);
            if (fileValue.isObject()) {
                JSC::JSObject* file = fileValue.toObject(exec);
                JSC::JSValue pathValue = file->get(exec, JSC::Identifier(exec, "nativePath"));
                if (pathValue.isString()) {
                    String path = ustringToString(pathValue.toString(exec));
                    result.append(path);
                }
            }
        }
    }
    if (exec->hadException())
        exec->clearException();
}
コード例 #3
0
void ReadableJSStream::storeException(JSC::ExecState& state)
{
    JSValue exception = state.exception()->value();
    state.clearException();
    storeError(state, exception);
}