[webkit-dev] Passing null or undefined object as input url for XMLHttpRequest open()

Pozdnyakov, Mikhail mikhail.pozdnyakov at intel.com
Wed Sep 5 06:41:36 PDT 2012

This is an unlikely situation to occur in real web pages, so there is neither much risk nor much benefit to this change. One way this could break a page is if it calculates a URL and erroneously ends up with a null. In this case, raising an exception would further break page logic - instead of getting error and loaded events, it will likely be stuck waiting for these forever.

Could you elaborate on why this seems incorrect to you? Generally speaking, special casing just null and undefined to bypass toString conversion would be unusual and surprising.

- WBR, Alexey Proskuryakov

OK I agree that exception could break logic further but I believe we could at least use just <base URL> instead of "<base URL> /null"
in such cases.
'null' or 'undefined' by the way can be name of a resource on server and xhr will address to this resource whenever
it is given with a null object.

To test the behaviour on different browsers I put 'null' file to /var/www and watched whether it is opened by xhr given with null object.
Chromium, Firefox and Opera turned to the 'null' file and IE raised an exception  on xhr 'open()' method.

Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120905/5d8059b1/attachment.html>

More information about the webkit-dev mailing list