Opened 13 years ago
Closed 13 years ago
#6751 closed bug (invalid)
empty url on POST request ends up in Failure (SSL/Firefox)
Reported by: | Zergling | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.3 | |
Component: | ajax | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I get an error when sending a post request with an empty URL (with SSL on Firefox):
uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: https://***/js/jquery/jquery.js?r=9e217540984a2c8f6fff14f145f0c526 :: anonymous :: line 5113" data: no] Line 0
Line 5113 is:
Open the socket Passing null username, generates a login popup on Opera (#2865) if ( s.username ) {
xhr.open(type, s.url, s.async, s.username, s.password);
} else {
xhr.open(type, s.url, s.async); 5113
}
type = "POST" s.url = "" s.async = true
This should probably throw an exception or use location.href?
Trigger:
<form action="" onsubmit="return myFunc(this)">
myFunc(form) {
var params = $(form).serialize(); $.post(form.action, params, function(response) {
LAD.modal.respond(response, form);
});
}
Isn't this a garbage-in, garbage-out situation? The url should not be empty. jQuery doesn't check every argument for validity, it just isn't practical. And Firefox did throw an exception so you know to fix it.