Closed Bug 517919 Opened 15 years ago Closed 12 years ago

addOverrideStylesheet can throw an exception when passed in a URL that doesn't exist

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: davida, Unassigned)

Details

In mail/components/compose/content/MsgComposeCommands.js, we've found that calling addOverrideStyleSheet() _sometimes_ throws an NS_ERROR_INVALID_POINTER exception, if the URL passed in doesn't exist (in Thunderbird's case, pinstripe doesn't have a messageQuotes.css these days).

We're catching that exception and dealing with it for now, but the current behavior doesn't seem right -- at the very least the exception should be better chosen.
see Bug 516322 for the bug that led to this one.
Based on a conversation with andreasn, the particular stylesheet in question either could to be added to all the other themes, or the contents could be moved to some other .css file to serve the same purpose.
(In reply to David Ascher (:davida) from comment #0)
> In mail/components/compose/content/MsgComposeCommands.js, we've found that
> calling addOverrideStyleSheet() _sometimes_ throws an
> NS_ERROR_INVALID_POINTER exception, if the URL passed in doesn't exist (in
> Thunderbird's case, pinstripe doesn't have a messageQuotes.css these days).

I don't think that we want the API to silently accept invalid parameters.  It is the responsibility of the caller to perform the required error checking.

This is the code in question: <http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/html/nsHTMLEditor.cpp#3262>  The error is returned when we fail to retrieve the stylesheet.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.