Re: document.load: History and a proposal

On Sat, Mar 27, 2010 at 2:03 PM, Maciej Stachowiak <mjs@apple.com> wrote:
>
> Thanks for sending this message - you've laid out the information very well.
>
> On Mar 26, 2010, at 5:47 PM, Adam Barth wrote:
>
>> == Use Case ==
>>
>> Some number of web sites use the following pattern to load XML:
>>
>>   xmlDoc = document.implementation.createDocument("", "", null);
>>   xmlDoc.load(url)
>>   xmlDoc.onload = function() {
>>       // xmlDoc now contains an XML DOM loaded from url
>>   }
>>
>> Relatedly, other web sites use a similar synchronous pattern:
>>
>>   xmlDoc = document.implementation.createDocument("", "", null);
>>   xmlDoc.async = false;
>>   xmlDoc.load(url);
>>   // xmlDoc now contains an XML DOM loaded from url
>
> I'm much more concerned about the synchronous version of this API. Is there
> a way to tell how many sites use specifically the synchronous pattern, and
> how many depend on the request being fulfilled synchronously? It's true that
> synchronous XHR already allows blocking network I/O, but it's a regrettable
> part of the platform and I'd rather not add more constructs along these
> lines.
>
> This also implies some additional variants on options 2 and 3:
>
> 2.a/3.a) Wherever load is offered, ignore the async attribute and make it
> always load asynchronously.
> 2.b/3.b) Wherever load is offered, if async is set to false, make the load
> always fail.
>
> I wonder what the compatibility impact of these kinds of options would be.

For what it's worth, the more of this function we can disable, the
happier I will be. I'm very surprised and intrigued to hear that
webkit does not implement this function yet. Could you see if any of
the bugs file on webkit in regards to this mention sites that use the
synchronous behavior?

If webkit implements this without adding support for the synchronous
behavior I'd be happy to attempt to remove the synchronous behavior
from firefox and see if anyone complain.

I'd be also be happy to put a warning in the firefox error console any
time a page used this function (and recommend them to use
XMLHttpRequest instead).

/ Jonas

Received on Tuesday, 30 March 2010 05:04:57 UTC