webapprt/RemoteDebugger.jsm
author Alexandre Poirot <poirot.alex@gmail.com>
Mon, 10 Aug 2015 05:38:56 -0700
changeset 284120 2fcd73fa8a7e713719ae9ce2c04cc6a458d7735a
parent 231684 b16c58046543597ba9b4b6632cbaacf2a32f2814
child 290604 bc6902cf586380c4566e83aac743d3f3fd4611bc
child 293241 380817d573cdfbfc4a4b4a4647cf1a53bb52c3b9
permissions -rw-r--r--
Bug 1190452 - Always import toolkit/devtools/server/main.js as CommonJS module. r=jryans

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

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

Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let { 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();
  }
}