diff --git a/lib/pixel-perfect-actor.js b/lib/pixel-perfect-actor.js index 90b34dc..19402a2 100644 --- a/lib/pixel-perfect-actor.js +++ b/lib/pixel-perfect-actor.js @@ -10,19 +10,36 @@ const { Cu } = require("chrome"); -// Remote Debugging Protocol API -const { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {}); -const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); -const protocol = devtools["require"]("devtools/server/protocol"); -const { method, RetVal, ActorClass, Actor, Arg } = protocol; +// Add-on SDK const Events = require("sdk/event/core"); const DomEvents = require("sdk/dom/events"); -const { makeInfallible } = devtools["require"]("devtools/toolkit/DevToolsUtils.js"); - const { setTimeout, clearTimeout } = require("sdk/timers"); + +// Platform const { Services } = Cu.import("resource://gre/modules/Services.jsm", {}); const currentBrowserVersion = Services.appinfo.platformVersion; +// DevTools +// See also: https://bugzilla.mozilla.org/show_bug.cgi?id=912121 +var devtools; +try { + devtools = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {}).devtools; +} catch (err) { + devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools; +} + +var DevToolsUtils; +try { + DevToolsUtils = devtools["require"]("devtools/shared/DevToolsUtils"); +} catch (err) { + DevToolsUtils = devtools["require"]("devtools/toolkit/DevToolsUtils"); +} + +const { DebuggerServer } = devtools["require"]("devtools/server/main"); +const protocol = devtools["require"]("devtools/server/protocol"); +const { method, RetVal, ActorClass, Actor, Arg } = protocol; +const makeInfallible = DevToolsUtils.makeInfallible; + // For debugging purposes. Note that the tracing module isn't available // on the backend (in case of remote device debugging). // const baseUrl = "resource://pixelperfectplugin-at-openhouseconcepts-dot-com/"; diff --git a/lib/pixel-perfect-front.js b/lib/pixel-perfect-front.js index 8574737..927850c 100644 --- a/lib/pixel-perfect-front.js +++ b/lib/pixel-perfect-front.js @@ -11,7 +11,7 @@ const { Trace, TraceError } = require("firebug.sdk/lib/core/trace.js").get(modul const { PixelPerfectActor } = require("./pixel-perfect-actor.js"); const Events = require("sdk/event/core"); -const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); +const { devtools } = require("firebug.sdk/lib/core/devtools.js"); const { Front, FrontClass } = devtools["require"]("devtools/server/protocol"); /** diff --git a/lib/pixel-perfect-popup.js b/lib/pixel-perfect-popup.js index ba35524..8a88c20 100644 --- a/lib/pixel-perfect-popup.js +++ b/lib/pixel-perfect-popup.js @@ -27,8 +27,7 @@ const { Win } = require("firebug.sdk/lib/core/window.js"); const { Http } = require("firebug.sdk/lib/core/http.js"); // DevTools -const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); -const { makeInfallible } = devtools["require"]("devtools/toolkit/DevToolsUtils.js"); +const { devtools, makeInfallible } = require("firebug.sdk/lib/core/devtools.js"); // Platform Services const ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); diff --git a/lib/pixel-perfect-store.js b/lib/pixel-perfect-store.js index 596b44f..4f3ee28 100644 --- a/lib/pixel-perfect-store.js +++ b/lib/pixel-perfect-store.js @@ -19,8 +19,7 @@ const { setTimeout, clearTimeout } = require("sdk/timers"); const base64 = require("sdk/base64"); // DevTools -const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); -const { makeInfallible } = devtools["require"]("devtools/toolkit/DevToolsUtils.js"); +const { devtools, makeInfallible } = require("firebug.sdk/lib/core/devtools.js"); // File Services const { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm", {}); diff --git a/lib/start-button.js b/lib/start-button.js index 9e13899..bc7359f 100644 --- a/lib/start-button.js +++ b/lib/start-button.js @@ -27,8 +27,7 @@ const { AREA_PANEL, AREA_NAVBAR } = CustomizableUI; const { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm", {}); // DevTools -const { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {}); -const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); +const { devtools, gDevTools } = require("firebug.sdk/lib/core/devtools.js"); const startButtonId = "pixel-perfect-start-button"; diff --git a/lib/style-editor-overlay.js b/lib/style-editor-overlay.js index b36665a..d04ca16 100644 --- a/lib/style-editor-overlay.js +++ b/lib/style-editor-overlay.js @@ -19,8 +19,7 @@ const { ToolbarButton } = require("firebug.sdk/lib/toolbar-button.js"); const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; // DevTools -const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); -const { makeInfallible } = devtools["require"]("devtools/toolkit/DevToolsUtils.js"); +const { devtools, makeInfallible } = require("firebug.sdk/lib/core/devtools.js"); /** * @overlay This object represents an overlay for the existing Style Editor