本文整理汇总了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;
}
示例2: g_free
void LayoutTestController::setUserStyleSheetLocation(JSStringRef path)
{
g_free(userStyleSheet);
userStyleSheet = JSStringCopyUTF8CString(path);
if (userStyleSheetEnabled)
setUserStyleSheetEnabled(true);
}
示例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.
}
示例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);
}
示例5: JSStringCopyUTF8CString
bool ScriptItem::invoke() const
{
char* scriptString = JSStringCopyUTF8CString(m_script.get());
getWebView()->executeScript(scriptString);
free(scriptString);
return true;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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());
}
示例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;
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}