Bug 1298323 - do not destroy the Finder instance when only a single window closes in e10s mode, because that render the findbar useless. r=jaws
authorMike de Boer <mdeboer@mozilla.com>
Fri, 26 Aug 2016 10:07:54 +0200
changeset 311500 2c5773f47093c093bfffd2ad2ca67ae222ba5f21
parent 311499 cff5194e9168affc24662b8fd3fc7dd6b47a0745
child 311501 af2d7437a1c5032951886895e0915029c6eddcb3
push id30614
push userryanvm@gmail.com
push dateMon, 29 Aug 2016 16:22:36 +0000
treeherdermozilla-central@12fa18765018 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1298323
milestone51.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 1298323 - do not destroy the Finder instance when only a single window closes in e10s mode, because that render the findbar useless. r=jaws MozReview-Commit-ID: 4kxdba41n8k
toolkit/modules/RemoteFinder.jsm
--- a/toolkit/modules/RemoteFinder.jsm
+++ b/toolkit/modules/RemoteFinder.jsm
@@ -21,27 +21,17 @@ XPCOMUtils.defineLazyGetter(this, "Rect"
 function RemoteFinder(browser) {
   this._listeners = new Set();
   this._searchString = null;
 
   this.swapBrowser(browser);
 }
 
 RemoteFinder.prototype = {
-  destroy() {
-    this._browser.messageManager.sendAsyncMessage("Finder:Destroy");
-    if (this._messageManager) {
-      this._messageManager.removeMessageListener("Finder:Result", this);
-      this._messageManager.removeMessageListener("Finder:MatchesResult", this);
-      this._messageManager.removeMessageListener("Finder:CurrentSelectionResult", this);
-      this._messageManager.removeMessageListener("Finder:HighlightFinished", this);
-    }
-    this._listeners.clear();
-    this._browser = this._messageManager = null;
-  },
+  destroy() {},
 
   swapBrowser: function(aBrowser) {
     if (this._messageManager) {
       this._messageManager.removeMessageListener("Finder:Result", this);
       this._messageManager.removeMessageListener("Finder:MatchesResult", this);
       this._messageManager.removeMessageListener("Finder:CurrentSelectionResult", this);
       this._messageManager.removeMessageListener("Finder:HighlightFinished", this);
     }
@@ -222,23 +212,21 @@ function RemoteFinderListener(global) {
   let {Finder} = Cu.import("resource://gre/modules/Finder.jsm", {});
   this._finder = new Finder(global.docShell);
   this._finder.addResultListener(this);
   this._global = global;
 
   for (let msg of this.MESSAGES) {
     global.addMessageListener(msg, this);
   }
-  global.addEventListener("unload", this.destroy.bind(this));
 }
 
 RemoteFinderListener.prototype = {
   MESSAGES: [
     "Finder:CaseSensitive",
-    "Finder:Destroy",
     "Finder:EntireWord",
     "Finder:FastFind",
     "Finder:FindAgain",
     "Finder:SetSearchStringToSelection",
     "Finder:GetInitialSelection",
     "Finder:Highlight",
     "Finder:HighlightAllChange",
     "Finder:EnableSelection",
@@ -246,23 +234,16 @@ RemoteFinderListener.prototype = {
     "Finder:FocusContent",
     "Finder:FindbarClose",
     "Finder:FindbarOpen",
     "Finder:KeyPress",
     "Finder:MatchesCount",
     "Finder:ModalHighlightChange"
   ],
 
-  destroy() {
-    this._finder.destroy();
-    for (let msg of this.MESSAGES)
-      this._global.removeMessageListener(msg, this);
-    this._finder = this._global = null;
-  },
-
   onFindResult: function (aData) {
     this._global.sendAsyncMessage("Finder:Result", aData);
   },
 
   // When the child receives messages with results of requestMatchesCount,
   // it passes them forward to the parent.
   onMatchesCountResult: function (aData) {
     this._global.sendAsyncMessage("Finder:MatchesResult", aData);
@@ -271,20 +252,16 @@ RemoteFinderListener.prototype = {
   onHighlightFinished: function(aData) {
     this._global.sendAsyncMessage("Finder:HighlightFinished", aData);
   },
 
   receiveMessage: function (aMessage) {
     let data = aMessage.data;
 
     switch (aMessage.name) {
-      case "Finder:Destroy":
-        this._finder.destroy();
-        break;
-
       case "Finder:CaseSensitive":
         this._finder.caseSensitive = data.caseSensitive;
         break;
 
       case "Finder:EntireWord":
         this._finder.entireWord = data.entireWord;
         break;