Closed Bug 263648 Opened 20 years ago Closed 19 years ago

Sunbird nsExtensionsManager.js: 29 strict javascript warnings

Categories

(Calendar :: General, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: gekacheka, Assigned: mostafah)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20040913 Firefox/0.10.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a4) Gecko/20040907 Mozilla Sunbird/0.2a Starting Sunbird with user_pref("javascript.options.strict", true); fills the JavaScript console with warnings from nsExtensionsManager, making it harder for developers to find their own problems. Most of the warnings are "redeclaration of var" warnings, plus a few "does not always return a value" warnings. (JavaScript/EcmaScript strictly allows a var to be declared only once per function body. Extension manager comes from the aviary toolkit, but sunbird mostly uses trunk code. Does Aviary change JavaScript var scope?) Reproducible: Always Steps to Reproduce: 1. Start sunbird 2. Open javascript console Actual Results: JavaScript console displays: Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 669, Column: 13 Source Code: for (var i = 0; i < lines.length; ++i) Warning: redeclaration of var isProfile Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 700, Column: 10 Source Code: var isProfile = parts[1] == this.TOKEN_PROFILE; Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1182, Column: 15 Source Code: for (var i = 0; i < this._packagesForExtension.length; ++i) { Warning: redeclaration of var PRBool Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1511, Column: 12 Source Code: var PRBool = aSubject.QueryInterface(Components.interfaces.nsISupportsPRBool); Warning: redeclaration of var win Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1590, Column: 10 Source Code: var win = this._showProgressWindow(); Warning: redeclaration of var pref Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1597, Column: 12 Source Code: var pref = Components.classes["@mozilla.org/preferences-service;1"] Warning: redeclaration of var cr Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1599, Column: 12 Source Code: var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"] Warning: redeclaration of var items Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1607, Column: 12 Source Code: var items = this._ds.getItemList(null, nsIUpdateItem.TYPE_EXTENSION, {}); Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1608, Column: 17 Source Code: for (var i = 0; i < items.length; ++i) Warning: redeclaration of var wasInSafeModeFile Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1621, Column: 12 Source Code: var wasInSafeModeFile = getFile(KEY_PROFILEDIR, [DIR_EXTENSIONS, FILE_WASINSAFEMODE]); Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1825, Column: 13 Source Code: for (var i = 0; i < items.length; ++i) Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1852, Column: 15 Source Code: for (var i = 0; i < items.length; ++i) Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1857, Column: 15 Source Code: for (var i = 0; i < items.length; ++i) Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1864, Column: 15 Source Code: for (var i = 0; i < items.length; ++i) Warning: redeclaration of var pref Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 1971, Column: 16 Source Code: var pref = Components.classes["@mozilla.org/preferences-service;1"] Warning: function nsExtensionManager_installExtensionInternal does not always return a value Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 2235, Column: 22 Source Code: return extensionID; Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 2666, Column: 15 Source Code: for (var i = 0; i < this._transactions.length; ++i) { Warning: redeclaration of var item Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 3547, Column: 16 Source Code: var item = Components.classes["@mozilla.org/updates/item;1"] Warning: function nsExtensionsDataSource_getItemProperty does not always return a value Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 3737, Column: 2 Source Code: }, Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 3830, Column: 13 Source Code: for (var i = 0; i < singleProps.length; ++i) { Warning: redeclaration of var property Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 3831, Column: 10 Source Code: var property = this._emR(manyProps[i]); Warning: redeclaration of var oldValue Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 3836, Column: 12 Source Code: var oldValue = oldValues.getNext().QueryInterface(Components.interfaces.nsIRDFNode); Warning: redeclaration of var literal Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 3840, Column: 12 Source Code: var literal = literals.getNext().QueryInterface(Components.interfaces.nsIRDFNode); Warning: redeclaration of var i Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 3850, Column: 13 Source Code: for (var i = 0; i < versionProps.length; ++i) { Warning: redeclaration of var property Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 3851, Column: 10 Source Code: var property = this._emR(versionProps[i]); Warning: redeclaration of var item Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 4011, Column: 8 Source Code: var item = this._getResourceForItem(aItemID); Warning: redeclaration of var item Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 4029, Column: 8 Source Code: var item = this._getResourceForItem(aItemID); Warning: redeclaration of var itemType Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 4210, Column: 10 Source Code: var itemType = getItemType(aSource.Value); Warning: redeclaration of var res Source File: file:///C:/Program%20Files/Mozilla%20Sunbird/components/nsExtensionManager.js Line: 4212, Column: 12 Source Code: var res = this._getThemeJARURL(aSource, "preview.png", null); Expected Results: JavaScript console empty. Workaround: clear the console before testing your code, assuming you remember to and your code doesn't run only at startup.
Comments out redeclaration /*var*/ Returns null or undefined. A couple places comments out var line entirely as it is bound to same expression as before. On startup, javascript console no longer has any warnings from nsExtensionManager.js
gekachecka, can you test this on a trunk firefox build to see if you can see the same amount of js warnings there? If yes, we should move this bug over to Firefox, since this is where toolkit bugs are currently residing.
Yes, this also occurs in Thunderbird 0.8 and Firefox 0.10(.1) and the file appears unfixed at http://lxr.mozilla.org/aviarybranch/source/toolkit/mozapps/extensions/src/nsExtensionManager.js.in However, the Sunbird20041001 version has many differences, so it looks like the Sunbird20041001 version may be forked.
Attachment #161586 - Attachment is obsolete: true
Aviary patch provided at bug 249012.
Depends on: 249012
Sunbird does not have a separate nsExtensionManager.js. It uses whatever it gets from the trunk code.So the one it has in Sunbird20041001, is from the trunk code pulled at the same date. This bug will automatically be fixed when 249012 is fixed of course hoping that the fix will end up on the trunk as well.
I don't get any more javascript strict warnings from the extension manager on trunk. gekacheka, are you ok with closing this bug?
Resolving worksforme, looks like javascript was changed to no longer issue strict warnings for most of these. See bug 249012.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
The bugspam monkeys have been set free and are feeding on Calendar :: General. Be afraid for your sanity!
QA Contact: gurganbl → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: