bug 1523104: remote: remove unused modules; r=ato
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 12 Feb 2019 06:56:41 -0800
changeset 521079 819bb544204d
parent 521078 d7e26a1b6ef7
child 521080 8231251f03a4
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)
reviewersato
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 modules; r=ato
remote/Actor.jsm
remote/Collections.jsm
remote/MessageChannel.jsm
remote/jar.mn
deleted file mode 100644
--- a/remote/Actor.jsm
+++ /dev/null
@@ -1,72 +0,0 @@
-/* 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 = [
-  "MessageChannelActorChild",
-  "RemoteAgentActorChild",
-];
-
-const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
-const {Log} = ChromeUtils.import("chrome://remote/content/Log.jsm");
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "log", Log.get);
-
-// TODO(ato):
-// This used to have more stuff on it, but now only really does logging,
-// and I'm sure there's a better way to get the message manager logs.
-class RemoteAgentActorChild extends ActorChild {
-  get browsingContext() {
-    return this.docShell.browsingContext;
-  }
-
-  sendAsyncMessage(name, data = {}) {
-    log.trace(`<--(message ${name}) ${JSON.stringify(data)}`);
-    super.sendAsyncMessage(name, data);
-  }
-
-  receiveMessage(name, data) {
-    log.trace(`(message ${name})--> ${JSON.stringify(data)}`);
-    super.receiveMessage(name, data);
-  }
-}
-
-// TODO(ato): Move to MessageChannel.jsm?
-// TODO(ato): This can eventually be replaced by ActorChild and IPDL generation
-// TODO(ato): Can we find a shorter name?
-class MessageChannelActorChild extends RemoteAgentActorChild {
-  constructor(dispatcher) {
-    super(dispatcher);
-    this.name = `RemoteAgent:${this.constructor.name}`;
-  }
-
-  emit(eventName, params = {}) {
-    this.send({eventName, params});
-  }
-
-  send(message = {}) {
-    this.sendAsyncMessage(this.name, message);
-  }
-
-  // nsIMessageListener
-
-  async receiveMessage({name, data}) {
-    const {id, methodName, params} = data;
-
-    try {
-      const func = this[methodName];
-      if (!func) {
-        throw new Error("Unknown method: " + methodName);
-      }
-
-      const result = await func.call(this, params);
-      this.send({id, result});
-    } catch ({message, stack}) {
-      const error = `${message}\n${stack}`;
-      this.send({id, error});
-    }
-  }
-}
deleted file mode 100644
--- a/remote/Collections.jsm
+++ /dev/null
@@ -1,25 +0,0 @@
-/* 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 = ["AtomicMap"];
-
-class AtomicMap extends Map {
-  set(key, value) {
-    if (this.has(key)) {
-      throw new RangeError("Key already used: " + key);
-    }
-    super.set(key, value);
-  }
-
-  pop(key) {
-    if (!super.has(key)) {
-      throw new RangeError("No such key in map: " + key);
-    }
-    const rv = super.get(key);
-    super.delete(key);
-    return rv;
-  }
-}
deleted file mode 100644
--- a/remote/MessageChannel.jsm
+++ /dev/null
@@ -1,90 +0,0 @@
-/* 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 = ["MessageChannel"];
-
-const {AtomicMap} = ChromeUtils.import("chrome://remote/content/Collections.jsm");
-const {FatalError} = ChromeUtils.import("chrome://remote/content/Error.jsm");
-const {Log} = ChromeUtils.import("chrome://remote/content/Log.jsm");
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "log", Log.get);
-
-class MessageChannel {
-  constructor(target, channelName, messageManager) {
-    this.target = target;
-    this.name = channelName;
-    this.mm = messageManager;
-    this.mm.addMessageListener(this.name, this);
-
-    this.ids = 0;
-    this.pending = new AtomicMap();
-  }
-
-  destructor() {
-    this.mm.removeMessageListener(this.name, this);
-    this.ids = 0;
-    this.pending.clear();
-  }
-
-  send(methodName, params = {}) {
-    const id = ++this.ids;
-    const promise = new Promise((resolve, reject) => {
-      this.pending.set(id, {resolve, reject});
-    });
-
-    const msg = {id, methodName, params};
-    log.trace(`(channel ${this.name})--> ${JSON.stringify(msg)}`);
-    this.mm.sendAsyncMessage(this.name, msg);
-
-    return promise;
-  }
-
-  onevent() {}
-
-  onresponse(id, result) {
-    const {resolve} = this.pending.pop(id);
-    resolve(result);
-  }
-
-  onerror(id, error) {
-    const {reject} = this.pending.pop(id);
-    reject(new Error(error));
-  }
-
-  receiveMessage({data}) {
-    log.trace(`<--(channel ${this.name}) ${JSON.stringify(data)}`);
-
-    if (data.methodName) {
-      throw new FatalError("Circular message channel!", this);
-    }
-
-    if (data.id) {
-      const {id, error, result} = data;
-      if (error) {
-        this.onerror(id, error);
-      } else {
-        this.onresponse(id, result);
-      }
-    } else {
-      const {eventName, params = {}} = data;
-      this.onevent(eventName, params);
-    }
-  }
-
-  toString() {
-    return `[object MessageChannel ${this.name}]`;
-  }
-
-  // XPCOM
-
-  get QueryInterface() {
-    return ChromeUtils.generateQI([
-      Ci.nsIMessageListener,
-      Ci.nsISupportsWeakReference,
-    ]);
-  }
-}
--- a/remote/jar.mn
+++ b/remote/jar.mn
@@ -1,25 +1,22 @@
 # 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/.
 
 remote.jar:
 % content remote %content/
-  content/Actor.jsm (Actor.jsm)
-  content/Collections.jsm (Collections.jsm)
   content/Connection.jsm (Connection.jsm)
   content/ContentProcessSession.jsm (ContentProcessSession.jsm)
   content/Domain.jsm (Domain.jsm)
   content/Domains.jsm (Domains.jsm)
   content/Error.jsm (Error.jsm)
   content/EventEmitter.jsm (EventEmitter.jsm)
   content/Handler.jsm (Handler.jsm)
   content/Log.jsm (Log.jsm)
-  content/MessageChannel.jsm (MessageChannel.jsm)
   content/Observer.jsm (Observer.jsm)
   content/Prefs.jsm (Prefs.jsm)
   content/Protocol.jsm (Protocol.jsm)
   content/Session.jsm (Session.jsm)
   content/Sync.jsm (Sync.jsm)
   content/Target.jsm (Target.jsm)
   content/TargetListener.jsm (TargetListener.jsm)
   content/WindowManager.jsm (WindowManager.jsm)