Bug 498340. Block script execution during the entire paint phase including when we call WillPaint to flush notifications. We don't want script to run and disturb (directly or indirectly) the widget hierarchy, because doing that during BeginPaint/EndPaint can confuse Windows. Other platforms might also be adversely affected. r=bz

This commit is contained in:
Robert O'Callahan 2009-11-10 14:00:35 +13:00
parent 10bcc5d660
commit 6b06693b5b

View File

@ -450,7 +450,6 @@ void nsViewManager::Refresh(nsView *aView, nsIRenderingContext *aContext,
}
{
nsAutoScriptBlocker scriptBlocker;
SetPainting(PR_TRUE);
nsCOMPtr<nsIRenderingContext> localcx;
@ -897,6 +896,12 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
{
nsPaintEvent *event = static_cast<nsPaintEvent*>(aEvent);
// We don't want script to execute anywhere in here. Since
// the widget layer has already set up a DC for painting,
// scripted changes to the widget tree (or accidental changes
// induced by script) can make painting very confused.
nsAutoScriptBlocker scriptBlocker;
if (!aView || !mContext)
break;