Fixing bug 474022. Make sure we always stop plugins, no matter how they were started. r=smichaud@pobox.com, sr=bzbarsky@mit.edu, a=ss

git-svn-id: svn://10.0.0.236/trunk@256083 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%mozilla.org
2009-02-04 02:24:44 +00:00
parent 1ba8d158fa
commit cc0d932353
2 changed files with 35 additions and 27 deletions

View File

@@ -178,13 +178,13 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
"should no longer be using unconstrained widths");
#ifdef DEBUG
if ((aWidth != NS_UNCONSTRAINEDSIZE) && CRAZY_WIDTH(aWidth)) {
NS_NOTREACHED("bad width");
// NS_NOTREACHED("bad width");
nsFrame::ListTag(stdout, mBlockReflowState->frame);
printf(": Init: bad caller: width WAS %d(0x%x)\n",
aWidth, aWidth);
}
if ((aHeight != NS_UNCONSTRAINEDSIZE) && CRAZY_HEIGHT(aHeight)) {
NS_NOTREACHED("bad height");
// NS_NOTREACHED("bad height");
nsFrame::ListTag(stdout, mBlockReflowState->frame);
printf(": Init: bad caller: height WAS %d(0x%x)\n",
aHeight, aHeight);

View File

@@ -404,27 +404,13 @@ public:
return mLastEventloopNestingLevel;
}
static PRUint32 GetEventloopNestingLevel();
void ConsiderNewEventloopNestingLevel() {
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
if (appShell) {
PRUint32 currentLevel = 0;
appShell->GetEventloopNestingLevel(&currentLevel);
#ifdef XP_MACOSX
// Cocoa widget code doesn't process UI events through the normal appshell
// event loop, so it needs an additional count here.
currentLevel++;
#else
// No idea how this happens... but Linux doesn't consistently process UI
// events through the appshell event loop. If we get a 0 here on any
// platform we increment the level just in case so that we make sure we
// always tear the plugin down eventually.
if (!currentLevel) {
currentLevel++;
}
#endif
if (currentLevel < mLastEventloopNestingLevel) {
mLastEventloopNestingLevel = currentLevel;
}
PRUint32 currentLevel = GetEventloopNestingLevel();
if (currentLevel < mLastEventloopNestingLevel) {
mLastEventloopNestingLevel = currentLevel;
}
}
@@ -3171,6 +3157,32 @@ void nsPluginInstanceOwner::GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord
#endif
// static
PRUint32
nsPluginInstanceOwner::GetEventloopNestingLevel()
{
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
PRUint32 currentLevel = 0;
if (appShell) {
appShell->GetEventloopNestingLevel(&currentLevel);
#ifdef XP_MACOSX
// Cocoa widget code doesn't process UI events through the normal
// appshell event loop, so it needs an additional count here.
currentLevel++;
#endif
}
// No idea how this happens... but Linux doesn't consistently
// process UI events through the appshell event loop. If we get a 0
// here on any platform we increment the level just in case so that
// we make sure we always tear the plugin down eventually.
if (!currentLevel) {
currentLevel++;
}
return currentLevel;
}
nsresult nsPluginInstanceOwner::ScrollPositionWillChange(nsIScrollableView* aScrollable, nscoord aX, nscoord aY)
{
#ifdef XP_MACOSX
@@ -4291,11 +4303,7 @@ nsresult nsPluginInstanceOwner::Init(nsPresContext* aPresContext,
nsObjectFrame* aFrame,
nsIContent* aContent)
{
mLastEventloopNestingLevel = 0;
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
if (appShell) {
appShell->GetEventloopNestingLevel(&mLastEventloopNestingLevel);
}
mLastEventloopNestingLevel = GetEventloopNestingLevel();
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
("nsPluginInstanceOwner::Init() called on %p for frame %p\n", this,