RESOLVED FIXED 46008
XMLHttpRequest: open() does not throw a SYNTAX_ERR exception if method is empty or url cannot be resolved
https://bugs.webkit.org/show_bug.cgi?id=46008
Summary XMLHttpRequest: open() does not throw a SYNTAX_ERR exception if method is emp...
Jian Li
Reported 2010-09-17 15:46:31 PDT
open() does not throw a SYNTAX_ERR exception if method is empty. It does throw if method contains invalid string. The XHR spec says: open(method, url, async, user, password) Sets the request method, request URL, asynchronous flag, request username, and request password. Throws a SYNTAX_ERR exception if one of the following is true: method is not a valid HTTP method. TEST: http://tc.labs.opera.com/apis/XMLHttpRequest/open-method-bogus.htm
Attachments
This patch checks if a url is invalid and throw syntax error if that's the case (830 bytes, patch)
2011-12-08 03:47 PST, Deqing Huang
ap: review-
Patch (4.53 KB, patch)
2018-09-07 12:32 PDT, Rob Buis
no flags
Jian Li
Comment 1 2010-09-17 17:05:39 PDT
Per the XHR spec, we should also throw a SYNTAX_ERR exception if url cannot be resolved. http://tc.labs.opera.com/apis/XMLHttpRequest/open-url-bogus.htm
Deqing Huang
Comment 2 2011-12-08 03:47:18 PST
Created attachment 118359 [details] This patch checks if a url is invalid and throw syntax error if that's the case
Alexey Proskuryakov
Comment 3 2011-12-08 08:44:23 PST
Comment on attachment 118359 [details] This patch checks if a url is invalid and throw syntax error if that's the case A fix like this needs to come with regression tests. A good place to add one is fast/xmlhttprequest.
Rob Buis
Comment 4 2018-09-07 12:32:36 PDT
Frédéric Wang (:fredw)
Comment 5 2018-09-07 12:40:25 PDT
*** Bug 189426 has been marked as a duplicate of this bug. ***
Chris Dumez
Comment 6 2018-09-07 14:18:12 PDT
Comment on attachment 349179 [details] Patch r=me
WebKit Commit Bot
Comment 7 2018-09-07 14:43:42 PDT
Comment on attachment 349179 [details] Patch Clearing flags on attachment: 349179 Committed r235808: <https://trac.webkit.org/changeset/235808>
WebKit Commit Bot
Comment 8 2018-09-07 14:43:44 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2018-09-07 14:44:25 PDT
Alicia Boya García
Comment 10 2018-09-12 16:14:31 PDT
This patch has regressed the following test in all platforms: imported/w3c/web-platform-tests/url/failure.html https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#tests=imported%2Fw3c%2Fweb-platform-tests%2Furl%2Ffailure.html&revision=235825 e.g: FAIL XHR: http://user@/www.example.com should throw assert_throws: function "() => client.open("GET", test.input)" did not throw
Chris Dumez
Comment 11 2018-09-12 16:17:35 PDT
New passes. The test merely needs rebaselining.
Chris Dumez
Comment 12 2018-09-12 16:20:17 PDT
(In reply to Chris Dumez from comment #11) > New passes. The test merely needs rebaselining. Done in <https://trac.webkit.org/changeset/235958>.
Note You need to log in before you can comment on or make changes to this bug.