Bug 389933 - "ASSERTION: JoinNode called with node not listed in offset table while editing HTML email in GMail" [p=chris@pearce.org.nz (Chris Pearce [cpearce]) r=peterv sr=roc a1.9=schrep]
--- a/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -542,16 +542,23 @@ nsHTMLEditRules::AfterEditInner(PRInt32
mHTMLEditor->mTypeInState->UpdateSelState(selection);
res = ReapplyCachedStyles();
if (NS_FAILED(res)) return res;
res = ClearCachedStyles();
if (NS_FAILED(res)) return res;
}
}
+ // Ensure range offsets are up to date.
+ if (mDocChangeRange) {
+ mDocChangeRange->GetStartContainer(getter_AddRefs(rangeStartParent));
+ mDocChangeRange->GetEndContainer(getter_AddRefs(rangeEndParent));
+ mDocChangeRange->GetStartOffset(&rangeStartOffset);
+ mDocChangeRange->GetEndOffset(&rangeEndOffset);
+ }
res = mHTMLEditor->HandleInlineSpellCheck(action, selection,
mRangeItem.startNode, mRangeItem.startOffset,
rangeStartParent, rangeStartOffset,
rangeEndParent, rangeEndOffset);
if (NS_FAILED(res))
return res;
// detect empty doc
--- a/editor/txtsvc/src/nsTextServicesDocument.cpp
+++ b/editor/txtsvc/src/nsTextServicesDocument.cpp
@@ -2621,29 +2621,31 @@ nsTextServicesDocument::JoinNodes(nsIDOM
result = NodeHasOffsetEntry(&mOffsetTable, aLeftNode, &leftHasEntry, &leftIndex);
if (NS_FAILED(result))
return result;
if (!leftHasEntry)
{
- // XXX: Not sure if we should be throwing an error here!
- NS_ASSERTION(0, "JoinNode called with node not listed in offset table.");
- return NS_ERROR_FAILURE;
+ // It's okay if the node isn't in the offset table, the
+ // editor could be cleaning house.
+ return NS_OK;
}
result = NodeHasOffsetEntry(&mOffsetTable, aRightNode, &rightHasEntry, &rightIndex);
if (NS_FAILED(result))
return result;
if (!rightHasEntry)
{
- return NS_ERROR_FAILURE;
+ // It's okay if the node isn't in the offset table, the
+ // editor could be cleaning house.
+ return NS_OK;
}
NS_ASSERTION(leftIndex < rightIndex, "Indexes out of order.");
if (leftIndex > rightIndex)
{
// Don't know how to handle this situation.
return NS_ERROR_FAILURE;