ABQueryUtils.sys.mjs |
This file contains helper methods for dealing with addressbook search URIs.
|
5233 |
components.conf |
|
14300 |
converterWorker.js |
eslint-env node |
17154 |
CopyMessageStreamListener.cpp |
|
2639 |
CopyMessageStreamListener.h |
|
925 |
FolderCompactor.cpp |
Helper class to compact a single folder.
Updates database and handles folder notifications, but does not deal
with the GUI (callback functions are used for that).
Uses nsIMsgPluggableStore.asyncCompact() to perform the actual compaction
while this class just coordinates things
- Deciding which messages to keep.
- Updating the message entries in the database.
It doesn't update the GUI, but it provides enough information via error
codes and the progressFn/completionFn callbacks that the caller can
handle all the GUI updates.
The approach is to make a map of all the messages we want to keep,
then use that as a whitelist when the asks us which messages to keep
(via nsIStoreCompactListener callbacks).
|
31050 |
FolderCompactor.h |
Perform compaction on the given folders.
Compaction means removing deleted messages from the msgStore and
updating the retained messages in the database with new storeTokens
(and sizes).
- Progress/status updates will be communicated to the GUI window.
- When the operation completes, listener.onStopRunningUrl() will be called.
- listener.onStartRunningUrl() is never called.
- The operation is considered complete when all the folders have been
compacted.
- It's safe to call this with an empty list of folders. The listener
will still be called.
- The listener will _never_ be called before AsyncCompactFolders()
returns.
- If AsyncCompactFolders() returns a failure code, no listener callbacks
will be invoked.
- If any errors occur, the failing folder will be rolled back to it's
previous state. Successfully compacted folders will stay compacted.
This routine DOES NOT perform an expunge for IMAP folders, or attempt to
rebuild missing/out-of-date databases for local folders.
Previous compaction code did attempt to handle this, but it was
inconsistent and got very confusing. The folder-specific implementations
(e.g. nsImapMailFolder::Compact()) deal with that stuff _before_ calling
AsyncCompactFolders().
@param folders - The folders to compact.
@param listener - Callback to invoke when operation is complete.
The request param will be nullptr, and the status param
indicates the success or failure of the operation.
|
2315 |
FolderLookupService.sys.mjs |
This module implements the folder lookup service (nsIFolderLookupService).
|
4879 |
FolderUtils.sys.mjs |
This file contains helper methods for dealing with nsIMsgFolders.
|
9515 |
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.
|
10823 |
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/ |
4272 |
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.
|
6591 |
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
|
3172 |
MailAuthenticator.sys.mjs |
A base class for interfaces when authenticating a mail connection.
|
11578 |
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 |
|
2827 |
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 |
|
1445 |
MailnewsLoadContextInfo.h |
|
841 |
MailNotificationManager.sys.mjs |
A module that listens to folder change events, and show notifications for new
mails if necessary.
|
15263 |
MailNotificationService.sys.mjs |
Platform-independent code to count new and unread messages and pass the
information to platform-specific notification modules.
|
10700 |
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}
|
4056 |
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.
|
11278 |
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...
|
30933 |
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.
|
4356 |
MboxMsgOutputStream.cpp |
|
12533 |
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
|
4196 |
moz.build |
|
4124 |
MsgAsyncPrompter.sys.mjs |
|
17447 |
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.
|
36008 |
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
|
3440 |
MsgProtocolInfo.sys.mjs |
@see {nsIMsgProtocolInfo}
|
1663 |
nsCidProtocolHandler.cpp |
|
1719 |
nsCidProtocolHandler.h |
nsCidProtocolHandler_h__ |
756 |
nsImapMoveCoalescer.cpp |
= false |
6632 |
nsImapMoveCoalescer.h |
|
2528 |
nsMailAuthModule.cpp |
A simple wrap of CreateInstance and Init of nsIAuthModule.
|
2780 |
nsMailAuthModule.h |
nsMailAuthModule_h__ |
690 |
nsMailChannel.cpp |
|
4431 |
nsMailChannel.h |
nsMailChannel_h__ |
888 |
nsMailDirProvider.cpp |
|
4846 |
nsMailDirProvider.h |
|
1178 |
nsMailDirServiceDefs.h |
|
1197 |
nsMessenger.cpp |
for access to docshell |
87125 |
nsMessenger.h |
rhp - need this to drive message display |
4168 |
nsMessengerBootstrap.cpp |
|
2994 |
nsMessengerBootstrap.h |
4a85a5d0-cddd-11d2-b7f6-00805f05ffa5 |
893 |
nsMessengerOSXIntegration.h |
|
696 |
nsMessengerOSXIntegration.mm |
|
1843 |
nsMessengerUnixIntegration.h |
|
658 |
nsMessengerWinIntegration.cpp |
cbSize |
12551 |
nsMessengerWinIntegration.h |
|
1131 |
nsMsgAccount.cpp |
|
11840 |
nsMsgAccount.h |
|
928 |
nsMsgAccountManager.cpp |
The account manager service - manages all accounts, servers, and identities
|
123527 |
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.
|
7094 |
nsMsgBiffManager.cpp |
|
11356 |
nsMsgBiffManager.h |
|
1407 |
nsMsgCompressIStream.cpp |
void close (); |
6582 |
nsMsgCompressIStream.h |
|
853 |
nsMsgCompressOStream.cpp |
void close (); |
3976 |
nsMsgCompressOStream.h |
|
660 |
nsMsgContentPolicy.cpp |
@returns true if the sender referenced by aMsgHdr is explicitly allowed to
load remote images according to the PermissionManager
|
33272 |
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.
**************************************************************************** |
3664 |
nsMsgCopyService.cpp |
|
21032 |
nsMsgCopyService.h |
|
2777 |
nsMsgDBFolder.cpp |
mozilla::intl APIs require sizeable buffers. This class abstracts over
the nsTArray.
|
186291 |
nsMsgDBFolder.h |
nsMsgDBFolder
Class derived from nsIMsgFolder for those folders that use an nsIMsgDatabase.
|
13290 |
nsMsgDBView.cpp |
|
234620 |
nsMsgDBView.h |
|
24562 |
nsMsgEnumerator.cpp |
Internal class to support iteration over nsBaseMsgEnumerator in javascript.
|
3859 |
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.
|
1380 |
nsMsgFileStream.cpp |
From nsDebugImpl.cpp: |
5628 |
nsMsgFileStream.h |
|
1011 |
nsMsgFolderCache.cpp |
nsMsgFolderCacheElement
Folders are given this to let them manipulate their cache data.
|
19511 |
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.
|
1986 |
nsMsgFolderNotificationService.cpp |
destructor code |
6438 |
nsMsgFolderNotificationService.h |
|
1461 |
nsMsgGroupThread.cpp |
|
15684 |
nsMsgGroupThread.h |
|
3562 |
nsMsgGroupView.cpp |
|
36328 |
nsMsgGroupView.h |
ensureListed |
3589 |
nsMsgI18N.cpp |
|
12420 |
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.
|
5224 |
nsMsgIdentity.cpp |
accessors for pulling values directly out of preferences
instead of member variables, etc
|
23120 |
nsMsgIdentity.h |
nsMsgIdentity_h___ |
3764 |
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).
|
68483 |
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.
|
3093 |
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. |
30369 |
nsMsgKeySet.h |
MSG_NewsHost* host = NULL |
3013 |
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).
|
5044 |
nsMsgMailNewsUrl.cpp |
|
35175 |
nsMsgMailNewsUrl.h |
nsMsgMailNewsUrl_h___ |
4898 |
nsMsgMailSession.cpp |
|
23035 |
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__ |
3702 |
nsMsgOfflineManager.cpp |
The offline manager service - manages going online and offline, and
synchronization
|
11670 |
nsMsgOfflineManager.h |
nsIMsgOfflineManager methods |
2275 |
nsMsgProgress.cpp |
|
8767 |
nsMsgProgress.h |
|
1243 |
nsMsgProtocol.cpp |
|
26931 |
nsMsgProtocol.h |
|
5945 |
nsMsgPurgeService.cpp |
|
19824 |
nsMsgPurgeService.h |
|
1478 |
nsMsgQuickSearchDBView.cpp |
|
30146 |
nsMsgQuickSearchDBView.h |
|
4972 |
nsMsgReadStateTxn.cpp |
|
1344 |
nsMsgReadStateTxn.h |
121FCE4A-3EA1-455C-8161-839E1557D0CF |
1446 |
nsMsgSearchDBView.cpp |
|
51401 |
nsMsgSearchDBView.h |
|
8684 |
nsMsgSpecialViews.cpp |
|
5546 |
nsMsgSpecialViews.h |
DOING_CACHELESS_VIEW |
3222 |
nsMsgStatusFeedback.cpp |
|
9566 |
nsMsgStatusFeedback.h |
|
1387 |
nsMsgTagService.cpp |
readonly attribute ACString key; |
15150 |
nsMsgTagService.h |
|
1241 |
nsMsgThreadedDBView.cpp |
member initializers and constructor code |
31815 |
nsMsgThreadedDBView.h |
|
2878 |
nsMsgTxn.cpp |
none of the callers pass null aFolder,
we always initialize aResult (before we pass in) for the case where the key is
not in the db |
2881 |
nsMsgTxn.h |
da621b30-1efc-11d3-abe4-00805f8ac968 |
1961 |
nsMsgUtils.cpp |
for logging to Error Console |
62787 |
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?
|
16625 |
nsMsgWindow.cpp |
|
10265 |
nsMsgWindow.h |
|
1609 |
nsMsgXFViewThread.cpp |
|
14838 |
nsMsgXFViewThread.h |
|
1598 |
nsMsgXFVirtualFolderDBView.cpp |
ensureListed |
17272 |
nsMsgXFVirtualFolderDBView.h |
|
2836 |
nsNewMailnewsURI.cpp |
= nullptr |
6258 |
nsNewMailnewsURI.h |
= nullptr |
661 |
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.
|
2563 |
nsSpamSettings.cpp |
|
27241 |
nsSpamSettings.h |
nsSpamSettings_h__ |
2013 |
nsStatusBarBiffManager.cpp |
|
8052 |
nsStatusBarBiffManager.h |
|
956 |
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.
|
4745 |
nsStopwatch.h |
|
1256 |
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.
|
23624 |
nsSubscribableServer.h |
|
2004 |
nsUserInfo.h |
__nsUserInfo_h |
541 |
nsUserInfoMac.mm |
|
2008 |
nsUserInfoUnix.cpp |
|
3020 |
nsUserInfoWin.cpp |
|
2472 |
OAuth2.sys.mjs |
Provides OAuth 2.0 authentication.
@see RFC 6749
|
14565 |
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.
|
9383 |
OAuth2Providers.sys.mjs |
Details of supported OAuth2 Providers.
|
12140 |
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 |