Closed Bug 277607 Opened 20 years ago Closed 20 years ago

useless expression in nsUpdateService.js

Categories

(Toolkit :: Application Update, defect, P5)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8final

People

(Reporter: crisp, Assigned: Gavin)

Details

Attachments

(3 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

On startup the nsUpdateService.js produces a lot of strict JavaScript warnings,
which can be easily prevented:

Warning: useless expression
Source File:
file:///D:/Program%20Files/Mozilla%20Firefox/components/nsUpdateService.js
Line: 82

  if (!className)
    className == "<global>";


Warning: useless expression
Source File:
file:///D:/Program%20Files/Mozilla%20Firefox/components/nsUpdateService.js
Line: 85

  if (!functionName) 
    functionName == "<anonymous>";


Warning: redeclaration of var sbs
Source File:
file:///D:/Program%20Files/Mozilla%20Firefox/components/nsUpdateService.js
Line: 202, Column: 12
Source Code:
        var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]


Warning: redeclaration of var bundle
Source File:
file:///D:/Program%20Files/Mozilla%20Firefox/components/nsUpdateService.js
Line: 204, Column: 12
Source Code:
        var bundle =
sbs.createBundle("chrome://mozapps/locale/update/update.properties");


Warning: redeclaration of var ps
Source File:
file:///D:/Program%20Files/Mozilla%20Firefox/components/nsUpdateService.js
Line: 209, Column: 12
Source Code:
        var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]

Reproducible: Always

Steps to Reproduce:
1. Install Web Developer extention
2. Tick 'enable javascript strict warnings' in the option
3. close and restart firefox

Actual Results:  
abovementioned warnings in the javascript console

Expected Results:  
the code should be such that no warnings are generated
The redeclarations aren't significant.
Assignee: bugs → gavin.sharp
Severity: normal → trivial
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Hardware: PC → All
Summary: Javascript strict warnings in nsUpdateService.js → useless expression in nsUpdateService.js
Target Milestone: --- → Firefox1.1
Version: unspecified → Trunk
Attachment #171601 - Flags: review?(bugs)
Priority: -- → P5
Whiteboard: [patch-r?]
Attachment #171601 - Flags: review?(bugs) → review+
Whiteboard: [patch-r?] → [patch-r+] [checkin needed]
Comment on attachment 171601 [details] [diff] [review]
(Av1) Patch
[Checked in: Comment 3]

Checking in nsUpdateService.js.in;
/cvsroot/mozilla/toolkit/mozapps/update/src/nsUpdateService.js.in,v  <-- 
nsUpdateService.js.in
new revision: 1.7; previous revision: 1.6
done
Attachment #171601 - Attachment description: Patch → Patch (Checked in)
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Whiteboard: [patch-r+] [checkin needed]
Comment on attachment 171601 [details] [diff] [review]
(Av1) Patch
[Checked in: Comment 3]

[Mozilla Thunderbird, version 1.0.1 (20050309)] (nightly) (W98SE)

Welcomed on branch too !
Attachment #171601 - Flags: approval-aviary1.0.1?
Attached patch (Bv1) <nsUpdateService.js.in> (obsolete) — Splinter Review
[Mozilla Thunderbird, version 1.0.1 (20050309)] (nightly) (W98SE)

(In reply to comment #1)
> The redeclarations aren't significant.

Yet, no reason not to fix them: clears the console.

Could you (super-)review/check in this patch ? Thanks.
Attachment #177001 - Flags: superreview?(mconnor)
Attachment #177001 - Flags: review?(mconnor)
Attachment #171601 - Attachment description: Patch (Checked in) → (Av1) Patch [Checked in: Comment 3]
Attachment #171601 - Attachment is obsolete: true
Comment on attachment 177001 [details] [diff] [review]
(Bv1) <nsUpdateService.js.in>

no SR needed for toolkit, but this isn't the right fix.

If you want to fix the strict warnings, declare the vars, but don't do the
getService calls unless necessary.  They're not always needed, and in fact
they're usually not hit.
Attachment #177001 - Flags: superreview?(mconnor)
Attachment #177001 - Flags: review?(mconnor)
Attachment #177001 - Flags: review-
Comment on attachment 171601 [details] [diff] [review]
(Av1) Patch
[Checked in: Comment 3]

1.0.1 is a security release and Firefox 1.0.1 has already shipped.
Attachment #171601 - Flags: approval-aviary1.0.1? → approval-aviary1.0.1-
Attached patch (Bv2) <nsUpdateService.js.in> (obsolete) — Splinter Review
Bv1, with comment 6 suggestion(s),
plus getting rid of some variables.

Could you review/check in this patch ? Thanks.
Attachment #177001 - Attachment is obsolete: true
Attachment #177039 - Flags: review?(mconnor)
Attachment #171601 - Flags: approval-aviary1.0.2?
Comment on attachment 171601 [details] [diff] [review]
(Av1) Patch
[Checked in: Comment 3]

Please stop harassing drivers with approval requests for bugs without clear
explanations of why they are important to fix on the branch.  The point of
branches is that we *don't* take all changes on them.  We want to take only the
important ones, so that we have less chance of having regressions.
Attachment #171601 - Flags: approval-aviary1.0.2? → approval-aviary1.0.2-
Comment on attachment 177039 [details] [diff] [review]
(Bv2) <nsUpdateService.js.in>

No need to remove the redeclarations, and this is bitrotten.
Attachment #177039 - Attachment is obsolete: true
Attachment #177039 - Flags: review?(mconnor)
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: