bug 1523104: remote: remove unused BrowserObserver; r=ochameau
authorAndreas Tolfsen <ato@sny.no>
Thu, 07 Mar 2019 23:41:48 +0000
changeset 521138 9e035690f943de680442317056c18ce52167b903
parent 521137 53947dc827ddfbf1eaab8aaa753824c4cffc9ffe
child 521139 de44fc90347874d7bc98908fed6f7c315f2a43ca
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1523104
milestone67.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 1523104: remote: remove unused BrowserObserver; r=ochameau
remote/WindowManager.jsm
--- a/remote/WindowManager.jsm
+++ b/remote/WindowManager.jsm
@@ -1,16 +1,15 @@
 /* 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 = [
-  "BrowserObserver",
   "TabObserver",
   "WindowObserver",
   "WindowManager",
 ];
 
 const {DOMContentLoadedPromise} = ChromeUtils.import("chrome://remote/content/Sync.jsm");
 const {EventEmitter} = ChromeUtils.import("resource://gre/modules/EventEmitter.jsm");
 const {Log} = ChromeUtils.import("chrome://remote/content/Log.jsm");
@@ -26,19 +25,16 @@ XPCOMUtils.defineLazyGetter(this, "log",
 
 // TODO(ato):
 //
 // The DOM team is working on pulling browsing context related behaviour,
 // such as window and tab handling, out of product code and into the platform.
 // This will have implication for the remote agent,
 // and as the platform gains support for product-independent events
 // we can likely get rid of this entire module.
-//
-// Seen below, BrowserObserver in particular tries to emulate content
-// browser tracking across host process changes.
 
 /**
  * Observes DOMWindows as they open and close.
  *
  * The WindowObserver.Event.Open event fires when a window opens.
  * The WindowObserver.Event.Close event fires when a window closes.
  */
 class WindowObserver {
@@ -148,89 +144,16 @@ class TabObserver {
   }
 
   onWindowClose(window) {
     // TODO(ato): Is TabClose fired when the window closes?
   }
 }
 
 /**
- * BrowserObserver is more powerful than TabObserver,
- * as it watches for any content browser appearing anywhere in Gecko.
- * TabObserver on the other hand is limited to browsers associated with a tab.
- *
- * This class is currently not used by the remote agent,
- * but leave it in here because we may have use for it later
- * if we decide to allow Marionette-style chrome automation.
- */
-class BrowserObserver {
-  constructor() {
-    EventEmitter.decorate(this);
-  }
-
-  start() {
-    // TODO(ato): Theoretically it would be better to use ChromeWindow#getGroupMessageManager("Browsers")
-    // TODO(ato): Browser:Init does not cover browsers living in the parent process
-    Services.mm.addMessageListener("Browser:Init", this);
-    Services.obs.addObserver(this, "message-manager-disconnect");
-  }
-
-  stop() {
-    Services.mm.removeMessageListener("Browser:Init", this);
-    Services.obs.removeObserver(this, "message-manager-disconnect");
-  }
-
-  onBrowserInit(browser) {
-    this.emit("connected", browser);
-  }
-
-  onMessageManagerDisconnect(browser) {
-    if (!browser.isConnected) {
-      this.emit("disconnected", browser);
-    }
-  }
-
-  // nsIMessageListener
-
-  receiveMessage({name, target}) {
-    switch (name) {
-      case "Browser:Init":
-        this.onBrowserInit(target);
-        break;
-
-      default:
-        log.warn("Unknown IPC message form browser: " + name);
-        break;
-    }
-  }
-
-  // nsIObserver
-
-  observe(subject, topic) {
-    switch (topic) {
-      case "message-manager-disconnect":
-        this.onMessageManagerDisconnect(subject);
-        break;
-
-      default:
-        log.warn("Unknown system observer notification: " + topic);
-    }
-  }
-
-  // XPCOM
-
-  get QueryInterface() {
-    return ChromeUtils.generateQI([
-      Ci.nsIMessageListener,
-      Ci.nsIObserver,
-    ]);
-  }
-}
-
-/**
  * Determine if WindowProxy is part of the boundary window.
  *
  * @param {DOMWindow} boundary
  * @param {DOMWindow} target
  *
  * @return {boolean}
  */
 function isWindowIncluded(boundary, target) {