Bug 572642 - Part 1: Allow comments, and disallow styles when pasting CF_HTML content; r=roc

This commit is contained in:
Ehsan Akhgari
2010-06-23 14:40:08 -04:00
parent b0bca8cc41
commit c24fe1ce5b
3 changed files with 24 additions and 4 deletions

View File

@@ -2705,10 +2705,15 @@ nsresult nsHTMLEditor::ParseFragment(const nsAString & aFragStr,
nsCOMPtr<nsIFragmentContentSink> fragSink(do_QueryInterface(sink));
NS_ENSURE_TRUE(fragSink, NS_ERROR_FAILURE);
// Allow style elements and attributes
nsCOMPtr<nsIParanoidFragmentContentSink> paranoidSink(do_QueryInterface(sink));
NS_ASSERTION(paranoidSink, "Our content sink is paranoid");
paranoidSink->AllowStyles();
if (bContext) {
// Allow comemnts for the context to catch our placeholder cookie
paranoidSink->AllowComments();
} else {
// Allow style elements and attributes for the actual content
paranoidSink->AllowStyles();
}
fragSink->SetTargetDocument(aTargetDocument);