webapprt/RemoteDebugger.jsm
author Geoff Brown <gbrown@mozilla.com>
Fri, 18 Sep 2015 13:51:57 -0600
changeset 295927 65cbc7d2133957da04265f50d9db79c7dac07994
parent 295257 380817d573cdfbfc4a4b4a4647cf1a53bb52c3b9
child 296958 1145eb49fdc74f6a641b554d649e71adfa0d4378
permissions -rw-r--r--
Bug 1206142 - Use adb as default devicemanager for Android xpcshell tests; r=jgraham

/* 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";

this.EXPORTED_SYMBOLS = ["RemoteDebugger"];

var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;

Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
var { DebuggerServer } = require("devtools/server/main");

this.RemoteDebugger = {
  init: function(port) {
    if (!DebuggerServer.initialized) {
      DebuggerServer.init();
      DebuggerServer.addBrowserActors("webapprt:webapp");
      DebuggerServer.addActors("chrome://webapprt/content/dbg-webapp-actors.js");
    }
    let listener = DebuggerServer.createListener();
    listener.portOrPath = port;
    listener.open();
  }
}