[Webkit-unassigned] [Bug 31875] New: QWebView: Impossible to make XMLHttpRequest from locally stored HTML page

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 25 07:56:28 PST 2009


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

           Summary: QWebView: Impossible to make XMLHttpRequest from
                    locally stored HTML page
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: Major
          Priority: P2
         Component: WebKit Qt
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: juhana.koski at gmail.com


Created an attachment (id=43848)
 --> (https://bugs.webkit.org/attachment.cgi?id=43848)
demonstrates the problem

XMLHttpRequests from locally stored HTML file always fails in QWebView.
Security restrictions are understandable when running JavaScript code inside
QWebView component. But I think it should be possible somehow for developer to
allow/whitelist some URLS where XMLHttpRequest can be established. This was
possible in Qt 4.6.0 beta using WebSecurityOrigin::whiteListAccessFromOrigin()
function but this function is removed from 4.6.0 Release candidate 1. Can
similar functionality be restored to next Qt 4.6 release?

Following example shows the problem. 
QWebView is created in following way: 

---
QWebView view;
view.load(QUrl("qrc:/script/index.html"));
view.show();
---

index.html has following script inside body tags:
---
<script type="text/javascript">
var xmlhttp=new XMLHttpRequest()
try
{
xmlhttp.open('get',
'http://api.flickr.com/services/rest/?method=flickr.test.echo&api_key=bd9cc5d539f02a3833dcde44ddfe9d5b')
xmlhttp.onreadystatechange = httpCallBack;
xmlhttp.send(null);
}
catch (e)
{
alert("An exception occurred in the script. Error name: " + e.name + ". Error
message: " + e.message); 
}
function httpCallBack()
{
 if (xmlhttp.readyState == 4) 
 {
 alert("state 4" + xmlhttp.responseText);
 }
 else
 {
 alert("state " + xmlhttp.readyState)
 }
}
</script>
---

onreadystatechange/httpCallBack gets called with readyState 4. But responseText
is empty and no actual HTTP request goes out. 
Qt version: 4.6.0 Release candidate 1

Reference discussion:
http://discussion.forum.nokia.com/forum/showthread.php?t=186338

(full example attached)

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list