Bug 563643 - [Debug MacOSX SeaMonkey] leak test: "ASSERTION: Want to fire mutation events, but it's not safe" since bug 429175 landing. ("all" other test suites too); (Av1b) With 2 extra ifdefs as agreed on IRC.
authorneil@parkwaycc.co.uk
Tue, 25 Jan 2011 19:13:43 +0100
changeset 61269 d04d532303309e4778a214e0e6fbe8795121fded
parent 61268 e9190bcf96a2899f757f1082ddddb86011323138
child 61270 5d466f5defc920bd96a85022ab332a31a14e1b89
push id18286
push usersgautherie.bz@free.fr
push dateTue, 25 Jan 2011 18:14:40 +0000
treeherdermozilla-central@d04d53230330 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs563643, 429175
milestone2.0b10pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 563643 - [Debug MacOSX SeaMonkey] leak test: "ASSERTION: Want to fire mutation events, but it's not safe" since bug 429175 landing. ("all" other test suites too); (Av1b) With 2 extra ifdefs as agreed on IRC. r=Olli.Pettay a-2.0=jonas.
xpfe/appshell/src/nsContentTreeOwner.cpp
--- a/xpfe/appshell/src/nsContentTreeOwner.cpp
+++ b/xpfe/appshell/src/nsContentTreeOwner.cpp
@@ -66,16 +66,19 @@
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIWebNavigation.h"
 #include "nsIJSContextStack.h"
 
 #include "nsIDOMDocument.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIURI.h"
+#if defined(XP_MACOSX)
+#include "nsThreadUtils.h"
+#endif
 
 // CIDs
 static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
 
 static const char *sJSStackContractID="@mozilla.org/js/xpc/ContextStack;1";
 
 //*****************************************************************************
 //*** nsSiteWindow2 declaration
@@ -943,17 +946,38 @@ nsContentTreeOwner::ProvideWindow(nsIDOM
     // to be starting any loads here, so get it with a null URI.
     return browserDOMWin->OpenURI(nsnull, aParent, containerPref,
                                   nsIBrowserDOMWindow::OPEN_NEW, aReturn);
   }
 }
 
 //*****************************************************************************
 // nsContentTreeOwner: Accessors
-//*****************************************************************************   
+//*****************************************************************************
+
+#if defined(XP_MACOSX)
+class nsContentTitleSettingEvent : public nsRunnable
+{
+public:
+  nsContentTitleSettingEvent(nsIDOMElement *dse, const nsAString& wtm)
+    : mElement(dse),
+      mTitleDefault(wtm) {}
+
+  NS_IMETHOD Run()
+  {
+    mElement->SetAttribute(NS_LITERAL_STRING("titledefault"), mTitleDefault);
+    mElement->RemoveAttribute(NS_LITERAL_STRING("titlemodifier"));
+    return NS_OK;
+  }
+
+private:
+  nsCOMPtr<nsIDOMElement> mElement;
+  nsString mTitleDefault;
+};
+#endif
 
 void nsContentTreeOwner::XULWindow(nsXULWindow* aXULWindow)
 {
    mXULWindow = aXULWindow;
    if(mXULWindow && mPrimary)
       {
       // Get the window title modifiers
       nsCOMPtr<nsIDOMElement> docShellElement;
@@ -970,19 +994,19 @@ void nsContentTreeOwner::XULWindow(nsXUL
             docShellElement->GetAttribute(NS_LITERAL_STRING("titledefault"), mTitleDefault);
             docShellElement->GetAttribute(NS_LITERAL_STRING("titlemodifier"), mWindowTitleModifier);
             docShellElement->GetAttribute(NS_LITERAL_STRING("titlepreface"), mTitlePreface);
             
 #if defined(XP_MACOSX)
             // On OS X, treat the titlemodifier like it's the titledefault, and don't ever append
             // the separator + appname.
             if (mTitleDefault.IsEmpty()) {
-                docShellElement->SetAttribute(NS_LITERAL_STRING("titledefault"),
-                                              mWindowTitleModifier);
-                docShellElement->RemoveAttribute(NS_LITERAL_STRING("titlemodifier"));
+                NS_DispatchToCurrentThread(
+                    new nsContentTitleSettingEvent(docShellElement,
+                                                   mWindowTitleModifier));
                 mTitleDefault = mWindowTitleModifier;
                 mWindowTitleModifier.Truncate();
             }
 #endif
             docShellElement->GetAttribute(NS_LITERAL_STRING("titlemenuseparator"), mTitleSeparator);
             }
          }
       else