Closed Bug 296939 Opened 20 years ago Closed 20 years ago

JS Useless Expression warning in /usr/lib/mozilla-firefox/components/nsExtensionManager.js

Categories

(Toolkit :: Add-ons Manager, defect)

1.7 Branch
x86
Linux
defect
Not set
trivial

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bugjirra, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050517 Firefox/1.0.4 (Debian package 1.0.4-2)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050517 Firefox/1.0.4 (Debian package 1.0.4-2)

When attempting to install the search plugin at the aforementioned address, the
JS console lists a couple of warnings to do with nsExtensionManager.js:

Warning: useless expression
Source File: file:///usr/lib/mozilla-firefox/components/nsExtensionManager.js
Line: 334

Warning: useless expression
Source File: file:///usr/lib/mozilla-firefox/components/nsExtensionManager.js
Line: 337

Looking at the code, these are the offending lines:

function stackTraceFunctionFormat(aFunctionName)
{
  var classDelimiter = aFunctionName.indexOf("_");
  var className = aFunctionName.substr(0, classDelimiter);
  if (!className)
    className == "<global>";  // <---- ## HERE ##
  var functionName = aFunctionName.substr(classDelimiter + 1, aFunctionName.length);
  if (!functionName) 
    functionName == "<anonymous>";  // <---- ## HERE ##
  return className + "::" + functionName;
}

(n.b. the ## HERE ## comments added)

Looking at the code, a = may be intended instead of a ==.

Running on Debian sid;

$ dpkg -l mozilla-firefox
||/ Name                             Version
+++-================================-=======
ii  mozilla-firefox                  1.0.4-2

Not sure if this is a Debian-specific bug; or a general Firefox bug.

Reproducible: Always

Steps to Reproduce:
1. Goto the aforementioned URL
2. Click on the Download Here link
3. Open the JS console

Actual Results:  
The warning messages as previously discussed show in the JS Console

Expected Results:  
Warnings should not be given.
This code is for BenG's debugging only and is #ifdefed out on trunk. Not going
to fix this on the 1.0 branch.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
Version: unspecified → 1.0 Branch
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.