Bug 114798 - Don't penalize synchronous XHR users for the 'file://' protocol
Summary: Don't penalize synchronous XHR users for the 'file://' protocol
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-18 03:14 PDT by Andy E
Modified: 2013-04-18 10:33 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy E 2013-04-18 03:14:39 PDT
I can understand the reasons for discouraging synchronous XHR over HTTP, but many rendering engines are now being used for client applications with file access privileges.  For instance, WebKit is a popular platform choice for Smart TV applications (used by at least Samsung and LG televisions from 2011 onwards).  Rather than implementing proprietary APIs for certain features, it's easier for these platforms to just reuse the web APIs to keep compatibility high.  So, rather than having a proprietary API for loading local files, XMLHttpRequest should be used with the 'file://' protocol.

With local file access, there's no real advantage of using an asynchronous request over a synchronous one.  Using a synchronous request keeps the code procedural, as well as shorter and easier to read.

https://bugs.webkit.org/show_bug.cgi?id=72154, for example, recommended disabling `responseType` for all synchronous requests which, in my opinion, is rather short-sighted.  I'm all for discouraging bad practices in use by web developers, but I'm surprised nobody had the foresight to see that XMLHttpRequest isn't just used for HTTP and WebKit isn't just used in web browsers.

I realise this is only a minor inconvenience (I'm sure I can cope with the extra 4 lines of code I have to write), but a simple check to see if the request is being made on the local file system doesn't seem like something that would be difficult to implement.
Comment 1 Alexey Proskuryakov 2013-04-18 10:33:25 PDT
I don't think that there is a bug here, WebKit already works the way you are asking for. The change in bug 72154 was limited to http/https resources.

Please re-open with more details if you are observing an issue in practice.