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.
This commit is contained in:
Ehsan Akhgari 2010-12-10 17:14:26 -05:00
Родитель a2b2a8dada
Коммит 47f852bccf
4 изменённых файлов: 16 добавлений и 15 удалений

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

@ -1,8 +1,15 @@
<html>
<html class="reftest-wait">
<head>
<title>testcase2 Bug 432114 – Crash [@ PL_DHashTableOperate] with DOMNodeInserted event listener removing window and frameset contenteditable</title>
</head>
<body>
<script>
window.addEventListener("DOMNodeRemoved", function() {
setTimeout(function() {
document.documentElement.removeAttribute("class");
}, 0);
}, false);
</script>
<iframe id="content" src="data:application/xhtml+xml;charset=utf-8,%3Chtml%20xmlns%3D%22http%3A//www.w3.org/1999/xhtml%22%3E%0A%3Cframeset%20contenteditable%3D%22true%22/%3E%0A%3Cscript%3E%0Afunction%20doExecCommand%28%29%7B%0Adocument.execCommand%28%27insertParagraph%27%2C%20false%2C%20%27%27%29%3B%0A%7D%0AsetTimeout%28doExecCommand%2C100%29%3B%0Awindow.addEventListener%28%27DOMNodeRemoved%27%2C%20function%28%29%20%7Bwindow.frameElement.parentNode.removeChild%28window.frameElement%29%3B%7D%2C%20true%29%3B%0A%3C/script%3E%0A%3C/html%3E" style="width:1000px;height: 200px;"></iframe>
</body>

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

@ -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

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

@ -4212,20 +4212,14 @@ nsresult nsEditor::EndUpdateViewBatch()
GetFlags(&flags);
// Turn view updating back on.
nsCOMPtr<nsIViewManager> 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.

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

@ -278,7 +278,7 @@ public:
*/
NS_IMETHOD GetDeviceContext(nsIDeviceContext *&aContext) = 0;
class NS_STACK_CLASS UpdateViewBatch {
class UpdateViewBatch {
public:
UpdateViewBatch() {}
/**