Protect against XMLHttpRequest statusText not being available

RESOLVED FIXED in mozilla1.8.1beta2

Status

()

Toolkit
Add-ons Manager
RESOLVED FIXED
12 years ago
10 years ago

People

(Reporter: rstrong, Assigned: rstrong)

Tracking

({fixed1.8.1})

Trunk
mozilla1.8.1beta2
fixed1.8.1
Points:
---
Bug Flags:
blocking-firefox2 +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

1.38 KB, patch
(not reading, please use seth@sspitzer.org instead)
: review+
beltzner
: approval1.8.1+
Details | Diff | Splinter Review
When a network connection is unavailable we throw in the EM when getting the statusText from XMLHttpRequest. Patch coming up.
Created attachment 230623 [details] [diff] [review]
patch

Simple fix. Without this we throw and STATUS_FAILURE is never returned for an add-on during an update check.
Attachment #230623 - Flags: review?(sspitzer)
Requesting blocking 2.0 - this can prevent the appearance of a hang during an update check when a network connection is unavailable.
Flags: blocking-firefox2?
shouldn't this be something like:

+    // this can fail when a network connection is not present.
+    var statusText;
+    try {
+      statusText = request.statusText;
+    }
+    catch (e) {
+      status = 0;
+    }
     // When status is 0 we don't have a valid channel.
     if (status == 0)
       statusText = "nsIXMLHttpRequest channel unavailable";
Comment on attachment 230623 [details] [diff] [review]
patch

r=sspitzer, my nit is my own js coding style, and does not match this file.
Attachment #230623 - Flags: review?(sspitzer) → review+
Checked in to trunk
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED

Updated

12 years ago
Flags: blocking-firefox2? → blocking-firefox2+
Comment on attachment 230623 [details] [diff] [review]
patch

Simple patch that adds a try catch around getting the XMLHttpRequest statusText property for the no network connection case where XMLHttpRequest will throw
Attachment #230623 - Flags: approval1.8.1?
Comment on attachment 230623 [details] [diff] [review]
patch

a=drivers. Please land this on the MOZILLA_1_8_BRANCH.
Attachment #230623 - Flags: approval1.8.1? → approval1.8.1+
Checked in to MOZILLA_1_8_BRANCH
Keywords: fixed1.8.1
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.