| JSAccountUtils.sys.mjs |
This file implements helper methods to make the transition of base mailnews
objects from JS to C++ easier, and also to allow creating specialized
versions of those accounts using only JS XPCOM implementations.
In C++ land, the XPCOM component is a generic C++ class that does nothing
but delegate any calls to interfaces known in C++ to either the generic
C++ implementation (such as nsMsgIncomingServer.cpp) or a JavaScript
implementation of those methods. Those delegations could be used for either
method-by-method replacement of the generic C++ methods with JavaScript
versions, or for specialization of the generic class using JavaScript to
implement a particular class type. We use a C++ class as the main XPCOM
version for two related reasons: First, we do not want to go through a
C++->js->C++ XPCOM transition just to execute a C++ method. Second, C++
inheritance is different from JS inheritance, and sometimes the C++ code
will ignore the XPCOM parts of the JS, and just execute using C++
inheritance.
In JavaScript land, the implementation currently uses the XPCOM object for
JavaScript calls, with the last object in the prototype chain defaulting
to calling using the CPP object, specified in an instance-specific
this.cppBase object.
Examples of use can be found in the test files for jsaccount stuff.
|
9663 |
- |