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


C++ JSStringCopyUTF8CString函数代码示例

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


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

示例1: content

bool LoadHTMLStringItem::invoke() const
{
    GUniquePtr<gchar> content(JSStringCopyUTF8CString(m_content.get()));
    GUniquePtr<gchar> baseURL(JSStringCopyUTF8CString(m_baseURL.get()));

    if (m_unreachableURL) {
        GUniquePtr<gchar> unreachableURL(JSStringCopyUTF8CString(m_unreachableURL.get()));
        webkit_web_frame_load_alternate_string(mainFrame, content.get(), baseURL.get(), unreachableURL.get());
        return true;
    }
    webkit_web_frame_load_string(mainFrame, content.get(), 0, 0, baseURL.get());
    return true;
}
开发者ID:CannedFish,项目名称:webkitgtk,代码行数:13,代码来源:WorkQueueItemGtk.cpp

示例2: g_free

void LayoutTestController::setUserStyleSheetLocation(JSStringRef path)
{
    g_free(userStyleSheet);
    userStyleSheet = JSStringCopyUTF8CString(path);
    if (userStyleSheetEnabled)
        setUserStyleSheetEnabled(true);
}
开发者ID:Spencerx,项目名称:webkit,代码行数:7,代码来源:LayoutTestControllerGtk.cpp

示例3: sourceCode

void LayoutTestController::addUserStyleSheet(JSStringRef source, bool allFrames)
{
    GOwnPtr<gchar> sourceCode(JSStringCopyUTF8CString(source));
    DumpRenderTreeSupportGtk::addUserStyleSheet(mainFrame, sourceCode.get(), allFrames);
    // FIXME: needs more investigation why userscripts/user-style-top-frame-only.html fails when allFrames is false.

}
开发者ID:Spencerx,项目名称:webkit,代码行数:7,代码来源:LayoutTestControllerGtk.cpp

示例4: fillConfigurationFromFile

