<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [Gtk] can not show json data (local file restrictions?)"
href="https://bugs.webkit.org/show_bug.cgi?id=161591#c11">Comment # 11</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [Gtk] can not show json data (local file restrictions?)"
href="https://bugs.webkit.org/show_bug.cgi?id=161591">bug 161591</a>
from <span class="vcard"><a class="email" href="mailto:hqwu@fiberhome.com" title="hqwu <hqwu@fiberhome.com>"> <span class="fn">hqwu</span></a>
</span></b>
<pre>my source code as below:
#include <stdlib.h>
#include <stdio.h>
#include <webkit2/webkit2.h>
#include <gtk/gtk.h>
static void load_finished(WebKitWebView *view, gpointer data)
{
printf("called_load_fininshed\n");
printf("get_url:%s\n", webkit_web_view_get_uri(view) );
printf("get_tiele:%s\n", webkit_web_view_get_title(view) );
}
int main(int argc, char **argv)
{
for(int i=1; i<argc; i++)
{
printf("input_pm[%d]:%s\n", i, argv[i]);
}
if( setenv ("DISPLAY", ":0", 0) != 0 )
{
printf("set display:1 failed\n");
return -1;
}
printf("check thread_support\n");
if (!g_thread_supported ())
g_thread_init (NULL);
printf("init gtk\n");
gtk_init (&argc, &argv);
/*
WebKitWebFrame *web_frame = NULL;
*/
GtkWidget *web_view = NULL;
GtkWidget *window = NULL;
GtkWidget *scrolled = NULL;
printf("create a top window\n");
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
printf("set window size\n");
gtk_window_set_default_size (GTK_WINDOW (window), 1024, 768);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
printf("create a webview\n");
web_view = webkit_web_view_new ();
printf("add webview to window\n");
gtk_container_add (GTK_CONTAINER (scrolled), web_view);
gtk_container_add (GTK_CONTAINER (window), scrolled);
printf("show window\n");
gtk_widget_show_all (window);
printf("set call back of webpage loaded\n");
g_signal_connect(web_view, "load-finished", G_CALLBACK(load_finished), NULL);
printf("load a web page\n");
webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), "<a href="http://127.0.0.1/testjson">http://127.0.0.1/testjson</a>");
printf("gtk_main\n");
gtk_main();
return 0;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>