remote/Domain.jsm
author Alexandre Poirot <poirot.alex@gmail.com>
Mon, 11 Feb 2019 10:05:12 -0800
changeset 521076 f73d7c3bced4
parent 521075 bea61357248a
child 521078 d7e26a1b6ef7
permissions -rw-r--r--
bug 1523104: remote: execute the domains in the content process by piping all WebSocket request, response and events via message manager API; r=ato

/* 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 = ["Domain"];

const {EventEmitter} = ChromeUtils.import("chrome://remote/content/EventEmitter.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

class Domain {
  constructor(session, target) {
    this.session = session;
    this.target = target;
    this.name = this.constructor.name;

    EventEmitter.decorate(this);
  }

  destructor() {}

  get content() {
    return this.session.content;
  }

  get docShell() {
    return this.session.docShell;
  }

  get chromeEventHandler() {
    return this.docShell.chromeEventHandler;
  }
};

XPCOMUtils.defineLazyModuleGetters(Domain, {
  Log: "chrome://remote/content/domain/Log.jsm",
  Network: "chrome://remote/content/domain/Network.jsm",
  Page: "chrome://remote/content/domain/Page.jsm",
  Runtime: "chrome://remote/content/domain/Runtime.jsm",
});