Bug 1472491: Part 5λ - Add Split RemoteFinder into FinderChild and FinderParent actors. r=gijs
authorKris Maglione <maglione.k@gmail.com>
Mon, 30 Jul 2018 12:25:58 -0700
changeset 486585 6e04b88dde43abfeb8a2ee3fe21c561a79f6c1e9
parent 486584 1e3e2acebb2c832fbcc04ed64be7b9bb35941b0c
child 486586 c7b959b74404be51b72134222c8be46e2d8ad5a9
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs
bugs1472491
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 1472491: Part 5λ - Add Split RemoteFinder into FinderChild and FinderParent actors. r=gijs MozReview-Commit-ID: JAv8lh2gJoB
toolkit/actors/FindBarChild.jsm
toolkit/actors/FinderChild.jsm
toolkit/actors/moz.build
toolkit/content/browser-content.js
toolkit/content/widgets/remote-browser.xml
toolkit/modules/ActorManagerParent.jsm
toolkit/modules/FindBarContent.jsm
toolkit/modules/FinderParent.jsm
toolkit/modules/RemoteFinder.jsm
toolkit/modules/moz.build
tools/lint/eslint/modules.json
--- a/toolkit/actors/FindBarChild.jsm
+++ b/toolkit/actors/FindBarChild.jsm
@@ -7,18 +7,16 @@
 var EXPORTED_SYMBOLS = ["FindBarChild"];
 
 ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 ChromeUtils.defineModuleGetter(this, "BrowserUtils",
                                "resource://gre/modules/BrowserUtils.jsm");
