Closed Bug 265453 Opened 20 years ago Closed 20 years ago

Error loading any script if a loaded script has no ID

Categories

(Other Applications :: ChatZilla, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: oriyanh, Assigned: rginda)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20041001 Firefox/0.10.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20041001 Firefox/0.10.1

When doing /load to load a script, and that script has no ID tag (plugin.id =
"plugin-id";), it tries to remove all loaded scripts with an <unknown> ID tag.
Although, this bug is only occuring when the script does not have an ID tag.

Example: [INFO]	Unable to disable plugin <unknown>.
[INFO]	Error loading subscript from <scriptlocation>.

Reproducible: Always
Steps to Reproduce:
1. Remove ID tag from script
2. /load the script
3. Get the error
Actual Results:  
Gettings errors, and script not loading
Ah, what he said's not /quite/ correct I think - it only tries to remove /one/
plugin with no ID, and it doesn't matter about the one being loaded.

http://lxr.mozilla.org/mozilla/source/extensions/irc/xul/content/commands.js#1910

plugin.id is MSG_UNKNOWN from
http://lxr.mozilla.org/mozilla/source/extensions/irc/xul/content/commands.js#1893.

Then
http://lxr.mozilla.org/mozilla/source/extensions/irc/xul/content/commands.js#1893
finds the first one with that ID... and it tries to remove it.

The problem here is that it's finding a already loaded plugin with no ID which
*can't* be disabled, and failing.
Summary: Error loading scripts with no ID tags → Error loading any script if a loaded script has no ID
Ok, the issue is simply that calling client.load on the new script will NOT set
plugin.id... that's not set until you call init/initPlugin, so it will always
try to remove plugins without IDs.

According to http://www.hacksrus.com/~ginda/chatzilla/scripts/sample/init.js
plugins are "expected" to set plugin.id, but it's not required or enforced, so
they don't all do it.

I think the best solution is to make getPluginIndexById (and getPluginById, for
that matter) automatically return -1/null if you pass MSG_UNKNOWN as the id.
Status: UNCONFIRMED → NEW
Depends on: czpluginapi
Ever confirmed: true
Product: Core → Other Applications
FIXED.

This fix will be available in the next ChatZilla release, 0.9.67.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.