WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
161591
[Gtk] can not show json data (local file restrictions?)
https://bugs.webkit.org/show_bug.cgi?id=161591
Summary
[Gtk] can not show json data (local file restrictions?)
hqwu
Reported
2016-09-04 21:51:05 PDT
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.
Attachments
jquery-easyui-1.5 packet
(975.26 KB, application/x-zip-compressed)
2016-09-04 21:51 PDT
,
hqwu
no flags
Details
printscreen for chrome
(36.28 KB, image/png)
2016-09-04 21:55 PDT
,
hqwu
no flags
Details
printscreen for firefox
(69.44 KB, image/png)
2016-09-04 21:56 PDT
,
hqwu
no flags
Details
printscreen for my app based on webkit2
(21.97 KB, image/png)
2016-09-05 00:57 PDT
,
hqwu
no flags
Details
test result under windows 10 by different browser
(349.50 KB, application/msword)
2016-09-06 23:41 PDT
,
hqwu
no flags
Details
my test source code
(1.78 KB, text/x-csrc)
2016-09-07 01:17 PDT
,
hqwu
no flags
Details
my app based on webkit1 or webkit2gtk
(1.85 KB, text/x-csrc)
2016-09-07 17:40 PDT
,
hqwu
no flags
Details
my webkit2 app printscreen
(23.64 KB, image/png)
2016-09-07 17:57 PDT
,
hqwu
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
hqwu
Comment 1
2016-09-04 21:55:52 PDT
Created
attachment 287926
[details]
printscreen for chrome
hqwu
Comment 2
2016-09-04 21:56:30 PDT
Created
attachment 287927
[details]
printscreen for firefox
hqwu
Comment 3
2016-09-05 00:57:09 PDT
Created
attachment 287939
[details]
printscreen for my app based on webkit2
hqwu
Comment 4
2016-09-06 17:50:55 PDT
my os: ubuntu-16.04 x64
Alexey Proskuryakov
Comment 5
2016-09-06 22:21:59 PDT
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?
hqwu
Comment 6
2016-09-06 23:41:55 PDT
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.
hqwu
Comment 7
2016-09-06 23:42:46 PDT
(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.
Alexey Proskuryakov
Comment 8
2016-09-06 23:50:01 PDT
> 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.
hqwu
Comment 9
2016-09-07 00:25:34 PDT
(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.
hqwu
Comment 10
2016-09-07 00:46:49 PDT
i use my own app base on libwebkit2gtk-3.0-25,the json data can not been shown correctly also.
hqwu
Comment 11
2016-09-07 00:50:12 PDT
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; }
hqwu
Comment 12
2016-09-07 01:17:42 PDT
Created
attachment 288118
[details]
my test source code
hqwu
Comment 13
2016-09-07 02:01:44 PDT
it is not "local file restrictions" problem,because when i visit apache web server,the result is as the same.
hqwu
Comment 14
2016-09-07 02:08:57 PDT
it is not "local file restrictions" problem,because when i visit apache web server,the result is as the same.
Michael Catanzaro
Comment 15
2016-09-07 05:50:46 PDT
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.
Michael Catanzaro
Comment 16
2016-09-07 05:54:45 PDT
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.
hqwu
Comment 17
2016-09-07 17:40:10 PDT
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.
hqwu
Comment 18
2016-09-07 17:43:44 PDT
(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.
Michael Catanzaro
Comment 19
2016-09-07 17:49:20 PDT
(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.
hqwu
Comment 20
2016-09-07 17:55:43 PDT
(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'
hqwu
Comment 21
2016-09-07 17:57:37 PDT
Created
attachment 288214
[details]
my webkit2 app printscreen
hqwu
Comment 22
2016-09-07 17:58:26 PDT
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'
hqwu
Comment 23
2016-09-08 22:49:43 PDT
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.
Michael Catanzaro
Comment 24
2016-09-09 04:59:02 PDT
(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
hqwu
Comment 25
2016-09-18 19:54:34 PDT
(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?
hqwu
Comment 26
2016-09-18 19:55:47 PDT
(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?
hqwu
Comment 27
2016-09-18 19:59:08 PDT
(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
Michael Catanzaro
Comment 28
2016-09-18 20:39:00 PDT
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.
hqwu
Comment 29
2016-09-18 21:00:21 PDT
(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
"
hqwu
Comment 30
2016-09-18 23:23:21 PDT
(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"
Michael Catanzaro
Comment 31
2016-09-19 06:36:48 PDT
(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.
Michael Catanzaro
Comment 32
2016-09-19 06:37:54 PDT
(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?
hqwu
Comment 33
2016-09-19 17:42:37 PDT
(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.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug