Closed Bug 1148798 Opened 5 years ago Closed 5 years ago

nsSuiteGlue.js error NS_ERROR_UNEXPECTED when running tests because "app.update.lastUpdateTime.background-update-timer" isn't set

Categories

(SeaMonkey :: General, defect)

defect
Not set

Tracking

(seamonkey2.37 fixed)

RESOLVED FIXED
seamonkey2.37
Tracking Status
seamonkey2.37 --- fixed

People

(Reporter: philip.chee, Assigned: philip.chee)

Details

Attachments

(1 file, 1 obsolete file)

While working on Bug 1139958 I kept getting this error:
> JavaScript error: file:///c:/t1/hg/objdir-sm/dist/bin/components/nsSuiteGlue.js, line 669: NS_ERROR_UNEXPECTED
> : Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getIntPref]
Because "app.update.lastUpdateTime.background-update-timer" isn't set in the mochitest environment.
Attached patch Patch v1.0 Proposed fix (obsolete) — Splinter Review
Test with prefHasUserValue() first
Assignee: nobody → philip.chee
Status: NEW → ASSIGNED
Attachment #8585066 - Flags: review?(neil)
Comment on attachment 8585066 [details] [diff] [review]
Patch v1.0 Proposed fix

>     // If there was an automated update tried in the interval, don't worry.
>-    var lastUpdateTime = Services.prefs.getIntPref("app.update.lastUpdateTime.background-update-timer");
>+    const LASTUPDATETIME = "app.update.lastUpdateTime.background-update-timer";
>+    var lastUpdateTime = Services.prefs.prefHasUserValue(LASTUPDATETIME) ?
>+                         Services.prefs.getIntPref(LASTUPDATETIME) : now;
>     if (lastUpdateTime + maxAge > now)
>       return false;
Please use the same constant for the pref as everyone else.
I'm not convinced that defaulting to now is correct, as if the preference doesn't exist that means that we haven't checked in the last three months.
It might be simpler to provide a default value in preferences (other consumers use 0 for unknown).
Attachment #8585066 - Flags: review?(neil) → review-
> Please use the same constant for the pref as everyone else.
Done.

> I'm not convinced that defaulting to now is correct, as if the preference 
> doesn't exist that means that we haven't checked in the last three 
> months.
> It might be simpler to provide a default value in preferences (other 
> consumers use 0 for unknown).
Done.
Attachment #8585066 - Attachment is obsolete: true
Attachment #8585722 - Flags: review?(neil)
Attachment #8585722 - Flags: review?(neil) → review+
http://hg.mozilla.org/comm-central/rev/56708cdce292
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.37
You need to log in before you can comment on or make changes to this bug.