-ChromeUtils.defineModuleGetter(this, "RemoteFinder",
-                               "resource://gre/modules/RemoteFinder.jsm");
 
 class FindBarChild extends ActorChild {
   constructor(mm) {
     super(mm);
     this._findKey = null;
 
     XPCOMUtils.defineLazyProxy(this, "FindBarContent", () => {
       let tmp = {};
@@ -68,18 +66,24 @@ class FindBarChild extends ActorChild {
     }
 
     if (FindBarContent.inPassThrough || FindBarContent.inQuickFind) {
       return FindBarContent.onKeypress(event);
     }
 
     if (event.charCode && BrowserUtils.shouldFastFind(event.target)) {
       let key = String.fromCharCode(event.charCode);
-      if ((key == "/" || key == "'") && RemoteFinder._manualFAYT) {
+      if ((key == "/" || key == "'") && FindBarChild.manualFAYT) {
         return FindBarContent.startQuickFind(event);
       }
-      if (key != " " && RemoteFinder._findAsYouType) {
+      if (key != " " && FindBarChild.findAsYouType) {
         return FindBarContent.startQuickFind(event, true);
       }
     }
     return null;
   }
 }
+
+XPCOMUtils.defineLazyPreferenceGetter(FindBarChild, "findAsYouType",
+  "accessibility.typeaheadfind");
+XPCOMUtils.defineLazyPreferenceGetter(FindBarChild, "manualFAYT",
+  "accessibility.typeaheadfind.manual");
+
rename from toolkit/modules/RemoteFinder.jsm
rename to toolkit/actors/FinderChild.jsm
--- a/toolkit/modules/RemoteFinder.jsm
+++ b/toolkit/actors/FinderChild.jsm
@@ -1,285 +1,91 @@
 // -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
 // vim: set ts=2 sw=2 sts=2 et tw=80: */
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-var EXPORTED_SYMBOLS = ["RemoteFinder", "RemoteFinderListener"];
-
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/Geometry.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "GetClipboardSearchString",
-  () => ChromeUtils.import("resource://gre/modules/Finder.jsm", {}).GetClipboardSearchString
-);
-XPCOMUtils.defineLazyGetter(this, "Rect",
-  () => ChromeUtils.import("resource://gre/modules/Geometry.jsm", {}).Rect
-);
-
-function RemoteFinder(browser) {
-  this._listeners = new Set();
-  this._searchString = null;
-
-  this.swapBrowser(browser);
-}
-
-RemoteFinder.prototype = {
-  destroy() {},
-
-  swapBrowser(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);
-    } else {
-      aBrowser.messageManager.sendAsyncMessage("Finder:Initialize");
-    }
-
-    this._browser = aBrowser;
-    this._messageManager = this._browser.messageManager;
-    this._messageManager.addMessageListener("Finder:Result", this);
-    this._messageManager.addMessageListener("Finder:MatchesResult", this);
-    this._messageManager.addMessageListener("Finder:CurrentSelectionResult", this);
-    this._messageManager.addMessageListener("Finder:HighlightFinished", this);
-
-    // Ideally listeners would have removed themselves but that doesn't happen
-    // right now
-    this._listeners.clear();
-  },
-
-  addResultListener(aListener) {
-    this._listeners.add(aListener);
-  },
-
-  removeResultListener(aListener) {
-    this._listeners.delete(aListener);
-  },
+var EXPORTED_SYMBOLS = ["FinderChild"];
 
-  receiveMessage(aMessage) {
-    // Only Finder:Result messages have the searchString field.
-    let callback;
-    let params;
-    switch (aMessage.name) {
-      case "Finder:Result":
-        this._searchString = aMessage.data.searchString;
-        // The rect stops being a Geometry.jsm:Rect over IPC.
-        if (aMessage.data.rect) {
-          aMessage.data.rect = Rect.fromRect(aMessage.data.rect);
-        }
-        callback = "onFindResult";
-        params = [ aMessage.data ];
-        break;
-      case "Finder:MatchesResult":
-        callback = "onMatchesCountResult";
-        params = [ aMessage.data ];
-        break;
-      case "Finder:CurrentSelectionResult":
-        callback = "onCurrentSelection";
-        params = [ aMessage.data.selection, aMessage.data.initial ];
-        break;
-      case "Finder:HighlightFinished":
-        callback = "onHighlightFinished";
-        params = [ aMessage.data ];
-        break;
-    }
+ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
 
-    for (let l of this._listeners) {
-      // Don't let one callback throwing stop us calling the rest
-      try {
-        l[callback].apply(l, params);
-      } catch (e) {
-        if (!l[callback]) {
-          Cu.reportError(`Missing ${callback} callback on RemoteFinderListener`);
-        } else {
-          Cu.reportError(e);
-        }
-      }
-    }
-  },
-
-  get searchString() {
-    return this._searchString;
-  },
-
-  get clipboardSearchString() {
-    return GetClipboardSearchString(this._browser.loadContext);
-  },
-
-  setSearchStringToSelection() {
-    this._browser.messageManager.sendAsyncMessage("Finder:SetSearchStringToSelection", {});
-  },
-
-  set caseSensitive(aSensitive) {
-    this._browser.messageManager.sendAsyncMessage("Finder:CaseSensitive",
-                                                  { caseSensitive: aSensitive });
-  },
-
-  set entireWord(aEntireWord) {
-    this._browser.messageManager.sendAsyncMessage("Finder:EntireWord",
-                                                  { entireWord: aEntireWord });
-  },
+ChromeUtils.defineModuleGetter(this, "Finder",
+                               "resource://gre/modules/Finder.jsm");
 
-  getInitialSelection() {
-    this._browser.messageManager.sendAsyncMessage("Finder:GetInitialSelection", {});
-  },
-
-  fastFind(aSearchString, aLinksOnly, aDrawOutline) {
-    this._browser.messageManager.sendAsyncMessage("Finder:FastFind",
-                                                  { searchString: aSearchString,
-                                                    linksOnly: aLinksOnly,
-                                                    drawOutline: aDrawOutline });
-  },
-
-  findAgain(aFindBackwards, aLinksOnly, aDrawOutline) {
-    this._browser.messageManager.sendAsyncMessage("Finder:FindAgain",
-                                                  { findBackwards: aFindBackwards,
-                                                    linksOnly: aLinksOnly,
-                                                    drawOutline: aDrawOutline });
-  },
-
-  highlight(aHighlight, aWord, aLinksOnly) {
-    this._browser.messageManager.sendAsyncMessage("Finder:Highlight",
-                                                  { highlight: aHighlight,
-                                                    linksOnly: aLinksOnly,
-                                                    word: aWord });
-  },
-
-  enableSelection() {
-    this._browser.messageManager.sendAsyncMessage("Finder:EnableSelection");
-  },
-
-  removeSelection() {
-    this._browser.messageManager.sendAsyncMessage("Finder:RemoveSelection");
-  },
-
-  focusContent() {
-    // Allow Finder listeners to cancel focusing the content.
-    for (let l of this._listeners) {
-      try {
-        if ("shouldFocusContent" in l &&
-            !l.shouldFocusContent())
-          return;
-      } catch (ex) {
-        Cu.reportError(ex);
-      }
-    }
-
-    this._browser.focus();
-    this._browser.messageManager.sendAsyncMessage("Finder:FocusContent");
-  },
-
-  onFindbarClose() {
-    this._browser.messageManager.sendAsyncMessage("Finder:FindbarClose");
-  },
-
-  onFindbarOpen() {
-    this._browser.messageManager.sendAsyncMessage("Finder:FindbarOpen");
-  },
+const MESSAGES = [
+  "Finder:CaseSensitive",
+  "Finder:EntireWord",
+  "Finder:FastFind",
+  "Finder:FindAgain",
+  "Finder:SetSearchStringToSelection",
+  "Finder:GetInitialSelection",
+  "Finder:Highlight",
+  "Finder:HighlightAllChange",
+  "Finder:EnableSelection",
+  "Finder:RemoveSelection",
+  "Finder:FocusContent",
+  "Finder:FindbarClose",
+  "Finder:FindbarOpen",
+  "Finder:KeyPress",
+  "Finder:MatchesCount",
+  "Finder:ModalHighlightChange"
+];
 
-  onModalHighlightChange(aUseModalHighlight) {
-    this._browser.messageManager.sendAsyncMessage("Finder:ModalHighlightChange", {
-      useModalHighlight: aUseModalHighlight
-    });
-  },
-
-  onHighlightAllChange(aHighlightAll) {
-    this._browser.messageManager.sendAsyncMessage("Finder:HighlightAllChange", {
-      highlightAll: aHighlightAll
-    });
-  },
-
-  keyPress(aEvent) {
-    this._browser.messageManager.sendAsyncMessage("Finder:KeyPress",
-                                                  { keyCode: aEvent.keyCode,
-                                                    ctrlKey: aEvent.ctrlKey,
-                                                    metaKey: aEvent.metaKey,
-                                                    altKey: aEvent.altKey,
-                                                    shiftKey: aEvent.shiftKey });
-  },
-
-  requestMatchesCount(aSearchString, aLinksOnly) {
-    this._browser.messageManager.sendAsyncMessage("Finder:MatchesCount",
-                                                  { searchString: aSearchString,
-                                                    linksOnly: aLinksOnly });
-  }
-};
+class FinderChild extends ActorChild {
+  constructor(mm) {
+    super(mm);
 
-function RemoteFinderListener(global) {
-  let {Finder} = ChromeUtils.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);
-  }
-}
+    this._finder = new Finder(mm.docShell);
+    this._finder.addResultListener(this);
 
-RemoteFinderListener.prototype = {
-  MESSAGES: [
-    "Finder:CaseSensitive",
-    "Finder:EntireWord",
-    "Finder:FastFind",
-    "Finder:FindAgain",
-    "Finder:SetSearchStringToSelection",
-    "Finder:GetInitialSelection",
-    "Finder:Highlight",
-    "Finder:HighlightAllChange",
-    "Finder:EnableSelection",
-    "Finder:RemoveSelection",
-    "Finder:FocusContent",
-    "Finder:FindbarClose",
-    "Finder:FindbarOpen",
-    "Finder:KeyPress",
-    "Finder:MatchesCount",
-    "Finder:ModalHighlightChange"
-  ],
+    for (let msg of MESSAGES) {
+      mm.addMessageListener(msg, this);
+    }
+  }
 
   onFindResult(aData) {
-    this._global.sendAsyncMessage("Finder:Result", aData);
-  },
+    this.mm.sendAsyncMessage("Finder:Result", aData);
+  }
 
   // When the child receives messages with results of requestMatchesCount,
   // it passes them forward to the parent.
   onMatchesCountResult(aData) {
-    this._global.sendAsyncMessage("Finder:MatchesResult", aData);
-  },
+    this.mm.sendAsyncMessage("Finder:MatchesResult", aData);
+  }
 
   onHighlightFinished(aData) {
-    this._global.sendAsyncMessage("Finder:HighlightFinished", aData);
-  },
+    this.mm.sendAsyncMessage("Finder:HighlightFinished", aData);
+  }
 
   receiveMessage(aMessage) {
     let data = aMessage.data;
 
     switch (aMessage.name) {
       case "Finder:CaseSensitive":
         this._finder.caseSensitive = data.caseSensitive;
         break;
 
       case "Finder:EntireWord":
         this._finder.entireWord = data.entireWord;
         break;
 
       case "Finder:SetSearchStringToSelection": {
         let selection = this._finder.setSearchStringToSelection();
-        this._global.sendAsyncMessage("Finder:CurrentSelectionResult",
-                                      { selection,
-                                        initial: false });
+        this.mm.sendAsyncMessage("Finder:CurrentSelectionResult",
+                                 { selection,
+                                   initial: false });
         break;
       }
 
       case "Finder:GetInitialSelection": {
         let selection = this._finder.getActiveSelectionText();
-        this._global.sendAsyncMessage("Finder:CurrentSelectionResult",
-                                      { selection,
-                                        initial: true });
+        this.mm.sendAsyncMessage("Finder:CurrentSelectionResult",
+                                 { selection,
+                                   initial: true });
         break;
       }
 
       case "Finder:FastFind":
         this._finder.fastFind(data.searchString, data.linksOnly, data.drawOutline);
         break;
 
       case "Finder:FindAgain":
@@ -323,17 +129,9 @@ RemoteFinderListener.prototype = {
         this._finder.requestMatchesCount(data.searchString, data.linksOnly);
         break;
 
       case "Finder:ModalHighlightChange":
         this._finder.onModalHighlightChange(data.useModalHighlight);
         break;
     }
   }
-};
-
-XPCOMUtils.defineLazyPreferenceGetter(RemoteFinder, "_typeAheadLinksOnly",
-  "accessibility.typeaheadfind.linksonly");
-XPCOMUtils.defineLazyPreferenceGetter(RemoteFinder, "_findAsYouType",
-  "accessibility.typeaheadfind");
-XPCOMUtils.defineLazyPreferenceGetter(RemoteFinder, "_manualFAYT",
-  "accessibility.typeaheadfind.manual");
-
+}
--- a/toolkit/actors/moz.build
+++ b/toolkit/actors/moz.build
@@ -1,19 +1,23 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+with Files('Finder*.jsm'):
+    BUG_COMPONENT = ('Toolkit', 'Find Toolbar')
+
 FINAL_TARGET_FILES.actors += [
     'AudioPlaybackChild.jsm',
     'ControllersChild.jsm',
     'DateTimePickerChild.jsm',
     'FindBarChild.jsm',
+    'FinderChild.jsm',
     'PopupBlockingChild.jsm',
     'PrintingChild.jsm',
     'PurgeSessionHistoryChild.jsm',
     'SelectChild.jsm',
     'SelectionSourceChild.jsm',
     'ThumbnailsChild.jsm',
     'UnselectedTabHoverChild.jsm',
     'WebChannelChild.jsm',
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -21,22 +21,16 @@ ChromeUtils.defineModuleGetter(this, "Fi
   "resource://gre/modules/FindContent.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "formFill",
                                    "@mozilla.org/satchel/form-fill-controller;1",
                                    "nsIFormFillController");
 
 var global = this;
 
-// Lazily load the finder code
-addMessageListener("Finder:Initialize", function() {
-  let {RemoteFinderListener} = ChromeUtils.import("resource://gre/modules/RemoteFinder.jsm", {});
-  new RemoteFinderListener(global);
-});
-
 var AutoScrollListener = {
   handleEvent(event) {
     if (event.isTrusted &
         !event.defaultPrevented &&
         event.button == 1) {
       if (!this._controller) {
         this._controller = new AutoScrollController(global);
       }
--- a/toolkit/content/widgets/remote-browser.xml
+++ b/toolkit/content/widgets/remote-browser.xml
@@ -58,19 +58,19 @@
       <property name="finder" readonly="true">
         <getter><![CDATA[
           if (!this._remoteFinder) {
             // Don't attempt to create the remote finder if the
             // messageManager has already gone away
             if (!this.messageManager)
               return null;
 
-            let jsm = "resource://gre/modules/RemoteFinder.jsm";
-            let { RemoteFinder } = ChromeUtils.import(jsm, {});
-            this._remoteFinder = new RemoteFinder(this);
+            let jsm = "resource://gre/modules/FinderParent.jsm";
+            let { FinderParent } = ChromeUtils.import(jsm, {});
+            this._remoteFinder = new FinderParent(this);
           }
           return this._remoteFinder;
         ]]></getter>
       </property>
 
       <field name="_documentURI">null</field>
 
       <field name="_documentContentType">null</field>
--- a/toolkit/modules/ActorManagerParent.jsm
+++ b/toolkit/modules/ActorManagerParent.jsm
@@ -135,16 +135,25 @@ let ACTORS = {
     child: {
       module: "resource://gre/actors/FindBarChild.jsm",
       events: {
         "keypress": {mozSystemGroup: true},
       },
     },
   },
 
+  Finder: {
+    child: {
+      module: "resource://gre/actors/FinderChild.jsm",
+      messages: [
+        "Finder:Initialize",
+      ],
+    },
+  },
+
   ManifestMessages: {
     child: {
       module: "resource://gre/modules/ManifestMessagesChild.jsm",
       group: "browsers",
       messages: [
         "DOM:Manifest:FireAppInstalledEvent",
         "DOM:ManifestObtainer:Obtain",
         "DOM:WebManifest:fetchIcon",
--- a/toolkit/modules/FindBarContent.jsm
+++ b/toolkit/modules/FindBarContent.jsm
@@ -1,18 +1,18 @@
 // vim: set ts=2 sw=2 sts=2 tw=80:
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 "use strict";
 
 var EXPORTED_SYMBOLS = ["FindBarContent"];
 
-ChromeUtils.defineModuleGetter(this, "RemoteFinder",
-                               "resource://gre/modules/RemoteFinder.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+
 ChromeUtils.defineModuleGetter(this, "Services",
                                "resource://gre/modules/Services.jsm");
 
 /* Please keep in sync with toolkit/content/widgets/findbar.xml */
 const FIND_NORMAL = 0;
 const FIND_TYPEAHEAD = 1;
 const FIND_LINKS = 2;
 
@@ -30,17 +30,17 @@ class FindBarContent {
 
   start(event) {
     this.inPassThrough = true;
   }
 
   startQuickFind(event, autostart = false) {
     let mode = FIND_TYPEAHEAD;
     if (event.charCode == "'".charAt(0) ||
-        autostart && RemoteFinder._typeAheadLinksOnly) {
+        autostart && FindBarContent.typeAheadLinksOnly) {
       mode = FIND_LINKS;
     }
 
     // Set findMode immediately (without waiting for child->parent->child roundtrip)
     // to ensure we pass any further keypresses, too.
     this.findMode = mode;
     this.passKeyToParent(event);
   }
@@ -92,8 +92,11 @@ class FindBarContent {
     this.mm.sendAsyncMessage("Findbar:Keypress", fakeEvent);
   }
 
   onMouseup(event) {
     if (this.findMode != FIND_NORMAL)
       this.mm.sendAsyncMessage("Findbar:Mouseup");
   }
 }
+
+XPCOMUtils.defineLazyPreferenceGetter(FindBarContent, "typeAheadLinksOnly",
+  "accessibility.typeaheadfind.linksonly");
copy from toolkit/modules/RemoteFinder.jsm
copy to toolkit/modules/FinderParent.jsm
--- a/toolkit/modules/RemoteFinder.jsm
+++ b/toolkit/modules/FinderParent.jsm
@@ -1,34 +1,30 @@
 // -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
 // vim: set ts=2 sw=2 sts=2 et tw=80: */
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-var EXPORTED_SYMBOLS = ["RemoteFinder", "RemoteFinderListener"];
+var EXPORTED_SYMBOLS = ["FinderParent"];
 
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/Geometry.jsm");
+ChromeUtils.defineModuleGetter(this, "GetClipboardSearchString",
+                               "resource://gre/modules/Finder.jsm");
 
-XPCOMUtils.defineLazyGetter(this, "GetClipboardSearchString",
-  () => ChromeUtils.import("resource://gre/modules/Finder.jsm", {}).GetClipboardSearchString
-);
-XPCOMUtils.defineLazyGetter(this, "Rect",
-  () => ChromeUtils.import("resource://gre/modules/Geometry.jsm", {}).Rect
-);
+ChromeUtils.defineModuleGetter(this, "Rect",
+                               "resource://gre/modules/Geometry.jsm");
 
-function RemoteFinder(browser) {
+function FinderParent(browser) {
   this._listeners = new Set();
   this._searchString = null;
 
   this.swapBrowser(browser);
 }
 
-RemoteFinder.prototype = {
+FinderParent.prototype = {
   destroy() {},
 
   swapBrowser(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);
@@ -199,141 +195,8 @@ RemoteFinder.prototype = {
   },
 
   requestMatchesCount(aSearchString, aLinksOnly) {
     this._browser.messageManager.sendAsyncMessage("Finder:MatchesCount",
                                                   { searchString: aSearchString,
                                                     linksOnly: aLinksOnly });
   }
 };
-
-function RemoteFinderListener(global) {
-  let {Finder} = ChromeUtils.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);
-  }
-}
-
-RemoteFinderListener.prototype = {
-  MESSAGES: [
-    "Finder:CaseSensitive",
-    "Finder:EntireWord",
-    "Finder:FastFind",
-    "Finder:FindAgain",
-    "Finder:SetSearchStringToSelection",
-    "Finder:GetInitialSelection",
-    "Finder:Highlight",
-    "Finder:HighlightAllChange",
-    "Finder:EnableSelection",
-    "Finder:RemoveSelection",
-    "Finder:FocusContent",
-    "Finder:FindbarClose",
-    "Finder:FindbarOpen",
-    "Finder:KeyPress",
-    "Finder:MatchesCount",
-    "Finder:ModalHighlightChange"
-  ],
-
-  onFindResult(aData) {
-    this._global.sendAsyncMessage("Finder:Result", aData);
-  },
-
-  // When the child receives messages with results of requestMatchesCount,
-  // it passes them forward to the parent.
-  onMatchesCountResult(aData) {
-    this._global.sendAsyncMessage("Finder:MatchesResult", aData);
-  },
-
-  onHighlightFinished(aData) {
-    this._global.sendAsyncMessage("Finder:HighlightFinished", aData);
-  },
-
-  receiveMessage(aMessage) {
-    let data = aMessage.data;
-
-    switch (aMessage.name) {
-      case "Finder:CaseSensitive":
-        this._finder.caseSensitive = data.caseSensitive;
-        break;
-
-      case "Finder:EntireWord":
-        this._finder.entireWord = data.entireWord;
-        break;
-
-      case "Finder:SetSearchStringToSelection": {
-        let selection = this._finder.setSearchStringToSelection();
-        this._global.sendAsyncMessage("Finder:CurrentSelectionResult",
-                                      { selection,
-                                        initial: false });
-        break;
-      }
-
-      case "Finder:GetInitialSelection": {
-        let selection = this._finder.getActiveSelectionText();
-        this._global.sendAsyncMessage("Finder:CurrentSelectionResult",
-                                      { selection,
-                                        initial: true });
-        break;
-      }
-
-      case "Finder:FastFind":
-        this._finder.fastFind(data.searchString, data.linksOnly, data.drawOutline);
-        break;
-
-      case "Finder:FindAgain":
-        this._finder.findAgain(data.findBackwards, data.linksOnly, data.drawOutline);
-        break;
-
-      case "Finder:Highlight":
-        this._finder.highlight(data.highlight, data.word, data.linksOnly);
-        break;
-
-      case "Finder:HighlightAllChange":
-        this._finder.onHighlightAllChange(data.highlightAll);
-        break;
-
-      case "Finder:EnableSelection":
-        this._finder.enableSelection();
-        break;
-
-      case "Finder:RemoveSelection":
-        this._finder.removeSelection();
-        break;
-
-      case "Finder:FocusContent":
-        this._finder.focusContent();
-        break;
-
-      case "Finder:FindbarClose":
-        this._finder.onFindbarClose();
-        break;
-
-      case "Finder:FindbarOpen":
-        this._finder.onFindbarOpen();
-        break;
-
-      case "Finder:KeyPress":
-        var KeyboardEvent = this._finder._getWindow().KeyboardEvent;
-        this._finder.keyPress(new KeyboardEvent("keypress", data));
-        break;
-
-      case "Finder:MatchesCount":
-        this._finder.requestMatchesCount(data.searchString, data.linksOnly);
-        break;
-
-      case "Finder:ModalHighlightChange":
-        this._finder.onModalHighlightChange(data.useModalHighlight);
-        break;
-    }
-  }
-};
-
-XPCOMUtils.defineLazyPreferenceGetter(RemoteFinder, "_typeAheadLinksOnly",
-  "accessibility.typeaheadfind.linksonly");
-XPCOMUtils.defineLazyPreferenceGetter(RemoteFinder, "_findAsYouType",
-  "accessibility.typeaheadfind");
-XPCOMUtils.defineLazyPreferenceGetter(RemoteFinder, "_manualFAYT",
-  "accessibility.typeaheadfind.manual");
-
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -122,19 +122,16 @@ with Files('PrivateBrowsingUtils.jsm'):
     BUG_COMPONENT = ('Firefox', 'Private Browsing')
 
 with Files('Promise*.jsm'):
     BUG_COMPONENT = ('Toolkit', 'Async Tooling')
 
 with Files('RemoteController.js'):
     BUG_COMPONENT = ('Core', 'Widget')
 
-with Files('RemoteFinder.jsm'):
-    BUG_COMPONENT = ('Toolkit', 'Find Toolbar')
-
 with Files('RemoteSecurityUI.jsm'):
     BUG_COMPONENT = ('Firefox', 'Tabbed Browser')
 
 with Files('RemoteWebProgress.jsm'):
     BUG_COMPONENT = ('Core', 'Document Navigation')
 
 with Files('ResponsivenessMonitor.jsm'):
     BUG_COMPONENT = ('Firefox', 'Migration')
@@ -201,16 +198,17 @@ EXTRA_JS_MODULES += [
     'Deprecated.jsm',
     'E10SUtils.jsm',
     'EventEmitter.jsm',
     'FileUtils.jsm',
     'FindBarContent.jsm',
     'Finder.jsm',
     'FinderHighlighter.jsm',
     'FinderIterator.jsm',
+    'FinderParent.jsm',
     'FormLikeFactory.jsm',
     'Geometry.jsm',
     'GMPExtractorWorker.js',
     'GMPInstallManager.jsm',
     'GMPUtils.jsm',
     'Http.jsm',
     'IndexedDB.jsm',
     'InlineSpellChecker.jsm',
@@ -229,17 +227,16 @@ EXTRA_JS_MODULES += [
     'Preferences.jsm',
     'PrivateBrowsingUtils.jsm',
     'ProfileAge.jsm',
     'Promise-backend.js',
     'Promise.jsm',
     'PromiseMessage.jsm',
     'PromiseUtils.jsm',
     'RemoteController.js',
-    'RemoteFinder.jsm',
     'RemoteSecurityUI.jsm',
     'RemoteWebProgress.jsm',
     'ResetProfile.jsm',
     'ResponsivenessMonitor.jsm',
     'SelectParentHelper.jsm',
     'ServiceRequest.jsm',
     'Services.jsm',
     'sessionstore/FormData.jsm',
--- a/tools/lint/eslint/modules.json
+++ b/tools/lint/eslint/modules.json
@@ -162,17 +162,16 @@
   "PromiseWorker.jsm": ["BasePromiseWorker"],
   "PushCrypto.jsm": ["PushCrypto", "concatArray"],
   "quit.js": ["goQuitApplication"],
   "Readability.js": ["Readability"],
   "record.js": ["WBORecord", "RecordManager", "CryptoWrapper", "CollectionKeyManager", "Collection"],
   "recursive_importA.jsm": ["foo", "bar"],
   "recursive_importB.jsm": ["baz", "qux"],
   "reflect.jsm": ["Reflect"],
-  "RemoteFinder.jsm": ["RemoteFinder", "RemoteFinderListener"],
   "RemotePageManagerChild.jsm": ["ChildMessagePort"],
   "RemotePageManagerParent.jsm": ["RemotePages", "RemotePageManager"],
   "RemoteWebProgress.jsm": ["RemoteWebProgressManager"],
   "resource.js": ["AsyncResource", "Resource"],
   "rest.js": ["RESTRequest", "RESTResponse", "TokenAuthenticatedRESTRequest"],
   "rotaryengine.js": ["RotaryEngine", "RotaryRecord", "RotaryStore", "RotaryTracker"],
   "require.js": ["require"],
   "RTCStatsReport.jsm": ["convertToRTCStatsReport"],