Closed Bug 284647 Opened 20 years ago Closed 19 years ago

Javascript strict warnings in browser.js

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
trivial

Tracking

()

RESOLVED FIXED

People

(Reporter: florian, Assigned: Gavin)

Details

Attachments

(2 files, 4 obsolete files)

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050302
Firefox/1.0+


Source File: chrome://browser/content/browser.js
16 warnings in this file.
Attached patch patch (obsolete) — Splinter Review
Attachment #176163 - Flags: review?(mconnor)
Comment on attachment 176163 [details] [diff] [review]
patch

can you attach a patch using diff -up8 please?	There's a reason we request
that as a default, context is good.
Attachment #176163 - Flags: review?(mconnor) → review-
Attached patch same patch with more context (obsolete) — Splinter Review
Attachment #176249 - Flags: review?(mconnor)
Comment on attachment 176249 [details] [diff] [review]
same patch with more context

>@@ -2903,23 +2903,23 @@ var FullScreen = 
>       if (toolboxMode != "text") {
>         toolbox.setAttribute("saved-mode", toolboxMode);
>         toolbox.setAttribute("saved-iconsize", toolboxIconSize);
>         toolbox.setAttribute("mode", "icons");
>         toolbox.setAttribute("iconsize", "small");
>       }
>       else {
>         if (toolbox.hasAttribute("saved-mode")) {
>-          var savedMode = toolbox.getAttribute("saved-mode");
>+          savedMode = toolbox.getAttribute("saved-mode");
>           toolbox.setAttribute("mode", savedMode);
>           toolbox.removeAttribute("saved-mode");
>         }
> 
>         if (toolbox.hasAttribute("saved-iconsize")) {
>-          var savedIconSize = toolbox.getAttribute("saved-iconsize");
>+          savedIconSize = toolbox.getAttribute("saved-iconsize");
>           toolbox.setAttribute("iconsize", savedIconSize);
>           toolbox.removeAttribute("saved-iconsize");
>         }
>       }
>     }
>   }
> };
> 
>@@ -3372,16 +3372,17 @@ nsBrowserAccess.prototype =
>       return this;
>     throw Components.results.NS_NOINTERFACE;
>   },
> 
>   openURI : function(aURI, aOpener, aWhere, aContext)
>   {
>     var newWindow = null;
>     var referrer = null;
>+    var location = null;
>     if (aWhere == nsCI.nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW) {
>       switch (aContext) {
>         case nsCI.nsIBrowserDOMWindow.OPEN_EXTERNAL :
>           aWhere = gPrefService.getIntPref("browser.link.open_external");
>           break;
>         default : // OPEN_NEW or an illegal value
>           aWhere = gPrefService.getIntPref("browser.link.open_newwindow");
>       }
>@@ -3395,39 +3396,37 @@ nsBrowserAccess.prototype =
>         var newTab = gBrowser.addTab("about:blank");
>         if (!gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground"))
>           gBrowser.selectedTab = newTab;
>         newWindow = gBrowser.getBrowserForTab(newTab).docShell
>                             .QueryInterface(nsCI.nsIInterfaceRequestor)
>                             .getInterface(nsCI.nsIDOMWindow);
>         try {
>           if (aOpener) {
>-            var location = Components.lookupMethod(aOpener,"location")
>+            location = Components.lookupMethod(aOpener,"location")
>                                      .call(aOpener);

align the periods, if you move the line, you have to realign the code.

>-            var referrer = 
>-                    Components.classes["@mozilla.org/network/io-service;1"]
>+            referrer = Components.classes["@mozilla.org/network/io-service;1"]
>                               .getService(Components.interfaces.nsIIOService)
>                               .newURI(location, null, null);

same here
>           newWindow.QueryInterface(nsCI.nsIInterfaceRequestor)
>                    .getInterface(nsCI.nsIWebNavigation)
>                    .loadURI(url, nsCI.nsIWebNavigation.LOAD_FLAGS_NONE,
>                             referrer, null, null);
>         } catch(e) {
>         }
>         break;
>       default : // OPEN_CURRENTWINDOW or an illegal value
>         try {
>           if (aOpener) {
>             newWindow = Components.lookupMethod(aOpener,"top")
>                                   .call(aOpener);
>-            var location = Components.lookupMethod(aOpener,"location")
>+            location = Components.lookupMethod(aOpener,"location")
>                                      .call(aOpener);
>-            var referrer = 
>-                    Components.classes["@mozilla.org/network/io-service;1"]
>+            referrer = Components.classes["@mozilla.org/network/io-service;1"]
>                               .getService(Components.interfaces.nsIIOService)
>                               .newURI(location, null, null);
> 

these two as well.

looks good otherwise, r=me once I see those changes.
Attachment #176249 - Flags: review?(mconnor) → review-
Attached patch patch-2 (wrong diff) (obsolete) — Splinter Review
Attachment #176163 - Attachment is obsolete: true
Attachment #176249 - Attachment is obsolete: true
Attachment #176283 - Flags: review?(mconnor)
Attachment #176283 - Attachment description: patch-2 → patch-2 (wrong diff)
Attachment #176283 - Attachment is obsolete: true
Attachment #176283 - Flags: review?(mconnor)
Attached patch the real patch-2 (obsolete) — Splinter Review
The previous diff was wrong. sorry about that.
I realigned the periods.
Attachment #176287 - Flags: review?(mconnor)
Attachment #176287 - Attachment is obsolete: true
Attachment #178739 - Flags: review?(mconnor)
Attachment #176287 - Flags: review?(mconnor)
Attachment #178739 - Flags: review?(mconnor) → review+
Whiteboard: [checkin needed]
Checking in base/content/browser.js;
/cvsroot/mozilla/browser/base/content/browser.js,v  <--  browser.js
new revision: 1.406; previous revision: 1.405
done
Assignee: firefox → gavin.sharp
Whiteboard: [checkin needed]
Attachment #178739 - Attachment description: Patch → [checked in] Patch
Fixed.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: