Name Description Size
ABQueryUtils.sys.mjs This file contains helper methods for dealing with addressbook search URIs. 5233
components.conf 14400
converterWorker.js eslint-env mozilla/chrome-worker, node 17177
FolderLookupService.sys.mjs This module implements the folder lookup service (nsIFolderLookupService). 4879
FolderUtils.sys.mjs This file contains helper methods for dealing with nsIMsgFolders. 10478
HeaderReader.h HeaderReader parses mail headers from a buffer. The input is fed in via Parse(), and a callback function is invoked for each header encountered. General goals: - Incremental. Parse() can be called multiple times as a buffer grows. - Works in-place. Headers are returned as byte ranges within the data. - Works with a partial header block (e.g. sniffing the first N bytes of a message file). It won't mistakenly emit an incomplete header. - Track exact byte offsets for values, to support rewriting headers in place. This is needed to support X-Mozilla-Status et al. - Avoids copying data where possible. - Callback is inlined. - Callback can halt processing (by returning false). - Tolerant of real-world oddness in input data (for now, we just skip lines which don't make sense). Example usage: nsCString raw = "To: Alice\r\nFrom: Bob\r\n\r\n...Message body..."_ns; auto cb = [&](HeaderReader::Hdr const& hdr) { printf("-> '%s':'%s'\n", hdr.Name(raw).get(), hdr.Value(raw).get()); return true; }; HeaderReader rdr; rdr.Parse(raw, cb); // -> 'To':'Alice' // -> 'From':'Bob' See TestHeaderReader.cpp for more examples. 10846
hostnameUtils.sys.mjs Generic shared utility code for checking of IP and hostname validity. 11735
JXON.sys.mjs Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 4376
LineReader.h FirstLine() returns the first complete line in a span. The EOL sequence (CRLF or LF) is included in the returned line. If no EOL is found, an empty span is returned. 6569
LineReader.sys.mjs For certain requests, mail servers return a multi-line response that are handled by this class. The definitions of multi-line responses can be found for NNTP at https://datatracker.ietf.org/doc/html/rfc3977#section-3.1.1 and for POP3 at https://datatracker.ietf.org/doc/html/rfc1939#section-3 This class deals with multi-line responses by: - Receiving each response segment and appending them all together. - Detecting the end of the response by seeing "\r\n.\r\n" in the last segment - Breaking up a response into lines - Removing a possible stuffed dot (.. at the beginning of a line) - Passing each line to a processing function, lineCallback. - Calling a finalization function, doneCallback, when all lines are processed 3085
MailAuthenticator.sys.mjs A base class for interfaces when authenticating a mail connection. 11523
MailChannel.sys.mjs A class that email-streaming channels can use to provide access to parsed message headers, message attachment info, and other metadata. The intended use is by QIing nsIChannel to nsIMailChannel. @implements {nsIMailChannel} 4193
MailCryptoUtils.sys.mjs Converts a binary string into a Uint8Array. @param {BinaryString} str - The string to convert. @returns {Uint8Array}. 2055
MailNewsDLF.cpp 2858
MailNewsDLF.h This factory is a thin wrapper around the text/html loader factory. All it does is convert message/rfc822 to text/html and delegate the rest of the work to the text/html factory. 1014
MailnewsLoadContextInfo.cpp 1499
MailnewsLoadContextInfo.h 841
MailnewsMigrator.sys.mjs Migrate profile (prefs and other files) from older versions of Mailnews to current. This should be run at startup. It migrates as needed: each migration function should be written to be a no-op when the value is already migrated or was never used in the old version. 2436
MailNotificationManager.sys.mjs A module that listens to folder change events, and show notifications for new mails if necessary. 14442
MailNotificationService.sys.mjs Platform-independent code to count new and unread messages and pass the information to platform-specific notification modules. 10628
MailServices.sys.mjs Gets the `nsIMsgMessageService` for a given message URI. This should have the same behaviour as `GetMessageServiceFromURI` (nsMsgUtils.cpp). @param {string} uri - The URI of a folder or message. @returns {nsIMsgMessageService} 3687
mailstoreConverter.sys.mjs Sets a server to use a different type of mailstore, converting all the existing data. @param {string} aMailstoreContractId - XPCOM id of new mailstore type. @param {nsIMsgServer} aServer - server to migrate. @param {?Element} aEventTarget - If set, element to send progress events. @returns {Promise<string>} - Resolves with a string containing the new root directory for the migrated server. Rejects with an error message. 11270
MailStringUtils.sys.mjs Convert a ByteString to a Uint8Array. @param {ByteString} str - The input string. @returns {Uint8Array} The output Uint8Array. 2966
MboxMsgInputStream.cpp MboxParser is a helper class to manage parsing messages out of an mbox byte stream. Call Feed() to pass data into the parser, in chunks of at least MinChunk size. Pass in a chunk less than MinChunk size to indicate EOF of the mbox file (a zero-size chunk is fine). The resulting message is written to a growable output buffer and accessed via Drain(). Use Available() to see how many bytes are ready to drain. When a complete message has been parsed, parsing will halt, and further calls to Feed() will consume no more data. However, the message is not considered 'finished' until it has been completely read from the output buffer (via Drain()). At this point, IsFinished() will return true. To continue with the next message, you can then call Kick() to resume the parsing. AtEOF() will return true when all messages have been parsed (and drained). Goals: - Assume well formed mboxrd format, but try to handle other variants and don't freak out when malformed data is encountered. - Don't choke on invalid messages. Just treat mbox as a container format and aim to return messages as accurately as possible, even if malformed. - Avoid copying and memory reallocation as much as possible. - Cope with pathological cases without buffering up huge quantities of data. eg "From " followed by gigabytes of non-EOL characters. Output buffer size is kept down to roughly what you pass in with a single call to Feed(). Note: It'd be nice to ditch the output buffer and the extra copy involved, but that'd require the caller passing in an output buffer, and the parser would have to break off parsing when that buffer is full. It could be done, but the extra complexity probably isn't worth it... 25406
MboxMsgInputStream.h MboxMsgInputStream reads messages from an underlying mbox stream. Messages will be read in sequence beginning at the position of the underlying stream, returning EOF at the end of each message. Subsequent messages can be read by calling `Continue()`. Escaped ">From " lines in the body of the message will be silently unescaped. The caller should never need to deal with (or be aware of) escaping. The underlying stream is expected to be pre-positioned at the beginning of the "From " line indicating a new message. MboxMsgInputStream should be regarded as taking ownership of the underlying stream: when the MboxMsgInputStream is closed, the underlying stream is also closed. 3406
MboxMsgOutputStream.cpp 10597
MboxMsgOutputStream.h MboxMsgOutputStream writes a single message out to an underlying mbox stream. It's a nsISafeOutputStream so callers need to "commit" the written data by calling nsISafeOutputStream::Finish() when done. Just calling Close(), or letting the stream go out of scope will cause a rollback, and the underlying mbox file will be truncated back to the size it was. Aims: - Byte exact. What you write is exactly what should come back out when read. NOTE: There is one exception. Messages with an unterminated final line will have an EOL added. Without this, there's no way to ensure the proper message separation required for a well-formed mbox. - Handles malformed messages - everything is just stored verbatim. - Uses reversible "From " escaping, as per mboxrd. "From " lines are prefixed with '>'. If already prefixed, another '>' is added. e.g. "From Bob Smith" => ">From Bob Smith". ">>>>From here..." => ">>>>>From here..." - Avoid intermediate copies of data. The only time buffering is required is where "From " parts are split across Write() calls. - Handle processing lines of any length, without extra memory usage. - Leaves output buffering up to the target mbox stream. - Provide a reasonable rollback mechanism (as nsISafeOutputStream). mboxrd descriptions: https://www.loc.gov/preservation/digital/formats/fdd/fdd000385.shtml https://doc.dovecot.org/admin_manual/mailbox_formats/mbox/#mbox-variants 3768
moz.build 4145
MsgAsyncPrompter.sys.mjs 17477
MsgDBCacheManager.sys.mjs Message DB Cache manager 5249
MsgIncomingServer.sys.mjs When hostname/username changes, update the corresponding entry in nsILoginManager. @param {string} localStoreType - The store type of the current server. @param {string} oldHostname - The hostname before the change. @param {string} oldUsername - The username before the change. @param {string} newHostname - The hostname after the change. @param {string} newUsername - The username after the change. 36032
MsgKeySet.sys.mjs A structure to represent a set of articles. This is usually for lines from the newsrc, which have article lists like 1-29627,29635,29658,32861-32863 so the data has these properties: - strictly increasing - large subsequences of monotonically increasing ranges - gaps in the set are usually small, but not always - consecutive ranges tend to be large 3419
MsgProtocolInfo.sys.mjs @see {nsIMsgProtocolInfo} 1655
nsCidProtocolHandler.cpp 1778
nsCidProtocolHandler.h nsCidProtocolHandler_h__ 778
nsCopyMessageStreamListener.cpp request 3913
nsCopyMessageStreamListener.h 916
nsImapMoveCoalescer.cpp = false 6746
nsImapMoveCoalescer.h 2555
nsMailAuthModule.cpp A simple wrap of CreateInstance and Init of nsIAuthModule. 2780
nsMailAuthModule.h nsMailAuthModule_h__ 690
nsMailChannel.cpp 4431
nsMailChannel.h nsMailChannel_h__ 889
nsMailDirProvider.cpp 4901
nsMailDirProvider.h 1200
nsMailDirServiceDefs.h 1197
nsMessenger.cpp for access to docshell 87497
nsMessenger.h rhp - need this to drive message display 4188
nsMessengerBootstrap.cpp 2994
nsMessengerBootstrap.h 4a85a5d0-cddd-11d2-b7f6-00805f05ffa5 899
nsMessengerOSXIntegration.h 696
nsMessengerOSXIntegration.mm 1772
nsMessengerUnixIntegration.cpp This is only a placeholder for now, register it in components.conf later if needed. 832
nsMessengerUnixIntegration.h 673
nsMessengerWinIntegration.cpp cbSize 12456
nsMessengerWinIntegration.h 1160
nsMsgAccount.cpp 11963
nsMsgAccount.h 928
nsMsgAccountManager.cpp The account manager service - manages all accounts, servers, and identities 123589
nsMsgAccountManager.h Posts an event to update the summary totals and commit the db. We post the event to avoid committing each time we're called in a synchronous loop. 7477
nsMsgBiffManager.cpp 11685
nsMsgBiffManager.h 1428
nsMsgCompressIStream.cpp void close (); 6582
nsMsgCompressIStream.h 874
nsMsgCompressOStream.cpp void close (); 3976
nsMsgCompressOStream.h 681
nsMsgContentPolicy.cpp @returns true if the sender referenced by aMsgHdr is explicitly allowed to load remote images according to the PermissionManager 33880
nsMsgContentPolicy.h nsMsgContentPolicy enforces the specified content policy on images, js, plugins, etc. This is the class used to determine what elements in a message should be loaded. nsMsgCookiePolicy enforces our cookie policy for mail and RSS messages. **************************************************************************** 3824
nsMsgCopyService.cpp 21069
nsMsgCopyService.h 2777
nsMsgDBFolder.cpp mozilla::intl APIs require sizeable buffers. This class abstracts over the nsTArray. 185782
nsMsgDBFolder.h nsMsgDBFolder Class derived from nsIMsgFolder for those folders that use an nsIMsgDatabase. 13459
nsMsgDBView.cpp 246163
nsMsgDBView.h 25272
nsMsgEnumerator.cpp Internal class to support iteration over nsBaseMsgEnumerator in javascript. 3897
nsMsgEnumerator.h A base implementation nsIMsgEnumerator for stepping over an ordered set of nsIMsgDBHdr objects. This provides the javascript iterable protocol (to support for...of constructs), but getNext() and hasMoreElements() must be implemented by derived classes. 1376
nsMsgFileStream.cpp From nsDebugImpl.cpp: 5628
nsMsgFileStream.h 1064
nsMsgFolderCache.cpp nsMsgFolderCacheElement Folders are given this to let them manipulate their cache data. 18944
nsMsgFolderCache.h nsMsgFolderCache implements the folder cache, which stores values which might be slow for the folder to calculate. It persists the cache data by dumping it out to a .json file when changes are made. To avoid huge numbers of writes, this autosaving is deferred - when a cached value is changed, it'll wait a minute or so before writing, to collect any other changes that occur during that time. If any changes are outstanding at destruction time, it'll perform an immediate save then. 1975
nsMsgFolderCompactor.cpp nsFolderCompactState is a helper class for nsFolderCompactor, which handles compacting the mbox for a single local folder. This class also patches X-Mozilla-* headers where required. Usually these headers are edited in-place without changing the overall size, but sometimes there's not enough room. So as compaction involves rewriting the whole file anyway, we take the opportunity to make some more space and correct those headers. NOTE (for future cleanups): This base class calls nsIMsgMessageService.copyMessages() to iterate through messages, passing itself in as a listener. Callbacks from both nsICopyMessageStreamListener and nsIStreamListener are invoked. nsOfflineStoreCompactState uses a different mechanism - see separate notes below. The way the service invokes the listener callbacks is pretty quirky and probably needs a good sorting out, but for now I'll just document what I've observed here: - The service calls OnStartRequest() at the start of the first message. - StartMessage() is called at the start of subsequent messages. - EndCopy() is called at the end of every message except the last one, where OnStopRequest() is invoked instead. - OnDataAvailable() is called to pass the message body of each message (in multiple calls if the message is big enough). - EndCopy() doesn't ever seem to be passed a failing error code from what I can see, and its own return code is ignored by upstream code. 48652
nsMsgFolderCompactor.h nsMsgFolderCompactor implements nsIMsgFolderCompactor, which allows the caller to kick off a batch of folder compactions (via compactFolders()). 1487
nsMsgFolderNotificationService.cpp destructor code 6438
nsMsgFolderNotificationService.h 1461
nsMsgGroupThread.cpp 15716
nsMsgGroupThread.h 3621
nsMsgGroupView.cpp 35302
nsMsgGroupView.h ensureListed 3621
nsMsgI18N.cpp 12557
nsMsgI18N.h Encode an input string into RFC 2047 form. @param header [IN] A header to encode. @param structured [IN] Specify the header is structured or non-structured field (See RFC-822). @param charset [IN] Charset name to convert. @param fieldnamelen [IN] Header field name length. (e.g. "From: " -> 6) @param usemime [IN] If false then apply charset conversion only no MIME encoding. @return Encoded buffer (in C string) or NULL in case of error. 5579
nsMsgIdentity.cpp accessors for pulling values directly out of preferences instead of member variables, etc 23010
nsMsgIdentity.h nsMsgIdentity_h___ 3785
nsMsgIncomingServer.cpp Observe() receives notifications for all accounts, not just this server's account. So we ignore all notifications not intended for this server. When the state of the password manager changes we need to clear the this server's password from the cache in case the user just changed or removed the password or username. Oauth2 servers often automatically change the password manager's stored password (the token). 68711
nsMsgIncomingServer.h base class for nsIMsgIncomingServer - derive your class from here if you want to get some free implementation this particular implementation is not meant to be used directly. 3071
nsMsgKeySet.cpp A compressed encoding for sets of article. This is usually for lines from the newsrc, which have article lists like 1-29627,29635,29658,32861-32863 so the data has these properties: - strictly increasing - large subsequences of monotonically increasing ranges - gaps in the set are usually small, but not always - consecutive ranges tend to be large The biggest win is to run-length encode the data, storing ranges as two numbers (start+length or start,end). We could also store each number as a delta from the previous number for further compression, but that gets kind of tricky, since there are no guarantees about the sizes of the gaps, and we'd have to store variable-length words. Current data format: DATA := SIZE [ CHUNK ]* CHUNK := [ RANGE | VALUE ] RANGE := -LENGTH START START := VALUE LENGTH := int32_t VALUE := a literal positive integer, for now it could also be an offset from the previous value. LENGTH could also perhaps be a less-than-32-bit quantity, at least most of the time. Lengths of CHUNKs are stored negative to distinguish the beginning of a chunk from a literal: negative means two-word sequence, positive means one-word sequence. 0 represents a literal 0, but should not occur, and should never occur except in the first position. A length of -1 won't occur either, except temporarily - a sequence of two elements is represented as two literals, since they take up the same space. Another optimization we make is to notice that we typically ask the question ``is N a member of the set'' for increasing values of N. So the set holds a cache of the last value asked for, and can simply resume the search from there. 37135
nsMsgKeySet.h MSG_NewsHost* host = NULL 3670
nsMsgLineBuffer.cpp always grow by a minimum of N bytes 12783
nsMsgLineBuffer.h nsMsgLineBuffer breaks up incoming data into lines. It accepts CRLF, CR or LF line endings. Data is fed in via BufferInput(). The virtual HandleLine() will be invoked for each line. The data passed to HandleLine() is verbatim, and will include whatever line endings were in the source data. Flush() should be called when the data is exhausted, to handle any leftover bytes in the buffer (e.g. if the data doesn't end with an EOL). 5020
nsMsgMailNewsUrl.cpp 35455
nsMsgMailNewsUrl.h 5056
nsMsgMailSession.cpp 23448
nsMsgMailSession.h / class nsMsgShutdownService : public nsIMsgShutdownService, public nsIUrlListener, public nsIObserver { public: nsMsgShutdownService(); NS_DECL_ISUPPORTS NS_DECL_NSIMSGSHUTDOWNSERVICE NS_DECL_NSIURLLISTENER NS_DECL_NSIOBSERVER protected: nsresult ProcessNextTask(); void AttemptShutdown(); private: virtual ~nsMsgShutdownService(); nsCOMArray<nsIMsgShutdownTask> mShutdownTasks; nsCOMPtr<nsIMsgProgress> mMsgProgress; uint32_t mTaskIndex; uint32_t mQuitMode; bool mProcessedShutdown; bool mQuitForced; bool mReadyToQuit; }; #endif /* nsMsgMailSession_h__ 3736
nsMsgOfflineManager.cpp The offline manager service - manages going online and offline, and synchronization 11705
nsMsgOfflineManager.h nsIMsgOfflineManager methods 2275
nsMsgProgress.cpp 8916
nsMsgProgress.h 1294
nsMsgProtocol.cpp 28189
nsMsgProtocol.h 6234
nsMsgPurgeService.cpp 19886
nsMsgPurgeService.h 1478
nsMsgQuickSearchDBView.cpp 30143
nsMsgQuickSearchDBView.h 5004
nsMsgReadStateTxn.cpp 1392
nsMsgReadStateTxn.h 121FCE4A-3EA1-455C-8161-839E1557D0CF 1491
nsMsgSearchDBView.cpp 49488
nsMsgSearchDBView.h 8690
nsMsgSpecialViews.cpp 5546
nsMsgSpecialViews.h DOING_CACHELESS_VIEW 3254
nsMsgStatusFeedback.cpp 9595
nsMsgStatusFeedback.h 1434
nsMsgTagService.cpp readonly attribute ACString key; 15315
nsMsgTagService.h 1241
nsMsgThreadedDBView.cpp member initializers and constructor code 32122
nsMsgThreadedDBView.h 2910
nsMsgTxn.cpp 8526
nsMsgTxn.h da621b30-1efc-11d3-abe4-00805f8ac968 2257
nsMsgUtils.cpp for logging to Error Console 64026
nsMsgUtils.h given a folder uri, return the path to folder in the user profile directory. @param aFolderURI uri of folder we want the path to, without the scheme @param[out] aPathString result path string @param aScheme scheme of the uri @param[optional] aIsNewsFolder is this a news folder? 18902
nsMsgWindow.cpp 10570
nsMsgWindow.h 1607
nsMsgXFViewThread.cpp 14853
nsMsgXFViewThread.h 1650
nsMsgXFVirtualFolderDBView.cpp ensureListed 17721
nsMsgXFVirtualFolderDBView.h 2979
nsNewMailnewsURI.cpp = nullptr 5980
nsNewMailnewsURI.h = nullptr 590
nsQuarantinedOutputStream.cpp 6868
nsQuarantinedOutputStream.h nsQuarantinedOutputStream layers on top of an existing target output stream. The idea is to let an OS virus checker quarantine individual messages _before_ they hit the mbox. You don't want entire mboxes embargoed if you can avoid it. It works by buffering all writes to a temporary file. When finish() is called the temporary file is closed, reopened, then copied into a pre-existing target stream. There's no special OS virus-checker integration - the assumption is that the checker will hook into the filesystem and prevent us from opening a file it has flagged as dodgy. Hence the temp file close/reopen before the final write. If the nsQuarantinedOutputStream is closed (or released) without calling finish(), the write is discarded (as per nsISafeOutputStream requirements). Upon close() or finish(), the underlying target file is also closed. 2590
nsSpamSettings.cpp 27199
nsSpamSettings.h nsSpamSettings_h__ 2013
nsStatusBarBiffManager.cpp 8160
nsStatusBarBiffManager.h 977
nsStopwatch.cpp This basis for the logic in this file comes from (will used to come from): (mozilla/)modules/libutil/public/stopwatch.cpp. It was no longer used in the mozilla tree, and is being migrated to comm-central where we actually have a need for it. ("Being" in the sense that it will not be removed immediately from mozilla-central.) Simplification and general clean-up has been performed and the fix for bug 96669 has been integrated. 4767
nsStopwatch.h 1449
nsSubscribableServer.cpp The basic structure for the tree of the implementation. These elements are stored in reverse alphabetical order. Each node owns its children and subsequent siblings. 23690
nsSubscribableServer.h 2004
nsUserInfo.h __nsUserInfo_h 541
nsUserInfoMac.mm 2027
nsUserInfoUnix.cpp 3054
nsUserInfoWin.cpp 2583
OAuth2.sys.mjs Provides OAuth 2.0 authentication. @see RFC 6749 12435
OAuth2Module.sys.mjs A collection of `OAuth2` objects that have previously been created. Only weak references are stored here, so if all the owners of an `OAuth2` is cleaned up, so is the object itself. 8954
OAuth2Providers.sys.mjs Details of supported OAuth2 Providers. 9482
TemplateUtils.sys.mjs Helper function to generate a localized "friendly" representation of time relative to the present. If the time input is "today", it returns a string corresponding to just the time. If it's yesterday, it returns "yesterday" (localized). If it's in the last week, it returns the day of the week. If it's before that, it returns the date. @param {Date} time - The time (better be in the past!) @returns {string} A "human-friendly" representation of that time relative to now. 3046
UrlListener.cpp 641
UrlListener.h UrlListener is a small nsIUrlListener implementation which allows callable objects (including lambdas) to be plugged in instead of deriving your own nsIUrlListener. The aim is to encourage more readable code by allowing the start/stop notifications of a long-running operation to be handled near to where the operation was initiated. A contrived example: void Kick() { UrlListener* listener = new UrlListener; listener->mStopFn = [](nsIURI* url, nsresult status) -> nsresult { // Note that we may get here waaaaaaay after Kick() has returned... printf("LongRunningOperation is finished.\n"); return NS_OK; }; thingService.startLongRunningOperation(listener); //...continue doing other stuff while operation is ongoing... } Traditionally, c-c code has tended to use multiple inheritance to add listener callbacks to the class of the object initiating the operation. This has a couple of undesirable side effects: 1) It separates out the onStopRunningUrl handling into some other part of the code, which makes the order of things much harder to follow. 2) Often the same onStopRunningUrl handler will be used for many different kinds of operations (see nsImapMailFolder::OnStopRunningUrl(), for example). 3) It exposes implementation details as part of the public interface e.g see all the listener types nsMsgDBFolder derives from to implement it's internals. That's all just confusing noise that shouldn't be seen from outside the class. Just as PromiseTestUtils.sys.mjs brings the Javascript side up from callback hell to async lovelyness, this can be used to raise the C++ side from callback-somewhere-else-maybe-in-this-class-but-who-can-really-tell hell up to normal callback hell :-) 2734
VirtualFolderWrapper.sys.mjs Wrap everything about virtual folders. 10030
WinUnreadBadge.sys.mjs Get an imgIContainer instance from a canvas element. @param {HTMLCanvasElement} canvas - The canvas element. @param {number} width - The width of the canvas to use. @param {number} height - The height of the canvas to use. @returns {imgIContainer} 7490