Closed
Bug 740865
Opened 12 years ago
Closed 11 years ago
nsIXMLHttpRequest.send() should not throw when trying to send to a nonexistent file:// URI
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: alta88, Unassigned)
References
Details
(Whiteboard: [fixed by bug 282432])
in general, it is a poor api that doesn't return cleanly when it can, and it would greatly help consumers if more care were taken to ensure better error handling in xhr. in a specific case, the following code: this.request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"] .createInstance(Ci.nsIXMLHttpRequest); this.request.onprogress = this.onProgress; this.request.open("GET", "file:///C:/NonexistentFile.xml", true); this.request.responseType = "document"; this.request.overrideMimeType("text/xml"); this.request.onload = this.onDownloaded; this.request.onerror = this.onDownloadError; this.request.send(null); throws with NS_ERROR_FILE_NOT_FOUND. either the .onerror callback, or .onload with an error .status (even a 404 could be valid) should be invoked, as these are likely already tested for by the caller. but not a throw.
Comment 1•12 years ago
|
||
This is actually necko throwing, not XHR per se. I guess XHR _could_ pretend necko didn't throw and convert this to an error callback, but making every necko consumer do that seems strictly worse thank fixing this in Necko. See bug 282432 and its numerous dependencies.
Depends on: 282432
Updated•12 years ago
|
Summary: nsIXMLHttpRequest.send() should not throw → nsIXMLHttpRequest.send() should not throw when trying to send to a nonexistent file:// URI
Comment 2•11 years ago
|
||
Looks like this is already fixed.
Comment 3•11 years ago
|
||
Sure, since bug 282432 got fixed.
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
unfortunately, no. did anyone try the sample above; it throws for me, on the latest Tb trunk. this.request.open("GET", "foo", true); should not throw, but go to onerror.
Comment 5•11 years ago
|
||
Because even the latest Thunderbird is based on the very old Gecko version (17). Fortunately it will be fixed by the next update.
ah yes, you are correct, thanks. all tb trains use the gecko ESR version. it doesn't seem clear when the cutover will be, though that's a problem for here.
Comment 8•11 years ago
|
||
Thunderbird trunk follows the tip of mozilla-central, not some old version. I tried the testcase, and it does work for me on tb trunk (doesn't throw).
Status: RESOLVED → VERIFIED
Whiteboard: [fixed by bug 282432]
Target Milestone: --- → mozilla19
Based on comment 8 part 1, this bug is not fixed: The following throw on windows: file:foo file:/ file:///foo In firefox trunk urlbar, the string must be at least file:///x: where x is any drive, followed by a string. to trigger a proper Not Found.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Whiteboard: [fixed by bug 282432]
Comment 10•11 years ago
|
||
No, this is fixed. You'd get the same behavior if you try "http://totally bogus". That's not about file not found, it's about a string that can't be parsed as a URI at all.
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed by bug 282432]
Reporter | ||
Comment 11•11 years ago
|
||
Followup Bug 875783 for "string that can't be parsed".
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•