Overview of Testing Objects
This directory contains sample JS components to test the basic JsAccount
concepts, which can also serve as templates for new implementations.
Component Naming
Because there are many different components involved with different roles,
it will be helpful to keep things straight by using a specific naming
convention for objects.
For testing, we consider that we are creating a new account type "foo". For
the specific case of the JA implementation of an object that implements the
nsIMsgMailNewsUrl interface, we'll use the following naming convention.
Typically C++ classes and JS constructors are capitalized, class instances
are not.
Names are constructed with the following subparts:
(Ja)(AccountType)(Language)(ComponentType)(Role)
Common parts of names
- Ja: All objects or classes begin with Ja
- AccountType: the type of account being created (here
Foo), or Base for the generic
implementation that is the base class of all types. May be *blank* if
the object is used for both base types and specific types.
-
Language: Use Cpp with objects and
classes implemented using C++, leave blank for JS versions.
-
ComponentType: the standard MailNews term for objects
that implement a particular interface. The legacy .cpp base components
are typically named:
(nsMsg)(ComponentType).cpp
for example nsMsgIncomingServer.cpp. This may be
shortened where appropriate, for example we use Url
instead of MailNewsUrl as the Ja
prefix implies that this is an implementation of MailNews objects.
- Role: the function of the object within the JA
architecture.
- Constructor: Creates the object only.
- Delegator: Calls the appropriate object, either a
JS or C++ variant, that implements a particular XPCOM method.
- Properties: JavaScript object that establishes
properties of a JA implementation class. This is used for automatic
generation of a list of methods to delegate to the JavaScript classes.
- (blank): Actual implementation.
Example: The C++ class that delegates the implementation of
nsIMsgMailNewsUrl (abbreviated as Url) to either a C++ or JS method is
called JaCppUrlDelegator.