// Application controller static callback.
static JSValueRef fillConfigurationFromFile(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception, ConfigFileType type)
{
    if (argumentCount < 1)
        return JSValueMakeUndefined(context);

    JSRetainPtr<JSStringRef> fileNameJSString(Adopt, JSValueToStringCopy(context, arguments[0], exception));
    //ASSERT(!*exception);

    ApplicationTestController* controller = static_cast<ApplicationTestController*>(JSObjectGetPrivate(thisObject));
    char* relativeURL = JSStringCopyUTF8CString(fileNameJSString.get());

    if (strncmp("http://", relativeURL, 7) != 0
     && strncmp("https://", relativeURL, 8) != 0
     && strncmp("data:", relativeURL, 5) != 0
     && strncmp("file://", relativeURL, 7) != 0) {
        WebView* webView = getWebView();
        string mainFrameURL = webView->mainFrameURL();
        size_t pos = mainFrameURL.find_last_of("/");
        string absoluteURL = mainFrameURL.substr(0, pos + 1);
        absoluteURL += relativeURL;
        size_t pos2 = absoluteURL.find_last_of("?");
        if (pos2 == absoluteURL.size() - 1)
            absoluteURL = absoluteURL.substr(0, pos2);

        controller->fillConfigurationFromFile((char*)absoluteURL.c_str(), type);
        return JSValueMakeUndefined(context);
    }

    controller->fillConfigurationFromFile(relativeURL, type);
    return JSValueMakeUndefined(context);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:32,代码来源:ApplicationTestController.cpp

示例5: JSStringCopyUTF8CString

bool ScriptItem::invoke() const
{
    char* scriptString = JSStringCopyUTF8CString(m_script.get());
    getWebView()->executeScript(scriptString);
    free(scriptString);
    return true;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:7,代码来源:WorkQueueItemBal.cpp

示例6: JSStringCopyUTF8CString

int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidth, float pageHeight)
{
    gchar* idGChar = JSStringCopyUTF8CString(id);
    int pageNumber = DumpRenderTreeSupportGtk::pageNumberForElementById(mainFrame, idGChar, pageWidth, pageHeight);
    g_free(idGChar);
    return pageNumber;
}
开发者ID:Spencerx,项目名称:webkit,代码行数:7,代码来源:LayoutTestControllerGtk.cpp

示例7: webkit_web_frame_get_web_view

bool ScriptItem::invoke() const
{
    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
    gchar* scriptString = JSStringCopyUTF8CString(m_script.get());
    webkit_web_view_execute_script(webView, scriptString);
    g_free(scriptString);
    return true;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:8,代码来源:WorkQueueItemGtk.cpp

示例8: webkit_web_frame_get_web_view

void TestRunner::evaluateInWebInspector(JSStringRef script)
{
    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
    WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
    char* scriptString = JSStringCopyUTF8CString(script);

    webkit_web_inspector_execute_script(inspector, scriptString);
    g_free(scriptString);
}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:9,代码来源:TestRunnerGtk.cpp

示例9: webkit_web_frame_get_web_view

void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
{
    WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
    WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
    char* scriptString = JSStringCopyUTF8CString(script);

    webkit_web_inspector_execute_script(inspector, callId, scriptString);
    g_free(scriptString);
}
开发者ID:Spencerx,项目名称:webkit,代码行数:9,代码来源:LayoutTestControllerGtk.cpp

示例10: WEBKIT_WEB_VIEW

void LayoutTestController::setMockGeolocationError(int code, JSStringRef message)
{
    WebKitWebView* view = WEBKIT_WEB_VIEW(g_slist_nth_data(webViewList, 0));
    if (!view)
        view = webkit_web_frame_get_web_view(mainFrame);
    ASSERT(view);

    GOwnPtr<gchar> cMessage(JSStringCopyUTF8CString(message));
    DumpRenderTreeSupportGtk::setMockGeolocationError(view, code, cMessage.get());
}
开发者ID:Spencerx,项目名称:webkit,代码行数:10,代码来源:LayoutTestControllerGtk.cpp

示例11: JSStringCopyUTF8CString

bool LoadItem::invoke() const
{
    gchar* targetString = JSStringCopyUTF8CString(m_target.get());

    WebKitWebFrame* targetFrame;
    if (!strlen(targetString))
        targetFrame = mainFrame;
    else
        targetFrame = webkit_web_frame_find_frame(mainFrame, targetString);
    g_free(targetString);

    gchar* urlString = JSStringCopyUTF8CString(m_url.get());
    WebKitNetworkRequest* request = webkit_network_request_new(urlString);
    g_free(urlString);
    webkit_web_frame_load_request(targetFrame, request);
    g_object_unref(request);

    return true;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:19,代码来源:WorkQueueItemGtk.cpp

示例12: urlCString

JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
{
    GOwnPtr<char> urlCString(JSStringCopyUTF8CString(url));
    if (!g_str_has_prefix(urlCString.get(), "file:///tmp/LayoutTests/"))
        return JSStringRetain(url);

    const char* layoutTestsSuffix = urlCString.get() + strlen("file:///tmp/");
    GOwnPtr<char> testPath(g_build_filename(getTopLevelPath().data(), layoutTestsSuffix, NULL));
    GOwnPtr<char> testURI(g_filename_to_uri(testPath.get(), 0, 0));
    return JSStringCreateWithUTF8CString(testURI.get());
}
开发者ID:Spencerx,项目名称:webkit,代码行数:11,代码来源:LayoutTestControllerGtk.cpp

示例13: writingDirection

void TestRunner::setTextDirection(JSStringRef direction)
{
    GUniquePtr<gchar> writingDirection(JSStringCopyUTF8CString(direction));

    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
    ASSERT(view);

    if (g_str_equal(writingDirection.get(), "auto"))
        gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_NONE);
    else if (g_str_equal(writingDirection.get(), "ltr"))
        gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_LTR);
    else if (g_str_equal(writingDirection.get(), "rtl"))
        gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_RTL);
    else
        fprintf(stderr, "TestRunner::setTextDirection called with unknown direction: '%s'.\n", writingDirection.get());
}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:16,代码来源:TestRunnerGtk.cpp

示例14: relativeURL

void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
{
    GUniquePtr<gchar> relativeURL(JSStringCopyUTF8CString(url));
    SoupURI* baseURI = soup_uri_new(webkit_web_frame_get_uri(mainFrame));
    SoupURI* absoluteURI = soup_uri_new_with_base(baseURI, relativeURL.get());
    soup_uri_free(baseURI);

    if (!absoluteURI) {
        WorkQueue::shared()->queue(new LoadItem(url, target));
        return;
    }

    CString absoluteURIString = soupURIToStringPreservingPassword(absoluteURI);
    JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absoluteURIString.data()));
    WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target));
    soup_uri_free(absoluteURI);
}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:17,代码来源:TestRunnerGtk.cpp

示例15: setPermissionsForMainApplication

static JSValueRef setPermissionsForMainApplication(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
#if ENABLE(DAE_APPLICATION)
    if (argumentCount < 1)
        return JSValueMakeUndefined(context);

    JSRetainPtr<JSStringRef> permissions(Adopt, JSValueToStringCopy(context, arguments[0], exception));
    //ASSERT(!*exception);

#if ENABLE(DAE_PERMISSION)
    // Clear permissions.
    SharedPtr<WebApplication> webApp = webAppMgr().application(getWebView());
    if (webApp) {
        webApp->setPermissions(0);
        webApp->setPermissions(JSStringCopyUTF8CString(permissions.get()));
    }
#endif
#endif

    return JSValueMakeUndefined(context);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:21,代码来源:ApplicationTestController.cpp


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