[webkit-dev] Passing null or undefined object as input url for XMLHttpRequest open()
Alexey Proskuryakov
ap at webkit.org
Tue Sep 4 08:32:41 PDT 2012
04.09.2012, в 07:43, Pozdnyakov, Mikhail написал(а):
> req = new XMLHttpRequest();
> req.open(“GET”, null);
>
> the implementation of XMLHttpRequest will try to open URL:
> “<base URL>/null“. The similar behaviour is with an undefined object given
> as input url (will try to open “<base URL>/undefined“).
>
> It does not seem to be correct behaviour and I would raise SYNTAX_ERR exception
> in such cases, but I would like to hear other opinions on that before creating bug and uploading patch.
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120904/2a7fccf0/attachment.html>
More information about the webkit-dev
mailing list