Closed Bug 13261 Opened 25 years ago Closed 25 years ago

numercial consts in compose window JS

Categories

(SeaMonkey :: MailNews: Message Display, defect, P4)

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: BenB, Assigned: bugzilla)

Details

enums from C++ and other consts are simply referenced by their numerical values
in JavaScripts.
This will all break, if anyone adds an entry to the enum or similar.
IDL must be changed to include the consts and they should be _excusively_ used
in the scripts.

Atl least that's my opinion. Others?
Example:
http://lxr.mozilla.org/seamonkey/source/mailnews/base/resources/content/commandglue.js#46
 46 function ComposeMessage(type, format)
 47 //type: 0=new message, 1=reply, 2=reply all,
 48 //      3=forward inline, 4=forward as attachment
[...]
 80   for (var i = 0; i < nodeList.length && i < 8; i ++)
Assignee: phil → ducarroz
Severity: normal → minor
Priority: P3 → P4
Summary: numercial consts in *.js → numercial consts in compose window JS
Yes, that's a fine improvement, but not high priority. Reassigning to ducarroz.
Status: NEW → ASSIGNED
Target Milestone: M14
ok, I've done the first half of this by converting the enums to IDL and fixing
the C++.
You should be able to access the constants from JS with stuff like:
var msgCompFormat = Components.interfaces.nsIMsgCompFormat;

if (format == msgCompFormat.HTML) {

..
}
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Target Milestone: M14 → M12
done, checked in.
QA Contact: lchiang → ppandit
Status: RESOLVED → VERIFIED
Checked nsIMsgCompose.idl. It has

[scriptable, uuid(c7035852-7531-11d3-9a73-006008948010)]
 38 interface nsIMsgCompType {
 39     const long New        = 0;
 40     const long Reply      = 1;
 41     const long ReplyAll   = 2;
 42     const long ForwardAsAttachment = 3;
 43     const long ForwardInline = 4;
 44 };
 45

This interface is used in commandglue.js properly.

VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.