From dc73d067d35c15024ee10a379c0175c4275311a4 Mon Sep 17 00:00:00 2001
From: Johnny Stenback <jst@mozilla.com>
Date: Fri, 6 Apr 2012 22:57:20 -0700
Subject: Bug 706381. Re-create the dummy java plugin when re-using the inner
 window. r=joshmoz@gmail.com, a=akeybl

---
 dom/src/base/nsGlobalWindow.cpp |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp
index 33786eb..71b8d2f 100644
--- a/dom/src/base/nsGlobalWindow.cpp
+++ b/dom/src/base/nsGlobalWindow.cpp
@@ -2001,6 +2001,16 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
           // XXXmarkh - tell other languages about this?
           JSAutoRequest ar(cx);
           ::JS_DeleteProperty(cx, currentInner->mJSObject, "document");
+
+          if (mDummyJavaPluginOwner) {
+            // Since we're reusing the inner window, tear down the
+            // dummy Java plugin we created for the old document in
+            // this window.
+            mDummyJavaPluginOwner->Destroy();
+            mDummyJavaPluginOwner = nsnull;
+
+            mDidInitJavaProperties = PR_FALSE;
+          }
         }
       } else {
         rv = newInnerWindow->SetNewDocument(aDocument, nsnull,
-- 
1.7.10

