Closed Bug 876289 Opened 11 years ago Closed 11 years ago

Start page version detection broken in case of first minor release

Categories

(SeaMonkey :: Website, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: InvisibleSmiley, Assigned: InvisibleSmiley)

References

()

Details

Attachments

(1 file)

Attached patch patchSplinter Review
The JavaScript code on the SM start page breaks if a minor release is available (latest stable version) and the currently used version is a major release. Example: Currently used version 2.17, available version 2.17.1.

The problem is that the for loop that iterates over curver_parts implicitly assumes that smver_parts contains as many items as curver_parts, which is not the case in the scenario described above (i.e. smver_parts[i] is undefined for i=2).

I think we can safely assume that both arrays include defined items for i=0. Now if the lengths of the two arrays differ, there are basically just two options:
a) Currently used version has more parts than available stable version
b) Available stable version has more parts than currently used version.

Case a) is not a problem since that implies that the currently used version is older than the available stable version (implicitly assuming that the currently used version cannot be more current that the available stable version, and relying on the fact that alphas and betas are not handled in this if branch). Hence the for loop should be left before the undefined item would be compared.

Case b) is a problem, though, matching the scenario from above. Looking at how the for loop works, we only need to check the case where the current index (i, from curver_parts) is beyond the amount that smver_parts contains, i.e. equal to smver_parts.length. If we hit this case, the currently used version is known to be older than the available stable version and we can leave the loop. This is what the attached patch (checked in) does.

While I was at it, I also added some loop abort call to the beta handling case. Since our betas (and alphas) only ever include two parts, there is nothing else to do there - at least for now...
Actually the patch affected just the test file, but I fixed all three files.

Checking in src/start/index-test.en.html;
/www/seamonkeyproject-org/src/start/index-test.en.html,v  <--  index-test.en.html
new revision: 1.17; previous revision: 1.16
done
Checking in index.de.html;
/www/seamonkeyproject-org/src/start/index.de.html,v  <--  index.de.html
new revision: 1.25; previous revision: 1.24
done
Checking in index.en.html;
/www/seamonkeyproject-org/src/start/index.en.html,v  <--  index.en.html
new revision: 1.37; previous revision: 1.36
done
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Product: Websites → SeaMonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: