On 3/19/2011 3:21 AM, Benjamin wrote:
On Sat, Mar 19, 2011 at 10:56 AM, Joe Andrieu <[email protected]> wrote:
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.

With a valid scheme, XMLHttpRequest, cross origin or not, can be made to work without changing WebKit.

But if your scheme is non standard that does not gonna for the reason you describe. My suggestion is just to use a standard scheme to avoid patching WebKit.  It is no uncommon to use a valid scheme internally, and display something else in the interface. Rekonq new-tab-page branch uses rekonq:// internally, and "about:" for display. Chromium uses chrome:// for its internally as well (for example, about:version is chrome://about/version).

cheers,
Benjamin
Unfortunately, if I try to make it a standard scheme, there are a number of problems (mostly from Chromium rather than WebKit).

1. CanonicalizeURL behaves badly because there is no "host" in my scheme. If I use a null host, e.g., myscheme:///mypath, it gets turned into myscheme://mypath/ and "mypath" is set as the host.

2. The part of the URL that would make semantic sense as an "authority-part" does not conform to the requirements for a DNS host name, which means CanonicalizeURL fails completely and throws an error.  It is conformant to the scheme-specific part of a URL, so it should be legal for use wherever a URL is.

3. If I use a "fake" host, then it fails the cross-origin check because I am trying to use AJAX from a file:// html page. And it would break the semantics of my scheme to load the html with the custom scheme as the scheme points to an RDF datastore and has no access to local files, which is where my html lives.

It seems a bit unreasonable to expect that custom schemes are "standard". Where would data: and _javascript_: and rdar: fit in if that were the case? Given that, why not figure out the right way to allow XHR to use custom schemes? 

I realize that some of these problems are specific to Chromium's KURL implementation. And as such, isn't really a WebKit problem as much as a WebKit/Chromium integration problem with some specific WebKit limitations. Unfortunately, that makes fixing this in a re-usable way a bit harder than I had hoped.

-j

Joe Andrieu
[email protected]
+1 (805) 705-8651



_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to