WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
66205
[Qt] REGRESSION: error in synchronous ajax call
https://bugs.webkit.org/show_bug.cgi?id=66205
Summary
[Qt] REGRESSION: error in synchronous ajax call
Sylvain Pointeau
Reported
2011-08-14 03:42:36 PDT
I made a custom network manager that returns a certain json content. however the received json from the javascript side is with double quote encoded like " it is then making the query ajax call to fail. I have added a reduced test case to demonstrate the issue. It was working fine with Qt 4.7, but then I migrated to MacOS X lion and I switched to Qt4.8 beta. I don't know the exact webkit version used by Qt4.8 beta.
Attachments
a reduced test case to demonstrate the issue
(45.10 KB, application/zip)
2011-08-14 03:49 PDT
,
Sylvain Pointeau
no flags
Details
testcase (fixed)
(37.35 KB, application/x-gzip)
2011-08-15 10:29 PDT
,
Ademar Reis
no flags
Details
original testcase cleaned up and using QUrl::fromLocalFile()
(34.79 KB, application/x-gzip)
2011-08-17 13:55 PDT
,
Ademar Reis
no flags
Details
original testcase cleaned up (mostly coding style)
(37.26 KB, application/x-gzip)
2011-08-23 09:20 PDT
,
Ademar Reis
no flags
Details
all above + the twitter search
(51.29 KB, application/zip)
2011-09-13 22:12 PDT
,
Sylvain Pointeau
no flags
Details
Twitter search using JSONP
(48.66 KB, application/zip)
2011-09-16 07:45 PDT
,
Sylvain Pointeau
no flags
Details
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Sylvain Pointeau
Comment 1
2011-08-14 03:49:04 PDT
Created
attachment 103878
[details]
a reduced test case to demonstrate the issue a reduced test case to demonstrate the issue, using Qt4.8 beta, a custom network manager that returns a json content is the url is ending by .json
Ademar Reis
Comment 2
2011-08-15 10:29:49 PDT
Created
attachment 103922
[details]
testcase (fixed)
Ademar Reis
Comment 3
2011-08-15 10:39:00 PDT
Using the attached testcase, I confirmed the problem exists in QtWebKit-2.2 but not in Qt-4.7 (QtWebKit-2.0). The problem also happens when using QtWebKit-2.2 with Qt-4.7, so the problem appears to be in QtWebKit and not in QNAM or other part of Qt. When testing against trunk, I get an assertion error: $ ./webkit_ajax_json_test_case root app "/home/ademar/tmp/bla/webkit_ajax_json_test_case" ASSERT: "d->recursive" in file thread/qmutex_linux.cpp, line 112 Aborted (core dumped)
Ademar Reis
Comment 4
2011-08-17 08:44:47 PDT
Just FYI, while investigating this, I found a regression in QNAMs code:
https://bugreports.qt.nokia.com/browse/QTBUG-20970
But it appears to be unrelated to this bug. Will keep investigating.
Ademar Reis
Comment 5
2011-08-17 11:45:33 PDT
(In reply to
comment #3
)
> When testing against trunk, I get an assertion error: > > $ ./webkit_ajax_json_test_case > root app "/home/ademar/tmp/bla/webkit_ajax_json_test_case" > ASSERT: "d->recursive" in file thread/qmutex_linux.cpp, line 112 > Aborted (core dumped)
Nevermind, this is because I was running against a QtWebKit built with Qt5. With Qt-4.8, trunk shows the same problem.
Ademar Reis
Comment 6
2011-08-17 13:54:18 PDT
The whole problem is in the QUrl creation in main.cpp. QUrls for local files have to use the static method QUrl::fromLocalFile(). For some bizarre reason, it used to work in Qt-4.7, but when combined with a recent QtWebKit, it breaks. Even worse, in Qt-4.8/QtWebKit-2.2 it has a completely unexpected behavior, which is to pass the PWD to QNAM::createRequest(). I think there are two potential improvements: 1. Improve QNAM to fail in a more expected way if the user tries to use a QUrl which is not complete or useful yet ("just a string"). 2. Improve QWebView::load() to fail if it receives an incomplete QUrl like that. Note that QUrls created this way are still valid (isValid() == true), but have no schema (schema() returns ""). BTW, if you use fromLocalFile() to create your URL, you'll be able to remove a lot of unecessary code from your example. I'll attach a clean version to this bug.
Ademar Reis
Comment 7
2011-08-17 13:55:28 PDT
Created
attachment 104232
[details]
original testcase cleaned up and using QUrl::fromLocalFile()
Sylvain Pointeau
Comment 8
2011-08-19 09:46:03 PDT
Hi, I proposed a test case based on my application. my application simulates a "web server" by calling the CGI behind. If it runs with local files, it will not work, and that's why I worked with a fake url "
http://localhost.xxx.com/
". I don't understand why it is failing in this case... please consider that I am obliged to fake the url for POST variables. would you have an alternative then?
Ademar Reis
Comment 9
2011-08-23 09:20:56 PDT
Created
attachment 104856
[details]
original testcase cleaned up (mostly coding style)
Sylvain Pointeau
Comment 10
2011-08-24 01:25:17 PDT
after drilling down in JQuery to see what happened, I discovered that: the async = true works and returns status=200 but async = false returns status = 0. so you can reproduce the bug with having this simpler code below, you will see the status = 0 but it will work because we are just testing the readystate. JQuery will fail because it tests the status. function search() { var xmlhttp= new XMLHttpRequest(); xmlhttp.open("GET", "test_json.json",false); // false for async = false xmlhttp.onreadystatechange=function() { alert( "readyState="+xmlhttp.readyState+" status="+xmlhttp.status); if (xmlhttp.readyState==4) { var myjson = JSON.parse( xmlhttp.responseText ); alert( myjson.message ); } } xmlhttp.send(null); return false; }
Ademar Reis
Comment 11
2011-08-26 07:39:01 PDT
Changing bug title to reflect the real issue (there's no relation with " at all, the problem is the call failure).
Ademar Reis
Comment 12
2011-08-26 08:05:20 PDT
Sylvain: the problem with your testcase is that it's not reduced enough. Instead of using a custom QNAM and a custom reply, why not query a live server to reproduce the problem? For example, trying your code with
http://search.twitter.com/search.json?q=twitter&result_type=mixed&count=5
, it works fine, as far as I could understand. We need a small testcase that shows the problem is in QtWebKit (to be tested with the QtTestBrowser or a very simple QWebView).
Sylvain Pointeau
Comment 13
2011-08-28 11:49:20 PDT
Hi, if it is working fine on a live server, it means that it is linked to the custom QNAM and custom Reply. I saw an answer on the mailing list pointing on the
bug 57228
https://bugs.webkit.org/show_bug.cgi?id=57228
would it be the root issue?
Sylvain Pointeau
Comment 14
2011-09-13 22:09:30 PDT
I tested the twitter URL (live server) and it doesn't work. (async = true or false) I thought it worked. would it be the cross domaine issue? the symptom are the same: ready state=4 and status=0 but no responseText
Sylvain Pointeau
Comment 15
2011-09-13 22:12:40 PDT
Created
attachment 107287
[details]
all above + the twitter search
Ademar Reis
Comment 16
2011-09-14 07:02:20 PDT
(In reply to
comment #15
)
> Created an attachment (id=107287) [details] > all above + the twitter search
I'm very busy right now, but just a couple of hints: the best way to get someone to work on it is to have a really minimal test-case showing the problem. Can we reproduce it on a live server, without your custom QNAM and QNetworkReply? Can we not use the jquery.js library? Remember that the patch won't land unless we add a layout test (where we can't use any of the above). A testcase that fits a bug comment would be perfect. :-)
Sylvain Pointeau
Comment 17
2011-09-16 07:45:12 PDT
Created
attachment 107650
[details]
Twitter search using JSONP using Jquery / JSONP to query twitter, it works.
Sylvain Pointeau
Comment 18
2011-09-16 07:51:19 PDT
I tested on a live application (apache + CGI) the ajax call with async = false is working. so the issue is from my opinion in the QNAM
Sylvain Pointeau
Comment 19
2011-10-16 15:07:27 PDT
tested on Qt 4.8 RC and it still doesn't work
Sylvain Pointeau
Comment 20
2012-12-03 06:41:37 PST
up ... I just tried 4.8.4 and it still has the issue. (...very annoying)
Allan Sandfeld Jensen
Comment 21
2013-01-19 13:47:13 PST
I have just tested and this bug appears to be solved. I can reproduce it with QtWebKit 2.2 (from Qt 4.8), but not with QtWebKit 2.3.
Jocelyn Turcotte
Comment 22
2014-02-03 03:18:36 PST
=== Bulk closing of Qt bugs === If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary. If you believe that this is still an important QtWebKit bug, please fill a new report at
https://bugreports.qt-project.org
and add a link to this issue. See
http://qt-project.org/wiki/ReportingBugsInQt
for additional guidelines.
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