Add null checks in nsAutoSelectionReset to fix bug 407256. Patch by Chris Pearce, r+sr=peterv, a=blocking1.9+.

This commit is contained in:
jruderman@hmc.edu 2008-01-07 20:11:24 -08:00
Родитель 3aa7f778a6
Коммит 5db9034c14
4 изменённых файлов: 29 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,23 @@
<html>
<head>
<script type="text/javascript">
function boom()
{
document.addEventListener("DOMNodeInserted", x, false);
function x()
{
document.removeEventListener("DOMNodeInserted", x, false);
document.execCommand("insertParagraph", false, "");
}
document.execCommand("insertorderedlist", false, "");
}
</script>
</head>
<body contenteditable="true" onload="boom()"></body>
</html>

Просмотреть файл

@ -0,0 +1 @@
load 407256-1.html

Просмотреть файл

@ -71,6 +71,7 @@ mSel(nsnull)
nsAutoSelectionReset::~nsAutoSelectionReset()
{
NS_ASSERTION(!mSel || mEd, "mEd should be non-null when mSel is");
if (mSel && mEd->ArePreservingSelection()) // mSel will be null if this was nested call
{
mEd->RestorePreservedSelection(mSel);
@ -80,7 +81,9 @@ nsAutoSelectionReset::~nsAutoSelectionReset()
void
nsAutoSelectionReset::Abort()
{
mEd->StopPreservingSelection();
NS_ASSERTION(!mSel || mEd, "mEd should be non-null when mSel is");
if (mSel)
mEd->StopPreservingSelection();
}

Просмотреть файл

@ -21,6 +21,7 @@ include ../../dom/src/offline/crashtests/crashtests.list
include ../../dom/src/jsurl/crashtests/crashtests.list
include ../../editor/libeditor/html/crashtests/crashtests.list
include ../../editor/libeditor/base/crashtests/crashtests.list
include ../../js/src/xpconnect/crashtests/crashtests.list