releases-comm-central/mailnews/jsaccount
Khushil Mistry 2cd0230d32 Bug 1562313 - Convert JavaScript components to use static registration in mailnews/. r=mkmelin
--HG--
rename : mailnews/addrbook/src/nsAbAutoCompleteMyDomain.js => mailnews/addrbook/src/AbAutoCompleteMyDomain.jsm
rename : mailnews/addrbook/src/nsAbAutoCompleteSearch.js => mailnews/addrbook/src/AbAutoCompleteSearch.jsm
rename : mailnews/addrbook/src/nsAbLDAPAttributeMap.js => mailnews/addrbook/src/AbLDAPAttributeMap.jsm
rename : mailnews/addrbook/src/nsAbLDAPAutoCompleteSearch.js => mailnews/addrbook/src/AbLDAPAutoCompleteSearch.jsm
rename : mailnews/base/search/src/nsMsgTraitService.js => mailnews/base/search/src/MsgTraitService.jsm
rename : mailnews/base/src/folderLookupService.js => mailnews/base/src/FolderLookupService.jsm
rename : mailnews/base/src/nsMailNewsCommandLineHandler.js => mailnews/base/src/MailNewsCommandLineHandler.jsm
rename : mailnews/base/src/newMailNotificationService.js => mailnews/base/src/MailNotificationService.jsm
rename : mailnews/base/src/msgAsyncPrompter.js => mailnews/base/src/MsgAsyncPrompter.jsm
rename : mailnews/base/src/msgOAuth2Module.js => mailnews/base/src/OAuth2Module.jsm
rename : mailnews/compose/src/nsSMTPProtocolHandler.js => mailnews/compose/src/SMTPProtocolHandler.jsm
rename : mailnews/db/gloda/components/glautocomp.js => mailnews/db/gloda/components/GlodaAutoComplete.jsm
rename : mailnews/db/gloda/components/jsmimeemitter.js => mailnews/db/gloda/components/MimeMessageEmitter.jsm
rename : mailnews/extensions/dsn/src/dsn-service.js => mailnews/extensions/dsn/src/DSNService.jsm
rename : mailnews/extensions/mdn/src/mdn-service.js => mailnews/extensions/mdn/src/MDNService.jsm
rename : mailnews/extensions/newsblog/js/newsblog.js => mailnews/extensions/newsblog/content/NewsBlog.jsm
rename : mailnews/extensions/offline-startup/js/offlineStartup.js => mailnews/extensions/offline-startup/OfflineStartup.jsm
rename : mailnews/extensions/smime/src/smime-service.js => mailnews/extensions/smime/src/SMIMEService.jsm
rename : mailnews/import/test/unit/resources/TestMailImporter.js => mailnews/import/test/unit/resources/TestMailImporter.jsm
rename : mailnews/jsaccount/test/unit/resources/testJaMsgProtocolInfoComponent.js => mailnews/jsaccount/test/unit/resources/TestJaMsgProtocolInfoComponent.jsm
rename : mailnews/mime/src/mimeJSComponents.js => mailnews/mime/src/MimeJSComponents.jsm
rename : mailnews/news/src/nsNewsAutoCompleteSearch.js => mailnews/news/src/NewsAutoCompleteSearch.jsm
2019-11-12 13:03:00 +01:00
..
modules Bug 1577835 - Reformat mailnews/ code with eslint and Prettier. r=mkmelin 2019-08-30 22:10:02 -04:00
public Bug 1546364 - Reformat to Google coding style in mailnews/jsaccount. rs=reformat 2019-04-24 00:22:37 +02:00
src Bug 1590131 - Correct emacs mode line in C++ files. r=jorgk 2019-10-22 22:22:06 +02:00
test Bug 1562313 - Convert JavaScript components to use static registration in mailnews/. r=mkmelin 2019-11-12 13:03:00 +01:00
moz.build Bug 1562313 - Convert JavaScript components to use static registration in mailnews/. r=mkmelin 2019-11-12 13:03:00 +01:00
readme.html Bug 430716 - part 1, Use mailnews url override as initial conceptual demo of JsAccount, r=jorgk 2016-04-19 16:47:56 -07:00

readme.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>JsAccount Usage and Architecture</title>
  </head>
  <body>
    <h1>Overview</h1>
    <p>JsAccount is a technology that allows message account types to be created
      in Mozilla Mailnews code using JavaScript. Although this is primarily
      targeted at allowing extensions to create new accounts, it might also be
      useful as a bridge to convert existing account types from being C++ based
      to JavaScript based.</p>
    <h2>Existing C++-based architecture of mailnews accounts</h2>
    <p>In mailnews code, an account type is a set of classes that allow
      implementation of a messaging particular protocol. The account type is
      given a short string identifier ("imap", "news", "pop3") and is then used
      to create objects of the appropriate type by appending that string to the
      end of a base XPCOM contractID. So, for example, to create an imap server,
      you generate a contractID using a base ID,
      NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX
      "@mozilla.org/messenger/server;1?type=", then append "imap" to get:</p>
    <p>@mozilla.org/messenger/server;1?type=imap</p>
    <p>In the C++ code, there is a base object implementing shared
      functionality. An account-specific class inherits that base functionality,
      then extends it to represent the account-specific behavior that is needed.
      This same basic concept is used to represent a whole series of classes
      that are necessary to implement a specific mailnews account type.</p>
    <p>For the server example, there is a base class named
      nsMsgIncomingServer.cpp that implements that base interface
      nsIMsgIncomingServer.idl. For imap, there is a specific class
      nsImapIncomingServer.cpp that inherits from nsMsgIncomingServer.cpp,
      overrides some of the methods in nsIMsgIncomingServer.idl, and also
      implements an imap-specific interface nsIImapIncomingServer.idl. All of
      this works fine using C++ inheritance and polymorphism.</p>
    <p>Although JsAccount is intended mostly for mailnews accounts, the same
      basic method of using a base class extended for specific types is also used
      in other ways in mailnews code, including for addressbook types and views.
      The technology may also be applied to those other object types as well.</p>
    <h2>Role of JsAccount</h2>
    <p>The JavaScript class system works very differently than the C++ system,
      and you cannot use normal language constructs to override a C++ class with
      a JavaScript class. What JsAccount allows you to do is to create XPCOM
      objects in JavaScript, and use those objects to override or extend the
      methods from the C++ base class in a way that will function correctly
      whether those objects are executed from within C++ code or JavaScript
      code. This allows you to create a new account using JavaScript code, while
      using the same base class functionality that is used by the core C++
      account types. Thus a new account type may be created in JavaScript-based
      extension. The technology may also be used to create JavaScript
      versions of existing account types in an incremental manner, slowly
      converting methods from C++ to JavaScript.</p>
    <p><br>
    </p>
  </body>
</html>