backout bug 833143 since WebRTC code doesn't like it
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 24 Jan 2013 21:39:16 +0200
changeset 119738 680e46fecff055a80d84843a45ba4a195541da88
parent 119737 fa969919b1bbbb1c9d345419193eb0ae1ec94b51
child 119739 de2f88640ab6f2445e9197d5f0bd528fb1220d2b
child 119783 455fc2f47033952d55081348d91eb69044b82e37
push id24220
push useropettay@mozilla.com
push dateThu, 24 Jan 2013 19:39:40 +0000
treeherdermozilla-central@680e46fecff0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs833143
milestone21.0a1
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
backout bug 833143 since WebRTC code doesn't like it
toolkit/xre/nsXREDirProvider.cpp
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -842,16 +842,29 @@ nsXREDirProvider::DoShutdown()
       mozilla::services::GetObserverService();
     NS_ASSERTION(obsSvc, "No observer service?");
     if (obsSvc) {
       static const PRUnichar kShutdownPersist[] =
         {'s','h','u','t','d','o','w','n','-','p','e','r','s','i','s','t','\0'};
       obsSvc->NotifyObservers(nullptr, "profile-change-net-teardown", kShutdownPersist);
       obsSvc->NotifyObservers(nullptr, "profile-change-teardown", kShutdownPersist);
 
+      // Phase 2c: Now that things are torn down, force JS GC so that things which depend on
+      // resources which are about to go away in "profile-before-change" are destroyed first.
+
+      nsCOMPtr<nsIJSRuntimeService> rtsvc
+        (do_GetService("@mozilla.org/js/xpc/RuntimeService;1"));
+      if (rtsvc)
+      {
+        JSRuntime *rt = nullptr;
+        rtsvc->GetRuntime(&rt);
+        if (rt)
+          ::JS_GC(rt);
+      }
+
       // Phase 3: Notify observers of a profile change
       obsSvc->NotifyObservers(nullptr, "profile-before-change", kShutdownPersist);
     }
     mProfileNotified = false;
   }
 }
 
 #ifdef XP_WIN