This appears to happen with <noscript> elements containing two or more paragraphs (<p> elements) after selecting them completely. Omitting one paragraph or just the last character in the last paragraph from selection, copies (and then pastes) the selected content fine. Selecting completely, copying and pasting single paragraph, being the only content of a <noscript> element, also works fine.
Don't know how this might be related but, selecting all of the content in the attached sample, copying it, then pastes just the heading "Copy noscript content test".
This isn't actually a serializer bug. nsHTMLFormatConverter::ConvertFromHTMLToUnicode (which is called via nsCopySupport::HTMLCopy calling SelectionCopyHelper calling nsHTMLFormatConverter::Convert) initializes a plaintext serializer like so: 294 textSink->Initialize(&aToStr, nsIDocumentEncoder::OutputSelectionOnly 295 | nsIDocumentEncoder::OutputAbsoluteLinks, 0); note conspicuous lack of OutputNoScriptContent. Compare the document encoder or web browser persist, which set that flag if script is disabled on the document or if told to do so explicitly respectively. After that the serializer does exactly what it's been told to do. This code looks like it hasn't changed from jst's initial checkin of nsHTMLFormatConverter back in Oct 2000... The problem, of course, is that it's converting an HTML string to a plaintext string. By this point it has no idea what document the HTML came from originally, as far as I can tell.
Created attachment 551480 [details] [diff] [review] fix I think can we can make nsHTMLFormatConverter::ConvertFromHTMLToUnicode assume that the input HTML string is already filtered visavi noscript and noframes - that is, if they occur in the input string they should be included in the result. Writing a test for that seems hard with script disabled. I've added a test for the opposite...
Comment on attachment 551480 [details] [diff] [review] fix Ah, excellent. r=me