On 3/19/2011 2:28 AM, Benjamin wrote:
On Sat, Mar 19, 2011 at 6:46 AM, Joe Andrieu <joe@andrieu.net> wrote:
I've been working with the Chromium Embedded Framework (in windows) which gives webkit version 534.20. I am trying to get a custom scheme to work with XHR. 

By way of background, I first updated the Cef code so that custom schemes can be declared "non-standard", which avoids certain parsing errors. Non-standard schemes include "data", "javascript", "file". Webkit has a mechanism for registering standard schemes, so all I needed to do was /not/ register custom schemes that were non-standard.

Just curious of your use case, do you really need non-standard scheme?

Wouldn't it be easier to just define a custom scheme? I see people do that all the time with QtWebKit for hybrid apps.

Well, I am defining a custom scheme. But its semantics are not hierarchical and do not have the typical authority-part that allows cross-origin checks to make sense. Because of that, WebKit's CanonicalizeURL fails if my scheme is registered as standard. Which makes sense, because it isn't standard.

I'm not familiar with QtWebKit's integration. From the first couple of web pages Google brought up, it isn't clear that their protocols will actually work with AJAX / XMLHttpRequest. There are no examples of doing it, and from walking through the WebKit code, I'm skeptical a stock version of WebKit would allow it.

In fact, this post from last July suggests it wouldn't work:
http://www.qtcentre.org/threads/30060-QtWebkit-problems-with-custom-QNetworkAccessManager-QNetworkReply
FWIW, I think this is a similar, but not quite the same problem. They aren't using AJAX for one.  That bug may be because the origin for pages with a custom scheme URL is undefined.  I happen to be using a file:// URL for my html page, so it has a clear origin.  It's just failing on the way home.  It /may/ be that the solution I'm suggesting would also fix that other bug, but that's only if the culprit is the cross-origin check at the end.

-j

Joe Andrieu
joe@andrieu.net
+1 (805) 705-8651