[DOGFOOD] [BLOCKER] Crashes/bad behavior when trying to use InsertAsQuotation() Calls

VERIFIED FIXED in M11

Status

()

Core
Editor
P3
minor
VERIFIED FIXED
19 years ago
17 years ago

People

(Reporter: rhp (gone), Assigned: rhp (gone))

Tracking

Trunk
x86
Windows NT
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [PDT+])

Attachments

(1 attachment)

(Assignee)

Description

19 years ago
Mail/news is trying to use the InsertAsQuotation() calls when replying to a
message and quoting the contents of the original message. The behavior is
different for Plain text and HTML instances of the editor.

In both cases, the first thing we do is load the url about:blank. This allows
us to have an editor that is initialized to the point we can make these calls.

For plain text:

 - The plain text is inserted correctly, but when a character is typed into the
editor window, the contents that were inserted dissapear

For HTML:

 - The InsertAsQuotation() crashes with the "doc" being NULL at line 642 of
nsDocLoader.cpp. The stack trace looks as follows:

nsDocLoaderImpl::GetContentViewerContainer(nsDocLoaderImpl * const 0x017047d0,
unsigned int 1242456, nsIContentViewerContainer * * 0x0012e5e0) line 642 + 5
bytes
nsObserverBase::NotifyWebShell(nsObserverBase * const 0x01705b48, unsigned int
1242456, const char * 0x0478a7f0, nsCharsetSource kCharsetFromMetaTag, const
char * 0x0012ea88) line 50 + 20 bytes
nsMetaCharsetObserver::Notify(nsMetaCharsetObserver * const 0x01705b40,
unsigned int 1242456, unsigned int 5, const unsigned short * * 0x0012ee68,
const unsigned short * * 0x0012ef30) line 275 + 49 bytes
nsMetaCharsetObserver::Notify(nsMetaCharsetObserver * const 0x01705b40,
unsigned int 1242456, const unsigned short * 0x0012ede8, unsigned int 5, const
unsigned short * * 0x0012ee68, const unsigned short * * 0x0012ef30) line 155
nsObserverNotifier::operator()(void * 0x01705b40) line 281 + 47 bytes
nsDeque::FirstThat(nsDequeFunctor & {...}) line 344 + 14 bytes
CObserverService::Notify(nsHTMLTag eHTMLTag_meta, nsIParserNode & {...},
unsigned int 1242456, const char * 0x021e10b0, nsAutoString & {"ISO-8859-1"},
nsCharsetSource & kCharsetUninitialized) line 832
CNavDTD::WillHandleStartTag(CToken * 0x0254c070, nsHTMLTag eHTMLTag_meta,
nsCParserNode & {...}) line 1042 + 36 bytes
CNavDTD::HandleStartToken(CToken * 0x0254c070) line 1214 + 20 bytes
CNavDTD::HandleToken(CNavDTD * const 0x04780940, CToken * 0x0254c070, nsIParser
* 0x047820d0) line 655 + 12 bytes
CNavDTD::BuildModel(CNavDTD * const 0x04780940, nsIParser * 0x047820d0,
nsITokenizer * 0x04780310, nsITokenObserver * 0x00000000, nsIContentSink *
0x04783e60) line 459 + 20 bytes
nsParser::BuildModel() line 1038 + 34 bytes
nsParser::ResumeParse(nsIDTD * 0x00000000, int 0) line 949 + 11 bytes
nsParser::Parse(const nsString & {""}, void * 0x0012f558, const nsString &
{"text/html"}, int 0, int 1, eParseMode eParseMode_autodetect) line 829 + 15
bytes
nsParser::ParseFragment(const nsString & {"<br><br>Rich Pizzarro
wrote:<br><BLOCKQUOTE TYPE=CITE><html><META HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=UTF-8""}, void * 0x00000000, nsITagStack & {...},
unsigned int 0, const nsString & {"text/html"}, eParseMode
eParseMode_autodetect) line 919 + 41 bytes
nsRange::CreateContextualFragment(nsRange * const 0x04782cf4, const nsString &
{"<br><br>Rich Pizzarro wrote:<br><BLOCKQUOTE TYPE=CITE><html><META
HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8""},
nsIDOMDocumentFragment * * 0x0012f864) line 1841 + 52 bytes
nsHTMLEditor::InsertHTML(nsHTMLEditor * const 0x0478a1fc, const nsString &
{"<br><br>Rich Pizzarro wrote:<br><BLOCKQUOTE TYPE=CITE><html><META
HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8""}) line 1294 + 51
bytes
nsHTMLEditor::InsertAsCitedQuotation(nsHTMLEditor * const 0x0478a200, const
nsString & {"<br><br>Rich Pizzarro wrote:<br><BLOCKQUOTE TYPE=CITE><html><META
HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8""}, const nsString
& {""}) line 3279 + 20 bytes
nsHTMLEditorLog::InsertAsCitedQuotation(nsHTMLEditorLog * const 0x0478a200,
const nsString & {"<br><br>Rich Pizzarro wrote:<br><BLOCKQUOTE
TYPE=CITE><html><META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=UTF-8""}, const nsString & {""}) line 453 + 17 bytes
nsHTMLEditor::InsertAsQuotation(nsHTMLEditor * const 0x0478a200, const nsString
& {"<br><br>Rich Pizzarro wrote:<br><BLOCKQUOTE TYPE=CITE><html><META
HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8""}) line 3218 + 23
bytes
nsHTMLEditorLog::InsertAsQuotation(nsHTMLEditorLog * const 0x0478a200, const
nsString & {"<br><br>Rich Pizzarro wrote:<br><BLOCKQUOTE TYPE=CITE><html><META
HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8""}) line 417 + 13
bytes
nsEditorShell::InsertAsQuotation(nsEditorShell * const 0x04725280, const
unsigned short * 0x03b45f00) line 1870 + 42 bytes
QuotingOutputStreamListener::OnStopRequest(QuotingOutputStreamListener * const
0x04790100, nsIChannel * 0x047926c0, nsIChannel * 0x047926c0, unsigned int 0,
nsIChannel * 0x047926c0) line 876
nsStreamConverter::OnStopRequest(nsStreamConverter * const 0x04792760,
nsIChannel * 0x047938c4, nsISupports * 0x04793f90, unsigned int 0, const
unsigned short * 0x00000000) line 711
nsMsgProtocol::OnStopRequest(nsMsgProtocol * const 0x047938c0, nsIChannel *
0x04793d50, nsISupports * 0x04793f90, unsigned int 0, const unsigned short *
0x00000000) line 192 + 74 bytes
nsMailboxProtocol::OnStopRequest(nsMailboxProtocol * const 0x047938c0,
nsIChannel * 0x04793d50, nsISupports * 0x04793f90, unsigned int 0, const
unsigned short * 0x00000000) line 174
nsFileChannel::OnStopRequest(nsFileChannel * const 0x04793d54, nsIChannel *
0x04795150, nsISupports * 0x04793f90, unsigned int 0, const unsigned short *
0x00000000) line 414 + 45 bytes
nsOnStopRequestEvent::HandleEvent(nsOnStopRequestEvent * const 0x04796700) line
322
nsStreamListenerEvent::HandlePLEvent(PLEvent * 0x04797d00) line 169 + 12 bytes
PL_HandleEvent(PLEvent * 0x04797d00) line 534 + 10 bytes
PL_ProcessPendingEvents(PLEventQueue * 0x00ccd520) line 493 + 9 bytes
_md_EventReceiverProc(HWND__ * 0x017a0554, unsigned int 49365, unsigned int 0,
long 13423904) line 963 + 9 bytes
USER32! 77e71268()

