Bug 1258546 - Ensure reloading devtools frame script and loader in child processes. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 14 Apr 2016 01:40:43 -0700
changeset 331048 4276c4ae6d52c0cd1d69cee55d6a077b59a7dd88
parent 331047 625ed96745ea86e9db9de05cbb459acd19512de2
child 331049 cd9c7f0216c4b19d79e607ca7ff04302c6375add
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1258546
milestone48.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
Bug 1258546 - Ensure reloading devtools frame script and loader in child processes. r=jryans
devtools/bootstrap.js
--- a/devtools/bootstrap.js
+++ b/devtools/bootstrap.js
@@ -78,20 +78,32 @@ function reload(event) {
   let reloadToolbox = false;
   if (isBrowser && top.gDevToolsBrowser.hasToolboxOpened) {
     reloadToolbox = top.gDevToolsBrowser.hasToolboxOpened(top);
   }
   dump("Reload DevTools.  (reload-toolbox:"+reloadToolbox+")\n");
 
   // Invalidate xul cache in order to see changes made to chrome:// files
   Services.obs.notifyObservers(null, "startupcache-invalidate", null);
-  Services.obs.notifyObservers(null, "chrome-flush-caches", null);
+
+  // This frame script is going to be executed in all processes: parent and childs
+  Services.ppmm.loadProcessScript("data:,new " + function () {
+    /* Flush message manager cached frame scripts as well as chrome locales */
+    let obs = Components.classes["@mozilla.org/observer-service;1"]
+                        .getService(Components.interfaces.nsIObserverService);
+    obs.notifyObservers(null, "message-manager-flush-caches", null);
 
-  // Ask the loader to update itself and reopen the toolbox if needed
-  const {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+    /* Also purge cached modules in child processes, we do it a few lines after
+       in the parent process */
+    if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
+      Services.obs.notifyObservers(null, "devtools-unload", "reload");
+    }
+  }, false);
+
+  const {devtools} = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
   devtools.reload();
 
   // Go over all top level windows to reload all devtools related things
   let windowsEnum = Services.wm.getEnumerator(null);
   while (windowsEnum.hasMoreElements()) {
     let window = windowsEnum.getNext();
     let windowtype = window.document.documentElement.getAttribute("windowtype");
     if (windowtype == "navigator:browser" && window.gBrowser) {