diff --git a/accessible/src/html/nsHyperTextAccessible.cpp b/accessible/src/html/nsHyperTextAccessible.cpp
index 9fb800330f4..f3b0c2aadbb 100644
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -1480,10 +1480,8 @@ nsresult nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEn
}
if (selCon) {
- // XXX I'm not sure this can do synchronous scrolling. If the last param is
- // set to true, this calling might flush the pending reflow. See bug 418470.
selCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL,
- nsISelectionController::SELECTION_FOCUS_REGION, PR_FALSE);
+ nsISelectionController::SELECTION_FOCUS_REGION, PR_FALSE);
}
return NS_OK;
diff --git a/content/base/public/nsISelectionController.idl b/content/base/public/nsISelectionController.idl
index 4c9f4b6bec2..0144db0e2af 100644
--- a/content/base/public/nsISelectionController.idl
+++ b/content/base/public/nsISelectionController.idl
@@ -102,9 +102,6 @@ interface nsISelectionController : nsISelectionDisplay
* @param aIsSynchronous when true, scrolls the selection into view
* before returning. If false, posts a request which is processed
* at some point after the method returns.
- *
- * Note that if isSynchronous is true, then this might flush the pending
- * reflow. It's dangerous for some objects. See bug 418470 comment 12.
*/
void scrollSelectionIntoView(in short type, in short region, in boolean isSynchronous);
/**
diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp
index 60a27e0a5b6..b963cbb54bf 100644
--- a/content/events/src/nsEventListenerManager.cpp
+++ b/content/events/src/nsEventListenerManager.cpp
@@ -1118,8 +1118,6 @@ nsEventListenerManager::HandleEvent(nsPresContext* aPresContext,
}
PRUint16 currentGroup = aFlags & NS_EVENT_FLAG_SYSTEM_EVENT;
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
if (aEvent->message == NS_CONTEXTMENU &&
NS_FAILED(FixContextMenuEvent(aPresContext, aCurrentTarget, aEvent,
aDOMEvent))) {
@@ -1382,8 +1380,6 @@ nsEventListenerManager::FixContextMenuEvent(nsPresContext* aPresContext,
// see if we should use the caret position for the popup
if (contextMenuKey) {
nsPoint caretPoint;
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
if (PrepareToUseCaretPosition(((nsGUIEvent*)aEvent)->widget,
shell, caretPoint)) {
// caret position is good
@@ -1511,8 +1507,6 @@ nsEventListenerManager::PrepareToUseCaretPosition(nsIWidget* aEventWidget,
else
selCon = do_QueryInterface(aShell);
if (selCon) {
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
rv = selCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL,
nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);
NS_ENSURE_SUCCESS(rv, PR_FALSE);
diff --git a/editor/composer/src/nsEditorSpellCheck.cpp b/editor/composer/src/nsEditorSpellCheck.cpp
index 270aee47c39..b67bc112e2a 100644
--- a/editor/composer/src/nsEditorSpellCheck.cpp
+++ b/editor/composer/src/nsEditorSpellCheck.cpp
@@ -247,8 +247,6 @@ nsEditorSpellCheck::GetNextMisspelledWord(PRUnichar **aNextMisspelledWord)
nsAutoString nextMisspelledWord;
DeleteSuggestedWordList();
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
nsresult rv = mSpellChecker->NextMisspelledWord(nextMisspelledWord,
&mSuggestedWordList);
diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp
index f440a5f00d0..961690518c3 100644
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -991,9 +991,6 @@ nsEditor::EndPlaceHolderTransaction()
// time to turn off the batch
EndUpdateViewBatch();
// make sure selection is in view
-
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
ScrollSelectionIntoView(PR_FALSE);
// cached for frame offset are Not available now
@@ -2563,8 +2560,6 @@ NS_IMETHODIMP nsEditor::ScrollSelectionIntoView(PRBool aScrollToAnchor)
syncScroll = !(flags & nsIPlaintextEditor::eEditorUseAsyncUpdatesMask);
}
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
selCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL,
region, syncScroll);
}
diff --git a/editor/libeditor/html/nsHTMLDataTransfer.cpp b/editor/libeditor/html/nsHTMLDataTransfer.cpp
index 5cb082d753d..4def0986f83 100644
--- a/editor/libeditor/html/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp
@@ -1439,9 +1439,6 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
}
// Try to scroll the selection into view if the paste/drop succeeded
-
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
if (NS_SUCCEEDED(rv))
ScrollSelectionIntoView(PR_FALSE);
@@ -1670,8 +1667,6 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
if (!nsEditorHookUtils::DoInsertionHook(domdoc, aDropEvent, trans))
return NS_OK;
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
rv = InsertFromTransferable(trans, srcdomdoc, contextStr, infoStr,
newSelectionParent,
newSelectionOffset, deleteSelection);
@@ -1892,8 +1887,6 @@ NS_IMETHODIMP nsHTMLEditor::Paste(PRInt32 aSelectionType)
if (!nsEditorHookUtils::DoInsertionHook(domdoc, nsnull, trans))
return NS_OK;
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
rv = InsertFromTransferable(trans, nsnull, contextStr, infoStr,
nsnull, 0, PR_TRUE);
}
@@ -1925,8 +1918,6 @@ NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(PRInt32 aSelectionType)
if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) && IsModifiable())
{
const nsAFlatString& empty = EmptyString();
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
rv = InsertFromTransferable(trans, nsnull, empty, empty, nsnull, 0,
PR_TRUE);
}
diff --git a/editor/libeditor/text/nsEditorEventListeners.cpp b/editor/libeditor/text/nsEditorEventListeners.cpp
index b6dc1866a3a..5c66a26efff 100644
--- a/editor/libeditor/text/nsEditorEventListeners.cpp
+++ b/editor/libeditor/text/nsEditorEventListeners.cpp
@@ -672,8 +672,6 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent)
aMouseEvent->StopPropagation();
aMouseEvent->PreventDefault();
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
return mEditor->InsertFromDrop(aMouseEvent);
}
diff --git a/editor/libeditor/text/nsPlaintextDataTransfer.cpp b/editor/libeditor/text/nsPlaintextDataTransfer.cpp
index be84feeab98..84e189cc17e 100644
--- a/editor/libeditor/text/nsPlaintextDataTransfer.cpp
+++ b/editor/libeditor/text/nsPlaintextDataTransfer.cpp
@@ -136,9 +136,6 @@ NS_IMETHODIMP nsPlaintextEditor::InsertTextFromTransferable(nsITransferable *aTr
NS_Free(bestFlavor);
// Try to scroll the selection into view if the paste/drop succeeded
-
- // After ScrollSelectionIntoView(), the pending notifications might be flushed
- // and PresShell/PresContext/Frames may be dead. See bug 418470.
if (NS_SUCCEEDED(rv))
ScrollSelectionIntoView(PR_FALSE);
@@ -304,8 +301,6 @@ NS_IMETHODIMP nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
if (!nsEditorHookUtils::DoInsertionHook(destdomdoc, aDropEvent, trans))
return NS_OK;
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
rv = InsertTextFromTransferable(trans, newSelectionParent, newSelectionOffset, deleteSelection);
}
@@ -455,8 +450,6 @@ NS_IMETHODIMP nsPlaintextEditor::Paste(PRInt32 aSelectionType)
if (!nsEditorHookUtils::DoInsertionHook(domdoc, nsnull, trans))
return NS_OK;
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
rv = InsertTextFromTransferable(trans, nsnull, nsnull, PR_TRUE);
}
}
diff --git a/editor/txtsvc/src/nsTextServicesDocument.cpp b/editor/txtsvc/src/nsTextServicesDocument.cpp
index 4248dc48d13..b77aa94cea5 100644
--- a/editor/txtsvc/src/nsTextServicesDocument.cpp
+++ b/editor/txtsvc/src/nsTextServicesDocument.cpp
@@ -1831,8 +1831,6 @@ nsTextServicesDocument::ScrollSelectionIntoView()
LOCK_DOC(this);
- // After ScrollSelectionIntoView(), the pending notifications might be flushed
- // and PresShell/PresContext/Frames may be dead. See bug 418470.
result = mSelCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL, nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);
UNLOCK_DOC(this);
diff --git a/embedding/components/find/src/nsWebBrowserFind.cpp b/embedding/components/find/src/nsWebBrowserFind.cpp
index ee901f267f8..fcac5da0cfa 100644
--- a/embedding/components/find/src/nsWebBrowserFind.cpp
+++ b/embedding/components/find/src/nsWebBrowserFind.cpp
@@ -151,9 +151,6 @@ NS_IMETHODIMP nsWebBrowserFind::FindNext(PRBool *outDidFind)
}
// next, look in the current frame. If found, return.
-
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
rv = SearchInFrame(searchFrame, PR_FALSE, outDidFind);
if (NS_FAILED(rv)) return rv;
if (*outDidFind)
@@ -202,8 +199,6 @@ NS_IMETHODIMP nsWebBrowserFind::FindNext(PRBool *outDidFind)
OnStartSearchFrame(searchFrame);
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
rv = SearchInFrame(searchFrame, PR_FALSE, outDidFind);
if (NS_FAILED(rv)) return rv;
if (*outDidFind)
@@ -244,8 +239,6 @@ NS_IMETHODIMP nsWebBrowserFind::FindNext(PRBool *outDidFind)
if (curItem.get() == startingItem.get())
{
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
rv = SearchInFrame(searchFrame, PR_TRUE, outDidFind);
if (NS_FAILED(rv)) return rv;
if (*outDidFind)
@@ -258,8 +251,6 @@ NS_IMETHODIMP nsWebBrowserFind::FindNext(PRBool *outDidFind)
OnStartSearchFrame(searchFrame);
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
rv = SearchInFrame(searchFrame, PR_FALSE, outDidFind);
if (NS_FAILED(rv)) return rv;
if (*outDidFind)
@@ -481,12 +472,9 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow,
// Scroll if necessary to make the selection visible:
// Must be the last thing to do - bug 242056
-
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
selCon->ScrollSelectionIntoView
(nsISelectionController::SELECTION_NORMAL,
- nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);
+ nsISelectionController::SELECTION_FOCUS_REGION, PR_FALSE);
}
}
@@ -833,8 +821,6 @@ nsresult nsWebBrowserFind::SearchInFrame(nsIDOMWindow* aWindow,
{
*aDidFind = PR_TRUE;
sel->RemoveAllRanges();
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
SetSelectionAndScroll(aWindow, foundRange);
}
diff --git a/extensions/spellcheck/src/mozSpellChecker.cpp b/extensions/spellcheck/src/mozSpellChecker.cpp
index c4544067b40..5f02f457aba 100644
--- a/extensions/spellcheck/src/mozSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozSpellChecker.cpp
@@ -112,9 +112,6 @@ mozSpellChecker::NextMisspelledWord(nsAString &aWord, nsStringArray *aSuggestion
if(isMisspelled){
aWord = currWord;
mTsDoc->SetSelection(begin, end-begin);
- // After ScrollSelectionIntoView(), the pending notifications might
- // be flushed and PresShell/PresContext/Frames may be dead.
- // See bug 418470.
mTsDoc->ScrollSelectionIntoView();
return NS_OK;
}
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 779723060c2..149ff625df5 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -2773,8 +2773,7 @@ PresShell::PageMove(PRBool aForward, PRBool aExtend)
nsIView *scrolledView;
result = scrollableView->GetScrolledView(scrolledView);
mSelection->CommonPageMove(aForward, aExtend, scrollableView);
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
+ // do ScrollSelectionIntoView()
return ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL, nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);
}
@@ -2850,8 +2849,6 @@ PresShell::CompleteScroll(PRBool aForward)
NS_IMETHODIMP
PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
{
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
return CompleteMoveInner(aForward, aExtend, PR_TRUE);
}
@@ -2889,8 +2886,6 @@ PresShell::CompleteMoveInner(PRBool aForward, PRBool aExtend, PRBool aScrollInto
mSelection->SetAncestorLimiter(root);
if (aScrollIntoView) {
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
return
ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL,
nsISelectionController::SELECTION_FOCUS_REGION,
@@ -2935,8 +2930,6 @@ PresShell::CompleteMoveInner(PRBool aForward, PRBool aExtend, PRBool aScrollInto
mSelection->HandleClick(pos.mResultContent ,pos.mContentOffset ,pos.mContentOffset/*End*/ ,aExtend, PR_FALSE, aForward);
if (aScrollIntoView) {
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
result = ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL,
nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);
if (NS_FAILED(result))
diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp
index fafafb139a7..0820e1da0fe 100644
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -670,8 +670,6 @@ NS_IMETHODIMP
nsTextInputSelectionImpl::ScrollSelectionIntoView(PRInt16 aType, PRInt16 aRegion, PRBool aIsSynchronous)
{
if (mFrameSelection) {
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
nsresult rv = mFrameSelection->ScrollSelectionIntoView(aType, aRegion, aIsSynchronous);
nsIScrollableView* scrollableView = mFrameSelection->GetScrollableView();
@@ -861,8 +859,6 @@ nsTextInputSelectionImpl::PageMove(PRBool aForward, PRBool aExtend)
if (scrollableView)
mFrameSelection->CommonPageMove(aForward, aExtend, scrollableView);
}
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
return ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL, nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);
}
diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp
index 5249898bd24..2a526d32887 100644
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -2558,10 +2558,8 @@ nsFrameSelection::ScrollSelectionIntoView(SelectionType aType,
if (!mDomSelections[index])
return NS_ERROR_NULL_POINTER;
- // After ScrollSelectionIntoView(), the pending notifications might be
- // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
return mDomSelections[index]->ScrollIntoView(aRegion, aIsSynchronous,
- PR_TRUE);
+ PR_FALSE);
}
nsresult
diff --git a/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp b/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp
index f084814ed0f..7cd0622f00c 100755
--- a/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp
+++ b/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp
@@ -575,12 +575,10 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell, PRBool aIsLinksOnly,
// ATTENTION, or when we MoveFocusToCaret() and the selection is not on a
// link, we'll blur, which will lose the ATTENTION.
if (selectionController) {
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
SetSelectionModeAndRepaint(nsISelectionController::SELECTION_ATTENTION);
selectionController->ScrollSelectionIntoView(
nsISelectionController::SELECTION_NORMAL,
- nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);
+ nsISelectionController::SELECTION_FOCUS_REGION, PR_FALSE);
}
mCurrentWindow = window;
@@ -903,8 +901,6 @@ nsTypeAheadFind::FindAgain(PRBool aFindBackwards, PRBool aLinksOnly,
mLinksOnly = aLinksOnly;
if (!mTypeAheadBuffer.IsEmpty())
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
FindItNow(nsnull, mLinksOnly, PR_FALSE, aFindBackwards, aResult);
return NS_OK;
@@ -1028,8 +1024,6 @@ nsTypeAheadFind::Find(const nsAString& aSearchString, PRBool aLinksOnly,
}
// ----------- Find the text! ---------------------
- // Beware! This may flush notifications via synchronous
- // ScrollSelectionIntoView.
nsresult rv = FindItNow(nsnull, mLinksOnly, isFirstVisiblePreferred,
PR_FALSE, aResult);