Updated

19 years ago
Status: NEW → ASSIGNED
Target Milestone: M11

Comment 1

19 years ago
I see a similar crash on Linux when inserting into the plaintext editor.  I
suspect that there may be a problem due to there being no body tag.  I'm looking
into it.
(Assignee)

Comment 2

19 years ago
Created attachment 2253 [details] [diff] [review]
This patch will make the mail/news changes for using InsertAsQuotation
(Assignee)

Updated

19 years ago
Summary: Crashes/bad behavior when trying to use InsertAsQuotation() Calls → [BLOCKER] Crashes/bad behavior when trying to use InsertAsQuotation() Calls
(Assignee)

Updated

19 years ago
Summary: [BLOCKER] Crashes/bad behavior when trying to use InsertAsQuotation() Calls → [DOGFOOD] [BLOCKER] Crashes/bad behavior when trying to use InsertAsQuotation() Calls

Comment 3

19 years ago
Vidur and Rick, can you help look at this?  This is a crash in the parser called
via nsRange::CreateContextualFragment when trying to parse a meta tag inserted
during a mail/news reply.

Here's the content that's being inserted:
--
<br><br>Akkana Peck wrote:<br><BLOCKQUOTE TYPE=CITE><html><PRE WRAP><META
HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
[Random text from the reply here]

