javascript strict warnings in sidebarOverlay.js

VERIFIED FIXED

Status

VERIFIED FIXED
17 years ago
14 years ago

People

(Reporter: stdowa+bugzilla, Assigned: stdowa+bugzilla)

Tracking

Trunk
x86
Windows 2000

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

17 years ago
Using today's trunk build.

Warning: redeclaration of var tabs
Source File: chrome://communicator/content/sidebar/sidebarOverlay.js
Line: 1268, Column: 12
Source Code:
        var tabs = sidebarObj.panels.node.childNodes;

Warning: redeclaration of var i
Source File: chrome://communicator/content/sidebar/sidebarOverlay.js
Line: 1346, Column: 13
Source Code:
    for (var i = 2; i < tabs.length; i += 2)

Warning: redeclaration of var currHeader
Source File: chrome://communicator/content/sidebar/sidebarOverlay.js
Line: 1348, Column: 10
Source Code:
      var currHeader = tabs[i];

Warning: redeclaration of var currTab
Source File: chrome://communicator/content/sidebar/sidebarOverlay.js
Line: 1349, Column: 10
Source Code:
      var currTab = new sbPanel(currHeader.getAttribute("id"), currHeader, i);
(Assignee)

Comment 1

17 years ago
Created attachment 70607 [details] [diff] [review]
patch

Comment 2

17 years ago
Comment on attachment 70607 [details] [diff] [review]
patch

>Index: mozilla/xpfe/components/sidebar/resources/sidebarOverlay.js
>===================================================================
>RCS file: /cvsroot/mozilla/xpfe/components/sidebar/resources/sidebarOverlay.js,v
>retrieving revision 1.97
>diff -u -r1.97 sidebarOverlay.js
>--- mozilla/xpfe/components/sidebar/resources/sidebarOverlay.js	2002/02/20 21:31:00	1.97
>+++ mozilla/xpfe/components/sidebar/resources/sidebarOverlay.js	2002/02/20 23:54:03
>@@ -1231,10 +1231,11 @@
>   // if we ex/included a tab in view then add/remove another one
>   if (panel.is_in_view())
>   {
>+    var tabs = sidebarObj.panels.node.childNodes;
>     if (did_exclude)
>     {
>       // we excluded one so let's try to bring a non-excluded one into view
>-      var tabs = sidebarObj.panels.node.childNodes;
>+      tabs = sidebarObj.panels.node.childNodes;

If we have already set it to sidebarObj.panels.node.childNodes above we don't
need to set it again.

>       var newFirst = null;
>       var added = false;
>       for (var i = 2; i < tabs.length ; i += 2)
>@@ -1265,7 +1266,7 @@
>       if (sidebarObj.panels.num_panels_in_view() > gNumTabsInViewPref)
>       {
>         // we included a new tab so let's take the last one out of view
>-        var tabs = sidebarObj.panels.node.childNodes;
>+        tabs = sidebarObj.panels.node.childNodes;

If we have already set it to sidebarObj.panels.node.childNodes above we don't
need to set it again.

>         for (i = 2; i < tabs.length; i += 2)
>         {
>           var currHeader = tabs[i];
>@@ -1292,16 +1293,19 @@
>   debug("SidebarNavigate " + aDirection);
> 
>   var tabs = sidebarObj.panels.node.childNodes;
>+  var i = 2;

Don't initalize it.  Just declare it.  It'll get initialized in the for loop.

>+  var currHeader = tabs[i];

Don't initalize it.  Just declare it.

>+  var currTab = new sbPanel(currHeader.getAttribute("id"), currHeader, i);

Don't initalize it.  Just declare it.
Attachment #70607 - Flags: needs-work+

Comment 3

17 years ago
-> Stephen Walker
Assignee: sgehani → walk84
(Assignee)

Comment 4

17 years ago
Created attachment 70653 [details] [diff] [review]
patch rev. 2
*** Bug 127558 has been marked as a duplicate of this bug. ***

Comment 6

17 years ago
r=gemal on 70653 if if helps
Comment on attachment 70653 [details] [diff] [review]
patch rev. 2

r=bzbarsky
Attachment #70653 - Flags: review+

Comment 8

17 years ago
Comment on attachment 70653 [details] [diff] [review]
patch rev. 2

sr=jag
Attachment #70653 - Flags: superreview+

Comment 9

17 years ago
Comment on attachment 70653 [details] [diff] [review]
patch rev. 2

a=scc
Attachment #70653 - Flags: approval+
Checked in.
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED

Comment 11

17 years ago
Stephen, can you verify this is fixed? thanks.
(Assignee)

Comment 12

17 years ago
verified using a build from today on win2k.
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.