mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 728652, null check return value of MozGetDataAt, r=ehsan
This commit is contained in:
parent
f08f3ca319
commit
74c89efa8b
@ -117,6 +117,12 @@ function doTest()
|
||||
// synthesizeDrop(text, textarea, [[{type: "text/plain", data: "Somewhat Longer Text"}]], "copy");
|
||||
// is(textarea.value, "Somewhat Longer Text", "Drag text/plain onto textarea");
|
||||
|
||||
// -------- Test dragging special text type of text/plain to contenteditable
|
||||
|
||||
selection.selectAllChildren(text);
|
||||
synthesizeDrop(text, input, [[{type: "text/x-moz-text-internal", data: "Some Special Text"}]], "copy");
|
||||
is(input.value, "Some Plain Text", "Drag text/x-moz-text-internal onto input");
|
||||
|
||||
// -------- Test dragging regular text of text/plain to contenteditable
|
||||
|
||||
selection.selectAllChildren(text);
|
||||
|
@ -169,12 +169,16 @@ nsresult nsPlaintextEditor::InsertFromDataTransfer(nsIDOMDataTransfer *aDataTran
|
||||
nsCOMPtr<nsIVariant> data;
|
||||
aDataTransfer->MozGetDataAt(NS_LITERAL_STRING("text/plain"), aIndex,
|
||||
getter_AddRefs(data));
|
||||
nsAutoString insertText;
|
||||
data->GetAsAString(insertText);
|
||||
nsContentUtils::PlatformToDOMLineBreaks(insertText);
|
||||
if (data) {
|
||||
nsAutoString insertText;
|
||||
data->GetAsAString(insertText);
|
||||
nsContentUtils::PlatformToDOMLineBreaks(insertText);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
return InsertTextAt(insertText, aDestinationNode, aDestOffset, aDoDeleteSelection);
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
return InsertTextAt(insertText, aDestinationNode, aDestOffset, aDoDeleteSelection);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
|
||||
|
Loading…
Reference in New Issue
Block a user