Summary: | [Gtk] can not show json data (local file restrictions?) | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | hqwu <hqwu> | ||||||||||||||||||
Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> | ||||||||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||||||||
Severity: | Normal | CC: | bugs-noreply, hqwu, mcatanzaro | ||||||||||||||||||
Priority: | P2 | ||||||||||||||||||||
Version: | WebKit Nightly Build | ||||||||||||||||||||
Hardware: | PC | ||||||||||||||||||||
OS: | Linux | ||||||||||||||||||||
Attachments: |
|
Created attachment 287926 [details]
printscreen for chrome
Created attachment 287927 [details]
printscreen for firefox
Created attachment 287939 [details]
printscreen for my app based on webkit2
my os: ubuntu-16.04 x64 This test loads successfully for me in Safari 9.1.3. I think that you may be running into intentional local file access restrictions. Which port of WebKit are you using? Created attachment 288108 [details]
test result under windows 10 by different browser
i have tested it under windows-10-x64,but the result as the same as under ubuntu-16.04-x64.
so i think maybe wetkit2 has someone bug,because Google-Chrome is base on webkit2.
please see attachment.
and i have test my app base on webkitgtk-2.13.90 under ubunter,it can not show correctly.
IE、FireFox browser: all is OK
Google chrome browser: can not show json data.
(In reply to comment #5) > This test loads successfully for me in Safari 9.1.3. > > I think that you may be running into intentional local file access > restrictions. Which port of WebKit are you using? Hi, thank you at first. but i do not think so . i have tested it under windows-10-x64,but the result as the same as under ubuntu-16.04-x64. so i think maybe wetkit2 has someone bug,because Google-Chrome is base on webkit2. please see attachment. and i have test my app base on webkitgtk-2.13.90 under ubunter,it can not show correctly. > so i think maybe wetkit2 has someone bug,because Google-Chrome is base on webkit2.
To clarify, Chrome is not based on WebKit2. They do use a fork of WebKit code, but not WebKit2.
I updated the bug's component for Gtk folks to take a look.
(In reply to comment #8) > > so i think maybe wetkit2 has someone bug,because Google-Chrome is base on webkit2. > > To clarify, Chrome is not based on WebKit2. They do use a fork of WebKit > code, but not WebKit2. > > I updated the bug's component for Gtk folks to take a look. thanks. i descript our enviroment by detail: our web server is apache. it provide home page which contain json data. when i use firfox to visit the web server, all is ok. but if I use midori or google-chrome,the json data can not be shown correct. i use my app base on webkitgtk-2.13.90,the result as the same as midori or google-chrome. In order to facilitate your testing, I have provided the local file to you, but the result is the same. i use my own app base on libwebkit2gtk-3.0-25,the json data can not been shown correctly also. 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; } Created attachment 288118 [details]
my test source code
it is not "local file restrictions" problem,because when i visit apache web server,the result is as the same. it is not "local file restrictions" problem,because when i visit apache web server,the result is as the same. This is a bug in Google Chrome, which does not use WebKit anymore and has never used WebKitGTK+. You want to report this on bugs.chromium.org. OK sorry, I see you are using WebKitGTK+. To clarify: Chrome really does not use WebKitGTK+ nor WebKit2. It has its own fork of WebCore (not WebKit2) from three years ago. Created attachment 288213 [details]
my app based on webkit1 or webkit2gtk
Maybe I don't have a clear expression, so it leads to misunderstanding. Well, we do not talk about the chrome, no longer concerned about the chrome, because I am concerned about the webkit1.0 and webkitgtk2. I use webkit1.0 or webkitgtk2 to access a web page containing JSON, the singular can not be displayed. The same site, I use Firefox but can normally show, do not know what is the reason, who can help me?
Attached is my source code, using the following command line, you can get two webkitgtk2 based on webkit1.0 and the implementation of the program, but the display is not normal.
gcc webtest.c -o webtest1.0 `pkg-config --cflags --libs gtk+-2.0` `pkg-config --cflags --libs webkit-1.0` -DUSEWEBKIT_1_0
gcc webtest.c -o webtest2.0 `pkg-config --cflags --libs gtk+-3.0` `pkg-config --cflags --libs webkit2gtk-3.0`
Emphasize : we only talk about WebKit and webkit2gtk.
(In reply to comment #15) > This is a bug in Google Chrome, which does not use WebKit anymore and has > never used WebKitGTK+. You want to report this on bugs.chromium.org. Emphasize: we only talk about WebKit and webkit2gtk. I just want to take google-chrome contrast, I did not expect to get things done instead. (In reply to comment #17) > gcc webtest.c -o webtest2.0 `pkg-config --cflags --libs gtk+-3.0` > `pkg-config --cflags --libs webkit2gtk-3.0` Is it still broken if you use webkit2gtk-4.0? The older APIs are from old WebKitGTK+ 2.4, which is insecure and no longer supported. (In reply to comment #19) > (In reply to comment #17) > > gcc webtest.c -o webtest2.0 `pkg-config --cflags --libs gtk+-3.0` > > `pkg-config --cflags --libs webkit2gtk-3.0` > > Is it still broken if you use webkit2gtk-4.0? The older APIs are from old > WebKitGTK+ 2.4, which is insecure and no longer supported. Thank you for your feedback. I installed the system is webkit2gtk-3.0, because it does not normally display JSON data, so I used the webkit2gtk-3.0 for comparison, the results are still the same. At present, I used the webkit1.0, webkit2gtk-3.0 and webkit2gtk-4.0, are unable to display the normal JSON data. Can you help me to modify the source code in accordance with webkit2gtk-3.0? He will display the following message: (webtest2.0:6752): GLib-GObject-WARNING * *: signal'load-finished'is invalid for /build/glib2.0-7IO_Yw/glib2.0-2.48.1/./gobject/gsignal.c:2517: instance'0x1d89bc0' of type'WebKitWebView' Created attachment 288214 [details]
my webkit2 app printscreen
Thank you for your feedback. I installed the system is webkit2gtk-3.0, because it does not normally display JSON data, so I used the webkit2gtk-4.0 for comparison, the results are still the same. At present, I used the webkit1.0, webkit2gtk-3.0 and webkit2gtk-4.0, are unable to display the normal JSON data. Can you help me to modify the source code in accordance with webkit2gtk-3.0? He will display the following message: (webtest2.0:6752): GLib-GObject-WARNING * *: signal'load-finished'is invalid for /build/glib2.0-7IO_Yw/glib2.0-2.48.1/./gobject/gsignal.c:2517: instance'0x1d89bc0' of type'WebKitWebView' Is there anyone here to solve this problem? Who can tell me the progress of the problem? Thank you!!! The question is as follows: when I use my webkit app to browse attachment "demo/treegrid/checkbox.html",json data can not be shown. but when I use Mozilla firefox to browser it,all is ok. (In reply to comment #23) > Is there anyone here to solve this problem? Who can tell me the progress of > the problem? Thank you!!! I doubt anyone will debug it for you, especially when the behavior is the same as in Chrome and there's two minified JS files, sorry. But if you wind up needing to patch WebKit, we'll certainly review it for upstream inclusion. (In reply to comment #22) > (webtest2.0:6752): GLib-GObject-WARNING * *: signal'load-finished'is invalid > for /build/glib2.0-7IO_Yw/glib2.0-2.48.1/./gobject/gsignal.c:2517: > instance'0x1d89bc0' of type'WebKitWebView' The signal is 'load-changed' in WebKit2, there's documentation at https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#WebKitWebView-load-changed (In reply to comment #24) > (In reply to comment #23) > > Is there anyone here to solve this problem? Who can tell me the progress of > > the problem? Thank you!!! > > I doubt anyone will debug it for you, especially when the behavior is the > same as in Chrome and there's two minified JS files, sorry. But if you wind > up needing to patch WebKit, we'll certainly review it for upstream inclusion. > > (In reply to comment #22) > > (webtest2.0:6752): GLib-GObject-WARNING * *: signal'load-finished'is invalid > > for /build/glib2.0-7IO_Yw/glib2.0-2.48.1/./gobject/gsignal.c:2517: > > instance'0x1d89bc0' of type'WebKitWebView' > > The signal is 'load-changed' in WebKit2, there's documentation at > https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView. > html#WebKitWebView-load-changed thank your helps! I have done experiments and found that this is not a bug, but because file restrictions local or domain estrictions cross restrictions. but I do not know how to cancel these webkit restrictions? (In reply to comment #25) > (In reply to comment #24) > > (In reply to comment #23) > > > Is there anyone here to solve this problem? Who can tell me the progress of > > > the problem? Thank you!!! > > > > I doubt anyone will debug it for you, especially when the behavior is the > > same as in Chrome and there's two minified JS files, sorry. But if you wind > > up needing to patch WebKit, we'll certainly review it for upstream inclusion. > > > > (In reply to comment #22) > > > (webtest2.0:6752): GLib-GObject-WARNING * *: signal'load-finished'is invalid > > > for /build/glib2.0-7IO_Yw/glib2.0-2.48.1/./gobject/gsignal.c:2517: > > > instance'0x1d89bc0' of type'WebKitWebView' > > > > The signal is 'load-changed' in WebKit2, there's documentation at > > https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView. > > html#WebKitWebView-load-changed > > thank your helps! > I have done experiments and found that this is not a bug, but because file > restrictions local or domain estrictions cross restrictions. but I do not > know how to cancel these webkit restrictions? thank your helps! I have done experiments and found that this is not a bug, but because file restrictions local or domain estrictions cross restrictions. but I do not know how to cancel these webkit restrictions. Can you tell me how to do that? (In reply to comment #5) > This test loads successfully for me in Safari 9.1.3. > > I think that you may be running into intentional local file access > restrictions. Which port of WebKit are you using? Is indeed the access restrictions to the phenomenon, but how to cancel these restrictions? Can you help me? Thank you If you're using file URIs, you'll want to set the allow-file-access-from-file-urls setting: https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html#WebKitSettings--allow-file-access-from-file-urls There's also a new allow-universal-access-from-file-urls coming in this week's 2.14.0 release. If that doesn't work, I'm not sure. (In reply to comment #28) > If you're using file URIs, you'll want to set the > allow-file-access-from-file-urls setting: > https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings. > html#WebKitSettings--allow-file-access-from-file-urls > > There's also a new allow-universal-access-from-file-urls coming in this > week's 2.14.0 release. If that doesn't work, I'm not sure. thank you very much!!! when i use a normal webser like Apache,if i want to access cross origin resource,which founction can cancel the restrictions? for example,my URL is "http://127.0.0.1/test/test.html",on this web page ,i want to get json from "http://127.0.0.1/json/testjson.json" (In reply to comment #28) > If you're using file URIs, you'll want to set the > allow-file-access-from-file-urls setting: > https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings. > html#WebKitSettings--allow-file-access-from-file-urls > > There's also a new allow-universal-access-from-file-urls coming in this > week's 2.14.0 release. If that doesn't work, I'm not sure. my webkit release is 2.4.10,it has not webkit_settings_set_allow_file_access_from_file_urls function,compile result is "error: ‘webkit_settings_set_allow_file_access_from_file_urls’ was not declared in this scope" (In reply to comment #29) > thank you very much!!! > when i use a normal webser like Apache,if i want to access cross origin > resource,which founction can cancel the restrictions? > > for example,my URL is "http://127.0.0.1/test/test.html",on this web page ,i > want to get json from "http://127.0.0.1/json/testjson.json" Oh for that you don't need to mess with WebKit APIs at all, you can do it using CORS. I'm not an expert; you can check out http://enable-cors.org/ for an explanation. > my webkit release is 2.4.10,it has not > webkit_settings_set_allow_file_access_from_file_urls function,compile result > is "error: ‘webkit_settings_set_allow_file_access_from_file_urls’ was not > declared in this scope" You probably want to upgrade to a modern version of WebKit, since 2.4.10 is old/insecure/unsupported. (In reply to comment #31) > Oh for that you don't need to mess with WebKit APIs at all, you can do it > using CORS. I'm not an expert; you can check out http://enable-cors.org/ for > an explanation. Er, sorry, those are actually completely the same origin: http://127.0.0.1/. There are not any restrictions on loading content from different paths with the same origin. Why would there be? (In reply to comment #31) > (In reply to comment #29) > > thank you very much!!! > > when i use a normal webser like Apache,if i want to access cross origin > > resource,which founction can cancel the restrictions? > > > > for example,my URL is "http://127.0.0.1/test/test.html",on this web page ,i > > want to get json from "http://127.0.0.1/json/testjson.json" > > Oh for that you don't need to mess with WebKit APIs at all, you can do it > using CORS. I'm not an expert; you can check out http://enable-cors.org/ for > an explanation. > > > my webkit release is 2.4.10,it has not > > webkit_settings_set_allow_file_access_from_file_urls function,compile result > > is "error: ‘webkit_settings_set_allow_file_access_from_file_urls’ was not > > declared in this scope" > > You probably want to upgrade to a modern version of WebKit, since 2.4.10 is > old/insecure/unsupported. thank you. I will upgrade to webkit2.12.5 today,and then test it. |
Created attachment 287925 [details] jquery-easyui-1.5 packet when I use chrome-brower to browse attachment "demo/treegrid/checkbox.html",json data can not be shown. but when I use Mozilla firefox to browser it,all is ok.