From 47f852bccfe522eedeed670163ce1b23e2cc31d1 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 10 Dec 2010 17:14:26 -0500 Subject: [PATCH] Bug 611798 - Do not pretent that we need the presshell to exist in order to turn off update view batching when the editor operations finish, because we don't; r=bzbarsky a=blocking-final+ This patch should fix all of the possible cases where a browser window stops painting when the presshell dies in the middle of an editor operation. --- docshell/base/crashtests/432114-2.html | 9 ++++++++- docshell/base/crashtests/crashtests.list | 2 +- editor/libeditor/base/nsEditor.cpp | 18 ++++++------------ view/public/nsIViewManager.h | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/docshell/base/crashtests/432114-2.html b/docshell/base/crashtests/432114-2.html index 4dbb42205a6..e98fd8eda3b 100644 --- a/docshell/base/crashtests/432114-2.html +++ b/docshell/base/crashtests/432114-2.html @@ -1,8 +1,15 @@ - + testcase2 Bug 432114 – Crash [@ PL_DHashTableOperate] with DOMNodeInserted event listener removing window and frameset contenteditable + diff --git a/docshell/base/crashtests/crashtests.list b/docshell/base/crashtests/crashtests.list index 7ad88aead15..c4d24cffde5 100644 --- a/docshell/base/crashtests/crashtests.list +++ b/docshell/base/crashtests/crashtests.list @@ -4,7 +4,7 @@ load 403574-1.xhtml load 430124-1.html load 430628-1.html asserts(1-4) load 432114-1.html # bug 570215 -asserts(0-2) load 432114-2.html # bug 570215, bug 571020 +asserts(1) load 432114-2.html # bug 570210 load 436900-1.html asserts(0-2) load 436900-2.html # bug 566159 load 500328-1.html diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 675f3e61810..de06e2782df 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -4212,20 +4212,14 @@ nsresult nsEditor::EndUpdateViewBatch() GetFlags(&flags); // Turn view updating back on. - nsCOMPtr viewManager; - if (presShell) - viewManager = presShell->GetViewManager(); - if (viewManager) - { - PRUint32 updateFlag = NS_VMREFRESH_IMMEDIATE; + PRUint32 updateFlag = NS_VMREFRESH_IMMEDIATE; - // If we're doing async updates, use NS_VMREFRESH_DEFERRED here, so that - // the reflows we caused will get processed before the invalidates. - if (flags & nsIPlaintextEditor::eEditorUseAsyncUpdatesMask) { - updateFlag = NS_VMREFRESH_DEFERRED; - } - mBatch.EndUpdateViewBatch(updateFlag); + // If we're doing async updates, use NS_VMREFRESH_DEFERRED here, so that + // the reflows we caused will get processed before the invalidates. + if (flags & nsIPlaintextEditor::eEditorUseAsyncUpdatesMask) { + updateFlag = NS_VMREFRESH_DEFERRED; } + mBatch.EndUpdateViewBatch(updateFlag); // Turn selection updating and notifications back on. diff --git a/view/public/nsIViewManager.h b/view/public/nsIViewManager.h index 60a95a22837..260187c2352 100644 --- a/view/public/nsIViewManager.h +++ b/view/public/nsIViewManager.h @@ -278,7 +278,7 @@ public: */ NS_IMETHOD GetDeviceContext(nsIDeviceContext *&aContext) = 0; - class NS_STACK_CLASS UpdateViewBatch { + class UpdateViewBatch { public: UpdateViewBatch() {} /**