[Webkit-unassigned] [Bug 161591] [Gtk] can not show json data (local file restrictions?)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 7 00:50:12 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=161591

--- Comment #11 from hqwu <hqwu at fiberhome.com> ---
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), "http://127.0.0.1/testjson");

   printf("gtk_main\n");
   gtk_main();


   return 0;

}

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160907/f99e6fc7/attachment-0001.html>


More information about the webkit-unassigned mailing list