</PRE></html></BLOCKQUOTE>
--
Seems like we've had problems before trying to insert html which contains an
html tag, but I don't remember what the conclusion was about whether this was
legal or not.  Rick?  Vidur?
(Assignee)

Comment 4

19 years ago
The thing is that people are going to create HTML signatures with standard
tools (like Ender) and they will be self contained documents so this will be
the norm. Like I've mentioned before, I want to keep any sort of HTML parsing
out of libmime or the compose back end so I hope this type of content will be
allowed with the InsertAsQuotation() call.

- rhp
(Assignee)

Updated

19 years ago
Blocks: 16907
(Assignee)

Updated

19 years ago
Blocks: 16906

Updated

19 years ago
No longer blocks: 16906, 16907

Comment 5

19 years ago
The document into which I'm trying to insert looks like this:

body refcount=4<
  div moz_editor_bogus_node=TRUE refcount=11<
    blockquote type=cite refcount=5<
    >
    Text refcount=5<\u00a0>
  >
>

Rich, I agree with you about the body tag -- we should support that because
people will have signatures with those tags.  But this particular problem isn't
a signature problem -- the html and meta tags are coming from libmime and are in
the wrong place, so that seems like a bug in itself.  Where are they being set?
I'd like to try turning them off to see which one is causing the problem.

Rick thought the problem might be that there's a document observer watching for
meta tags, and that might be causing problems when inserting fragments.  I'd
like to be able to test this by trying it without the meta tag (I know that
inserting fragments with no meta and no html works, because my signature got
inserted correctly).
(Assignee)

Comment 6

19 years ago
The HTML and META tags for charset's are being written in the libmime
emitter's. You can comment out the lines in the file:

     \mozilla\mailnews\mime\emitters\src\nsMimeHtmlEmitter.cpp

that ouput these tags. Around line 63 there are the following statements:

      UtilityWrite("<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;
charset=");
      UtilityWrite(outCharset);
      UtilityWrite("\">");

Trying messing with these first.

- rhp

Comment 7

19 years ago
Thanks for the pointer!  Looks like it's actually the meta around line 304 of
that file, rather than the earlier one; but if I comment out both of them, then
the reply window comes up fine with the block-quoted text showing.

Rick, can we turn off the meta document observer when inserting fragments?
Rich, can we stop adding meta tags to fragments we're going to insert?  (Seems
like we shouldn't be adding the <html> tag either ... but at least Insert
Fragment is smart and knows enough to throw away the bogus html tag.)
(Assignee)

Updated

19 years ago
Severity: normal → minor
(Assignee)

Comment 8

19 years ago
The problem is that if we turn off META tag observation, I18N signatures and
I18N quoted material will start breaking all over the place.

- rhp

Updated

19 years ago
Assignee: akkana → rhp
Status: ASSIGNED → NEW

Comment 9

19 years ago
At this point it's pretty clear that there's not much the editor can do about
this, so I'm sending the bug back to Rich.  My suggestion is to stop adding the
meta tags to fragments you're about to insert.
(Assignee)

Comment 10

19 years ago
Is the issue here the reload behavior because of meta tags...I can't turn that
off or I18N will have my head and all I18N Quoting will break. The problem is
that my "fragments" will be entire quoted messages.

Anyone .... HELP!

- rhp

Updated

19 years ago
Whiteboard: [PDT+]
(Assignee)

Updated

19 years ago
Status: NEW → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED
(Assignee)

Comment 11

19 years ago
We fixed this by removing the META tags from the quoted output and doing the
conversion in memory to UCS-2 before we send it to Ender.

- rhp

Updated

19 years ago
Blocks: 17432
(Assignee)

Updated

19 years ago
Status: RESOLVED → VERIFIED
(Assignee)

Comment 12

19 years ago
Yep. This works.

Updated

18 years ago
No longer blocks: 17432
You need to log in before you can comment on or make changes to this bug.