Protect nsEvent (and subclasses) internals

NEW
Unassigned

Status

()

Core
Event Handling
P3
normal
17 years ago
8 years ago

People

(Reporter: Heikki Toivonen (remove -bugzilla when emailing directly), Unassigned)

Tracking

({helpwanted})

Trunk
mozilla1.2alpha
helpwanted
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Didn't file a bug on this issue, so based on our IRC discussion I filed a new bug...

The classes (structs) are defined here:

http://lxr.mozilla.org/seamonkey/source/widget/public/nsGUIEvent.h

As events are structs, all their members are public. This has led to many
situations where the fields have been initialized wrongly, or even completely
wrong classes have been used.

This bug can be fixed in several steps.

The first step would be to add constructors to the classes, and make some
members of type 'const'. For example, I do not think there is a need to change
eventStructType, message or time values once the object is constructed. There
might be others as well. If you change those members into const and set them in
the constructor, you have achieved the biggest gain. We have probably hundreds
of places where we create events, and set their members (often wrongly), when it
all could be done in a single location.

Right now we are also relying on the values of the data members. I am not yet
sure if it would be feasible to get the compiler do some checking for us (class
types etc.) We use lots of type casts with events, and it would be nice if we
could reduce that.

The next step would be to hide data members completely, but I do not know if
that is required. Just providing Get/Set for every member is not much better
than the current situation. It might help with inherited and overridden methods,
but I do not know if vtables would incur too big a cost in terms of space and speed.

Updated

17 years ago
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla1.0

Comment 1

17 years ago
QA contact updated
QA Contact: gerardok → madhur

Updated

16 years ago
Target Milestone: mozilla1.0 → mozilla1.2

Comment 2

16 years ago
not gonna get to this...
Assignee: blaker → joki
Status: ASSIGNED → NEW
Target Milestone: mozilla1.2 → ---

Updated

16 years ago
Keywords: helpwanted
Target Milestone: --- → mozilla1.2

Updated

16 years ago
QA Contact: madhur → rakeshmishra

Updated

15 years ago
QA Contact: rakeshmishra → trix

Comment 3

14 years ago
.
Assignee: joki → saari
QA Contact: trix → ian
Assignee: saari → nobody
QA Contact: ian → events
You need to log in before you can comment on or make changes to this bug.