Bug 1473270 - Handle tab detaching for new tab page per-window themes. r=mconley
authorTim Nguyen <ntim.bugs@gmail.com>
Thu, 05 Jul 2018 15:05:29 +0100
changeset 425316 9cf5aaf0177240e944a6e2063d7e67f411c75ddd
parent 425315 14e28f7332c75560af8680f8d8bf524828260e23
child 425317 fa92a04dda3d16d7c391f39fe5ae06e27ac42c26
push id34243
push userbtara@mozilla.com
push dateFri, 06 Jul 2018 21:59:02 +0000
treeherdermozilla-central@79197e2d630a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1473270
milestone63.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 1473270 - Handle tab detaching for new tab page per-window themes. r=mconley MozReview-Commit-ID: BmyeEZCe4vy
toolkit/modules/LightweightThemeConsumer.jsm
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -113,16 +113,17 @@ function LightweightThemeConsumer(aDocum
   Services.obs.addObserver(this, "lightweight-theme-styling-update");
 
   var temp = {};
   ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
   this._update(temp.LightweightThemeManager.currentThemeForDisplay);
 
   this._win.addEventListener("resolutionchange", this);
   this._win.addEventListener("unload", this, { once: true });
+  this._win.addEventListener("EndSwapDocShells", this, true);
   this._win.messageManager.addMessageListener("LightweightTheme:Request", this);
 
   let darkThemeMediaQuery = this._win.matchMedia("(-moz-system-dark-theme)");
   darkThemeMediaQuery.addListener(temp.LightweightThemeManager);
   temp.LightweightThemeManager.systemThemeChanged(darkThemeMediaQuery);
 }
 
 LightweightThemeConsumer.prototype = {
@@ -158,18 +159,23 @@ LightweightThemeConsumer.prototype = {
       case "resolutionchange":
         if (this._active) {
           this._update(this._lastData);
         }
         break;
       case "unload":
         Services.obs.removeObserver(this, "lightweight-theme-styling-update");
         this._win.removeEventListener("resolutionchange", this);
+        this._win.removeEventListener("EndSwapDocShells", this, true);
         this._win = this._doc = null;
         break;
+      case "EndSwapDocShells":
+        let contentThemeData = _getContentProperties(this._doc, this._active, this._lastData);
+        aEvent.target.messageManager.sendAsyncMessage("LightweightTheme:Update", contentThemeData);
+        break;
     }
   },
 
   _update(aData) {
     if (!aData) {
       aData = { headerURL: "", footerURL: "", textcolor: "", accentcolor: "" };
       this._lastData = aData;
     } else {