Closed Bug 1572395 Opened 5 years ago Closed 5 years ago

fetchhttp.js deals with connection errors incorrectly

Categories

(Thunderbird :: Account Manager, defect)

defect
Not set
normal

Tracking

(thunderbird_esr6869+ fixed, thunderbird69 wontfix, thunderbird70 fixed)

RESOLVED FIXED
Thunderbird 70.0
Tracking Status
thunderbird_esr68 69+ fixed
thunderbird69 --- wontfix
thunderbird70 --- fixed

People

(Reporter: neil, Assigned: neil)

Details

Attachments

(1 file, 2 obsolete files)

Relevant comment from fetchhttp.js:

// If we can't resolve the hostname in DNS etc., .statusText throws

While this was correct at the time (10 years ago), bug 608939 changed the behaviour, so this code hasn't been working for over 8 years.

Attached patch Proposed patch (obsolete) — Splinter Review

Actually, status might have still thrown as late as 7 years ago; that was changed in bug 301705.

Assignee: nobody → neil
Attachment #9083964 - Flags: review?(ben.bucksch)
Comment on attachment 9083964 [details] [diff] [review]
Proposed patch

Review of attachment 9083964 [details] [diff] [review]:
-----------------------------------------------------------------

Great idea, but please keep the try/catch, just in case (!). In the catch, do `console.error(ex)`, then continue with the `if (!errorMsg)` check as if there was no exception:

```
      try {
        errorCode = this._request.status;
        errorStr = this._request.statusText;
      } catch (ex) {
        console.error(ex);
        // continue with empty errorStr
      }
      if (!errorStr) {
        // If we can't resolve the hostname in DNS etc., .statusText is empty
```

::: mail/components/accountcreation/content/fetchhttp.js
@@ -246,5 @@
> -      try {
> -        errorCode = this._request.status;
> -        errorStr = this._request.statusText;
> -      } catch (e) {
> -        // If we can't resolve the hostname in DNS etc., .statusText throws

Please keep the comment, it's highly useful and important. Just adapt it.
Attachment #9083964 - Flags: review?(ben.bucksch) → review-
Attachment #9083964 - Flags: feedback+
Attached patch Addressed review comments (obsolete) — Splinter Review
Attachment #9083964 - Attachment is obsolete: true
Attachment #9084026 - Flags: review?(ben.bucksch)
Comment on attachment 9084026 [details] [diff] [review]
Addressed review comments

Like I said above, keep the old comment, it's useful and important to know which case we are handling, because it's not clear from the code and these errors are happening in reality.

Please do it like this:
```
       } catch (e) {
        // In case .statusText throws (it's marked as [Throws] in the webidl),
        // continue with empty errorStr.
        console.error(e);
      }
      if (!errorStr) {
         // If we can't resolve the hostname in DNS etc., .statusText is empty.
         errorCode = -2;
```

r=BenB with this change
Attachment #9084026 - Flags: review?(ben.bucksch)
Attachment #9084026 - Flags: review-
Attachment #9084026 - Flags: feedback+

Ah, so I needed to keep the comment in both places, effectively. Sorry for not realising that.

Attachment #9084026 - Attachment is obsolete: true
Attachment #9087683 - Flags: review+
Keywords: checkin-needed

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/1e07285df111
Update to current statusText semantics. r=BenB

Status: NEW → RESOLVED
Closed: 5 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 70.0
Comment on attachment 9087683 [details] [diff] [review]
Addressed review comments

[Approval Request Comment]
Regression caused by (bug #): 
User impact if declined: If we have a wrong hostname (likely, in the setup dialog), user doesn't get a proper error message.
Testing completed (on c-c, etc.): 
Risk to taking this patch (and alternatives if risky):
Attachment #9087683 - Flags: approval-comm-esr68?
Comment on attachment 9087683 [details] [diff] [review]
Addressed review comments

Sigh. I wish you'd finally acknowledge how releases work. Trunk first, then beta, then ESR. Sadly you didn't ask for beta approval, so the beta 69 ship has sailed, so technically this can only go into TB 68.2 in late October.
Attachment #9087683 - Flags: approval-comm-esr68? → approval-comm-esr68+
Comment on attachment 9087683 [details] [diff] [review]
Addressed review comments

[Approval Request Comment]
Regression caused by (bug #): 
User impact if declined: 
Testing completed (on c-c, etc.): 
Risk to taking this patch (and alternatives if risky):
Attachment #9087683 - Flags: approval-comm-beta?

Too late. It is in TB 70 and will go to TB 70 beta next week. I'll cancel all pending requests or approvals then.

Comment on attachment 9087683 [details] [diff] [review]
Addressed review comments

Sorry, too late, will go into TB 70 beta.
Attachment #9087683 - Flags: approval-comm-beta?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: