fix crash, suspend native events when instantiating plugins. patch by Steven Michaud. b=345627 r=josh sr=roc

This commit is contained in:
2007-03-22 16:04:51 -07:00
parent 41e9f20542
commit 85e6a3ab1d
8 changed files with 83 additions and 5 deletions
+13
View File
@@ -58,6 +58,7 @@
#include "nsReadableUtils.h"
#include "prmem.h"
#include "nsGkAtoms.h"
#include "nsIAppShell.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
#include "nsIURL.h"
@@ -719,6 +720,14 @@ nsObjectFrame::InstantiatePlugin(nsIPluginHost* aPluginHost,
const char* aMimeType,
nsIURI* aURI)
{
// If you add early return(s), be sure to balance this call to
// appShell->SuspendNative() with additional call(s) to
// appShell->ReturnNative().
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
if (appShell) {
appShell->SuspendNative();
}
#ifdef DEBUG
mInstantiating = PR_TRUE;
@@ -745,6 +754,10 @@ nsObjectFrame::InstantiatePlugin(nsIPluginHost* aPluginHost,
mInstantiating = PR_FALSE;
#endif
if (appShell) {
appShell->ResumeNative();
}
// XXX having to do this sucks. it'd be better to move the code from DidReflow
// to FixupWindow or something.
AddStateBits(NS_FRAME_IS_DIRTY);