зеркало из https://github.com/mozilla/pjs.git
Bug 728652, null check return value of MozGetDataAt, r=ehsan
This commit is contained in:
Родитель
b5f0d75c0c
Коммит
716f4d2d79
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче