MIME stream initialization failures are incorrectly reported as out of memory
Categories
(MailNews Core :: MIME, defect)
Tracking
(Not tracked)
People
(Reporter: welpy-cw, Assigned: welpy-cw)
References
Details
Attachments
(1 external file)
This is a separate follow-up to bug 2088260.
When MIME stream initialization fails, nsStreamConverter::Init() reports NS_ERROR_OUT_OF_MEMORY regardless of the underlying error. This obscures failures such as message-service lookup or message URL resolution and makes compose failures difficult to diagnose.
Bug 2088260 fixed the escaped IMAP folder lookup that triggered the original forwarding failure. The MIME error reporting issue remains independently of that fix.
Reproduction
Initialize an nsIMimeStreamConverter for nsMimeMessageDraftOrTemplate, then call nsIStreamConverter::asyncConvertData() with an nsIURI for https://example.invalid/message. There is no message service for the HTTPS scheme; no network request is needed.
Actual result: NS_ERROR_OUT_OF_MEMORY.
Expected result: preserve the message-service lookup error, NS_ERROR_FACTORY_NOT_REGISTERED.
The same loss of error information occurs when GetUrlForUri() fails or creation of the text-to-HTML converter fails.
Proposed change
- Return
nsresultand a typednsMIMESessionoutput from the draft and display stream factories. - Propagate XPCOM initialization errors through
nsStreamConverter::Init(). - Map explicit libmime
MIME_OUT_OF_MEMORYresults toNS_ERROR_OUT_OF_MEMORY, and ambiguous parser failures toNS_ERROR_FAILURE. - Release partially initialized parser objects, options, converter references, URL strings, and session storage on failure.
Validation
Extend mailnews/mime/test/unit/test_streamConverterErrors.js to cover service lookup, message URL lookup, text-converter creation, and late draft/display parser startup failures. The late failure tests also check that the draft identity and text-converter references are released. Deliberately disabling the corresponding cleanup makes those lifetime assertions fail.
The complete build and the focused MIME tests pass. Temporary native fault injection also exercised allocation-failure cleanup; that instrumentation is excluded from the patch.
| Assignee | ||
Comment 1•17 days ago
|
||
Return nsresult and typed stream outputs from the draft and display factories,
propagate startup errors, and clean up partially initialized state. Report
ambiguous parser failures without assuming memory exhaustion.
Add regression tests for message-service lookup, message URL lookup,
text-converter creation, and draft/display parser startup failures, including
release of retained references.
Follow-up to bug 2088260, which fixed escaped IMAP folder lookup. Bug 2088209
was marked as its duplicate.
Updated•17 days ago
|
| Assignee | ||
Updated•16 days ago
|
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/c035df5b9062
Preserve MIME stream initialization errors. r=mkmelin
Description
•