Bug 491848. Ensure scripts are blocked during frame destruction. Also, don't dispatch paint events during a synchronous plugin message. r=roc

This commit is contained in:
Timothy Nikkel 2009-05-15 15:08:41 +12:00
Родитель f2acd1d865
Коммит 0c253d54f8
5 изменённых файлов: 17 добавлений и 1 удалений

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

@ -4251,6 +4251,7 @@ DocumentViewerImpl::DestroyPresShell()
if (selPrivate && mSelectionListener) if (selPrivate && mSelectionListener)
selPrivate->RemoveSelectionListener(mSelectionListener); selPrivate->RemoveSelectionListener(mSelectionListener);
nsAutoScriptBlocker scriptBlocker;
mPresShell->Destroy(); mPresShell->Destroy();
mPresShell = nsnull; mPresShell = nsnull;
} }

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

@ -1773,6 +1773,9 @@ PresShell::Init(nsIDocument* aDocument,
NS_IMETHODIMP NS_IMETHODIMP
PresShell::Destroy() PresShell::Destroy()
{ {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"destroy called on presshell while scripts not blocked");
#ifdef MOZ_REFLOW_PERF #ifdef MOZ_REFLOW_PERF
DumpReflows(); DumpReflows();
if (mReflowCountMgr) { if (mReflowCountMgr) {

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

@ -442,6 +442,9 @@ nsFrame::RemoveFrame(nsIAtom* aListName,
void void
nsFrame::Destroy() nsFrame::Destroy()
{ {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"destroy called on frame while scripts not blocked");
#ifdef MOZ_SVG #ifdef MOZ_SVG
nsSVGEffects::InvalidateDirectRenderingObservers(this); nsSVGEffects::InvalidateDirectRenderingObservers(this);
#endif #endif

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

@ -38,6 +38,7 @@
#include "nsPrintObject.h" #include "nsPrintObject.h"
#include "nsIContentViewer.h" #include "nsIContentViewer.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsContentUtils.h"
//--------------------------------------------------- //---------------------------------------------------
//-- nsPrintObject Class Impl //-- nsPrintObject Class Impl
@ -93,6 +94,7 @@ nsPrintObject::DestroyPresentation()
mPresContext = nsnull; mPresContext = nsnull;
if (mPresShell) { if (mPresShell) {
mPresShell->EndObservingDocument(); mPresShell->EndObservingDocument();
nsAutoScriptBlocker scriptBlocker;
mPresShell->Destroy(); mPresShell->Destroy();
} }
mPresShell = nsnull; mPresShell = nsnull;

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

@ -5380,6 +5380,7 @@ nsWindow::ProcessMessageForPlugin(const MSG &aMsg,
aCallDefWndProc = PR_FALSE; aCallDefWndProc = PR_FALSE;
PRBool fallBackToNonPluginProcess = PR_FALSE; PRBool fallBackToNonPluginProcess = PR_FALSE;
PRBool eventDispatched = PR_FALSE; PRBool eventDispatched = PR_FALSE;
PRBool dispatchPendingEvents = PR_TRUE;
switch (aMsg.message) { switch (aMsg.message) {
case WM_INPUTLANGCHANGEREQUEST: case WM_INPUTLANGCHANGEREQUEST:
case WM_INPUTLANGCHANGE: case WM_INPUTLANGCHANGE:
@ -5422,7 +5423,12 @@ nsWindow::ProcessMessageForPlugin(const MSG &aMsg,
case WM_IME_NOTIFY: case WM_IME_NOTIFY:
case WM_IME_REQUEST: case WM_IME_REQUEST:
case WM_IME_SELECT: case WM_IME_SELECT:
break;
case WM_IME_SETCONTEXT: case WM_IME_SETCONTEXT:
// Don't synchronously dispatch when we receive WM_IME_SETCONTEXT
// because we get it during plugin destruction. (bug 491848)
dispatchPendingEvents = PR_FALSE;
break; break;
default: default:
@ -5431,6 +5437,7 @@ nsWindow::ProcessMessageForPlugin(const MSG &aMsg,
if (!eventDispatched) if (!eventDispatched)
aCallDefWndProc = !DispatchPluginEvent(aMsg); aCallDefWndProc = !DispatchPluginEvent(aMsg);
if (dispatchPendingEvents)
DispatchPendingEvents(); DispatchPendingEvents();
return PR_TRUE; return PR_TRUE;
} }