--- a/devtools/.eslintrc
+++ b/devtools/.eslintrc
@@ -3,28 +3,32 @@
"react"
],
"globals": {
"atob": true,
"btoa": true,
"Cc": true,
"Ci": true,
"Components": true,
+ "clearInterval": true,
+ "clearTimeout": true,
"console": true,
"Cr": true,
"Cu": true,
"devtools": true,
"dump": true,
"EventEmitter": true,
"exports": true,
"isWorker": true,
"loader": true,
"module": true,
"reportError": true,
"require": true,
+ "setInterval": true,
+ "setTimeout": true,
"Services": true,
"Task": true,
"XPCNativeWrapper": true,
"XPCOMUtils": true,
"_Iterator": true,
},
"rules": {
// These are the rules that have been configured so far to match the
--- a/devtools/client/eyedropper/eyedropper.js
+++ b/devtools/client/eyedropper/eyedropper.js
@@ -4,17 +4,16 @@
const {Cc, Ci, Cu} = require("chrome");
const {rgbToHsl, rgbToColorName} =
require("devtools/client/shared/css-color").colorUtils;
const Telemetry = require("devtools/client/shared/telemetry");
const {EventEmitter} = Cu.import("resource://devtools/shared/event-emitter.js");
const promise = require("promise");
const Services = require("Services");
-const {setTimeout, clearTimeout} = Cu.import("resource://gre/modules/Timer.jsm", {});
loader.lazyGetter(this, "clipboardHelper", function() {
return Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
});
loader.lazyGetter(this, "ssService", function() {
return Cc["@mozilla.org/content/style-sheet-service;1"]
--- a/devtools/client/inspector/computed/computed.js
+++ b/devtools/client/inspector/computed/computed.js
@@ -10,17 +10,16 @@
const {Cc, Ci, Cu} = require("chrome");
const ToolDefinitions = require("devtools/client/definitions").Tools;
const {CssLogic} = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/server/actors/styles");
const promise = require("promise");
const Services = require("Services");
-const {setTimeout, clearTimeout} = Cu.import("resource://gre/modules/Timer.jsm", {});
const {OutputParser} = require("devtools/client/shared/output-parser");
const {PrefObserver, PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils");
const {createChild} = require("devtools/client/inspector/shared/utils");
const {gDevTools} = require("devtools/client/framework/devtools");
loader.lazyRequireGetter(this, "overlays",
"devtools/client/inspector/shared/style-inspector-overlays");
loader.lazyRequireGetter(this, "StyleInspectorMenu",
--- a/devtools/client/inspector/fonts/fonts.js
+++ b/devtools/client/inspector/fonts/fonts.js
@@ -2,18 +2,16 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
const {Cu} = require("chrome");
-const {setTimeout, clearTimeout} =
- Cu.import("resource://gre/modules/Timer.jsm", {});
const {gDevTools} = require("devtools/client/framework/devtools");
const Services = require("Services");
const DEFAULT_PREVIEW_TEXT = "Abc";
const PREVIEW_UPDATE_DELAY = 150;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
--- a/devtools/client/inspector/markup/markup.js
+++ b/devtools/client/inspector/markup/markup.js
@@ -32,18 +32,16 @@ const {UndoStack} = require("devtools/cl
const {editableField, InplaceEditor} =
require("devtools/client/shared/inplace-editor");
const {HTMLEditor} = require("devtools/client/inspector/markup/html-editor");
const promise = require("promise");
const Services = require("Services");
const {Tooltip} = require("devtools/client/shared/widgets/Tooltip");
const EventEmitter = require("devtools/shared/event-emitter");
const Heritage = require("sdk/core/heritage");
-const {setTimeout, clearTimeout, setInterval, clearInterval} =
- require("sdk/timers");
const {parseAttribute} =
require("devtools/client/shared/node-attribute-parser");
const ELLIPSIS = Services.prefs.getComplexValue("intl.ellipsis",
Ci.nsIPrefLocalizedString).data;
const {Task} = require("resource://gre/modules/Task.jsm");
const {scrollIntoViewIfNeeded} = require("devtools/shared/layout/utils");
const {PrefObserver} = require("devtools/client/styleeditor/utils");
--- a/devtools/client/inspector/markup/test/browser_markup_mutation_02.js
+++ b/devtools/client/inspector/markup/test/browser_markup_mutation_02.js
@@ -2,17 +2,19 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that markup-containers in the markup-view do flash when their
// corresponding DOM nodes mutate
-const {clearTimeout} = require("sdk/timers");
+// Have to use the same timer functions used by the inspector.
+const {clearTimeout} = Cu.import("resource://gre/modules/Timer.jsm", {});
+
const TEST_URL = URL_ROOT + "doc_markup_flashing.html";
// The test data contains a list of mutations to test.
// Each item is an object:
// - desc: a description of the test step, for better logging
// - mutate: a generator function that should make changes to the content DOM
// - attribute: if set, the test will expect the corresponding attribute to
// flash instead of the whole node
--- a/devtools/client/inspector/rules/rules.js
+++ b/devtools/client/inspector/rules/rules.js
@@ -6,18 +6,16 @@
/* globals gDevTools */
"use strict";
const {Cc, Ci, Cu} = require("chrome");
const promise = require("promise");
const Services = require("Services");
const {Tools} = require("devtools/client/definitions");
-const {setTimeout, clearTimeout} =
- Cu.import("resource://gre/modules/Timer.jsm", {});
const {CssLogic} = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/server/actors/styles");
const {OutputParser} = require("devtools/client/shared/output-parser");
const {PrefObserver, PREF_ORIG_SOURCES} =
require("devtools/client/styleeditor/utils");
const {ElementStyle} =
require("devtools/client/inspector/rules/models/element-style");
const {Rule} = require("devtools/client/inspector/rules/models/rule");
--- a/devtools/client/inspector/rules/views/text-property-editor.js
+++ b/devtools/client/inspector/rules/views/text-property-editor.js
@@ -1,30 +1,29 @@
/* 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";
-const {Cc, Ci, Cu} = require("chrome");
+const {Cc, Ci} = require("chrome");
const {CssLogic} = require("devtools/shared/inspector/css-logic");
const {InplaceEditor, editableField} =
require("devtools/client/shared/inplace-editor");
const {
createChild,
appendText,
advanceValidate,
blurOnMultipleProperties,
throttle
} = require("devtools/client/inspector/shared/utils");
const {
parseDeclarations,
parseSingleValue,
} = require("devtools/client/shared/css-parsing-utils");
-const {setTimeout} = Cu.import("resource://gre/modules/Timer.jsm", {});
const HTML_NS = "http://www.w3.org/1999/xhtml";
const IOService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
/**
* TextPropertyEditor is responsible for the following:
* Owns a TextProperty object.
--- a/devtools/client/inspector/shared/utils.js
+++ b/devtools/client/inspector/shared/utils.js
@@ -1,19 +1,17 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
-const {Ci, Cu} = require("chrome");
-const {setTimeout, clearTimeout} =
- Cu.import("resource://gre/modules/Timer.jsm", {});
+const {Ci} = require("chrome");
const {parseDeclarations} =
require("devtools/client/shared/css-parsing-utils");
const promise = require("promise");
loader.lazyServiceGetter(this, "domUtils",
"@mozilla.org/inspector/dom-utils;1", "inIDOMUtils");
const HTML_NS = "http://www.w3.org/1999/xhtml";
--- a/devtools/client/memory/actions/filter.js
+++ b/devtools/client/memory/actions/filter.js
@@ -1,14 +1,13 @@
/* 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";
-const { clearTimeout, setTimeout } = require("sdk/timers");
const { actions } = require("../constants");
const { refresh } = require("./refresh");
const setFilterString = exports.setFilterString = function (filterString) {
return {
type: actions.SET_FILTER_STRING,
filter: filterString
};
--- a/devtools/client/netmonitor/har/har-collector.js
+++ b/devtools/client/netmonitor/har/har-collector.js
@@ -1,16 +1,15 @@
/* 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";
const { Cu } = require("chrome");
const { defer, all } = require("promise");
-const { setTimeout, clearTimeout } = require("sdk/timers");
const { makeInfallible } = require("devtools/shared/DevToolsUtils");
const Services = require("Services");
// Helper tracer. Should be generic sharable by other modules (bug 1171927)
const trace = {
log: function (...args) {
}
};
--- a/devtools/client/projecteditor/lib/stores/local.js
+++ b/devtools/client/projecteditor/lib/stores/local.js
@@ -9,17 +9,16 @@ const { Class } = require("sdk/core/heri
const { OS } = Cu.import("resource://gre/modules/osfile.jsm", {});
const { emit } = require("sdk/event/core");
const { Store } = require("devtools/client/projecteditor/lib/stores/base");
const { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
const promise = require("promise");
const Services = require("Services");
const { on, forget } = require("devtools/client/projecteditor/lib/helpers/event");
const { FileResource } = require("devtools/client/projecteditor/lib/stores/resource");
-const {setTimeout, clearTimeout} = Cu.import("resource://gre/modules/Timer.jsm", {});
const CHECK_LINKED_DIRECTORY_DELAY = 5000;
const SHOULD_LIVE_REFRESH = true;
// XXX: Ignores should be customizable
const IGNORE_REGEX = /(^\.)|(\~$)|(^node_modules$)/;
/**
* A LocalStore object maintains a collection of Resource objects
--- a/devtools/client/shared/doorhanger.js
+++ b/devtools/client/shared/doorhanger.js
@@ -4,17 +4,16 @@
"use strict";
const { Ci, Cc } = require("chrome");
const Services = require("Services");
const { DOMHelpers } = require("resource://devtools/client/shared/DOMHelpers.jsm");
const { Task } = require("resource://gre/modules/Task.jsm");
const { Promise } = require("resource://gre/modules/Promise.jsm");
-const { setTimeout } = require("sdk/timers");
const { getMostRecentBrowserWindow } = require("sdk/window/utils");
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const DEV_EDITION_PROMO_URL = "chrome://devtools/content/framework/dev-edition-promo/dev-edition-promo.xul";
const DEV_EDITION_PROMO_ENABLED_PREF = "devtools.devedition.promo.enabled";
const DEV_EDITION_PROMO_SHOWN_PREF = "devtools.devedition.promo.shown";
const DEV_EDITION_PROMO_URL_PREF = "devtools.devedition.promo.url";
const LOCALE = Cc["@mozilla.org/chrome/chrome-registry;1"]
--- a/devtools/client/shared/poller.js
+++ b/devtools/client/shared/poller.js
@@ -1,15 +1,13 @@
/* 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";
-loader.lazyRequireGetter(this, "timers",
- "resource://gre/modules/Timer.jsm");
loader.lazyRequireGetter(this, "defer",
"promise", true);
/**
* @constructor Poller
* Takes a function that is to be called on an interval,
* and can be turned on and off via methods to execute `fn` on the interval
* specified during `on`. If `fn` returns a promise, the polling waits for
@@ -62,17 +60,17 @@ Poller.prototype.on = function pollerOn
* Turns off polling. Returns a promise that resolves when
* the last outstanding `fn` call finishes if it's an async function.
*
* @return {Promise}
*/
Poller.prototype.off = function pollerOff () {
let { resolve, promise } = defer();
if (this._timer) {
- timers.clearTimeout(this._timer);
+ clearTimeout(this._timer);
this._timer = null;
}
// Settle an inflight poll call before resolving
// if using a promise-backed poll function
if (this._inflight) {
this._inflight.then(resolve);
} else {
@@ -88,17 +86,17 @@ Poller.prototype.off = function pollerOf
Poller.prototype.destroy = function pollerDestroy () {
return this.off().then(() => {
this._destroyed = true;
this._fn = null
});
};
Poller.prototype._preparePoll = function pollerPrepare () {
- this._timer = timers.setTimeout(this._poll, this._wait);
+ this._timer = setTimeout(this._poll, this._wait);
};
Poller.prototype._poll = function pollerPoll () {
let response = this._fn();
if (response && typeof response.then === "function") {
// Store the most recent in-flight polling
// call so we can clean it up when disabling
this._inflight = response;
--- a/devtools/client/shared/widgets/CubicBezierWidget.js
+++ b/devtools/client/shared/widgets/CubicBezierWidget.js
@@ -21,17 +21,16 @@
*/
// Based on www.cubic-bezier.com by Lea Verou
// See https://github.com/LeaVerou/cubic-bezier
"use strict";
const EventEmitter = require("devtools/shared/event-emitter");
-const {setTimeout, clearTimeout} = require("sdk/timers");
const {
PREDEFINED,
PRESETS,
DEFAULT_PRESET_CATEGORY
} = require("devtools/client/shared/widgets/CubicBezierPresets");
const {Cc, Ci} = require('chrome');
loader.lazyGetter(this, "DOMUtils", () => {
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
--- a/devtools/client/webconsole/webconsole.js
+++ b/devtools/client/webconsole/webconsole.js
@@ -25,17 +25,16 @@ loader.lazyServiceGetter(this, "clipboar
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
loader.lazyRequireGetter(this, "AutocompletePopup", "devtools/client/shared/autocomplete-popup", true);
loader.lazyRequireGetter(this, "ToolSidebar", "devtools/client/framework/sidebar", true);
loader.lazyRequireGetter(this, "ConsoleOutput", "devtools/client/webconsole/console-output", true);
loader.lazyRequireGetter(this, "Messages", "devtools/client/webconsole/console-output", true);
loader.lazyRequireGetter(this, "EnvironmentClient", "devtools/shared/client/main", true);
loader.lazyRequireGetter(this, "ObjectClient", "devtools/shared/client/main", true);
loader.lazyRequireGetter(this, "system", "devtools/shared/system");
-loader.lazyRequireGetter(this, "Timers", "sdk/timers");
loader.lazyRequireGetter(this, "JSTerm", "devtools/client/webconsole/jsterm", true);
loader.lazyRequireGetter(this, "gSequenceId", "devtools/client/webconsole/jsterm", true);
loader.lazyImporter(this, "VariablesView", "resource://devtools/client/shared/widgets/VariablesView.jsm");
loader.lazyImporter(this, "VariablesViewController", "resource://devtools/client/shared/widgets/VariablesViewController.jsm");
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
loader.lazyImporter(this, "PluralForm", "resource://gre/modules/PluralForm.jsm");
const STRINGS_URI = "chrome://devtools/locale/webconsole.properties";
@@ -991,20 +990,20 @@ WebConsoleFrame.prototype = {
*/
setFilterState: function(toggleType, state) {
this.filterPrefs[toggleType] = state;
this.adjustVisibilityForMessageType(toggleType, state);
Services.prefs.setBoolPref(this._filterPrefsPrefix + toggleType, state);
if (this._updateListenersTimeout) {
- Timers.clearTimeout(this._updateListenersTimeout);
+ clearTimeout(this._updateListenersTimeout);
}
- this._updateListenersTimeout = Timers.setTimeout(
+ this._updateListenersTimeout = setTimeout(
this._onUpdateListeners, 200);
},
/**
* Get the filter state for a specific toggle button.
*
* @param string toggleType
* @returns boolean
--- a/devtools/client/webide/modules/app-manager.js
+++ b/devtools/client/webide/modules/app-manager.js
@@ -13,17 +13,16 @@ const {TextEncoder, OS} = Cu.import("re
const {AppProjects} = require("devtools/client/webide/modules/app-projects");
const TabStore = require("devtools/client/webide/modules/tab-store");
const {AppValidator} = require("devtools/client/webide/modules/app-validator");
const {ConnectionManager, Connection} = require("devtools/shared/client/connection-manager");
const {AppActorFront} = require("devtools/shared/apps/app-actor-front");
const {getDeviceFront} = require("devtools/server/actors/device");
const {getPreferenceFront} = require("devtools/server/actors/preference");
const {getSettingsFront} = require("devtools/server/actors/settings");
-const {setTimeout} = require("sdk/timers");
const {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
const {RuntimeScanners, RuntimeTypes} = require("devtools/client/webide/modules/runtimes");
const {NetUtil} = Cu.import("resource://gre/modules/NetUtil.jsm", {});
const Telemetry = require("devtools/client/shared/telemetry");
const {ProjectBuilding} = require("./build");
const Strings = Services.strings.createBundle("chrome://devtools/locale/webide.properties");
--- a/devtools/server/actors/layout.js
+++ b/devtools/server/actors/layout.js
@@ -25,17 +25,16 @@
*/
const {Ci, Cu} = require("chrome");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const protocol = require("devtools/server/protocol");
const {method, Arg} = protocol;
const events = require("sdk/event/core");
const Heritage = require("sdk/core/heritage");
-const {setTimeout, clearTimeout} = require("sdk/timers");
const EventEmitter = require("devtools/shared/event-emitter");
/**
* The reflow actor tracks reflows and emits events about them.
*/
var ReflowActor = exports.ReflowActor = protocol.ActorClass({
typeName: "reflow",
--- a/devtools/server/actors/monitor.js
+++ b/devtools/server/actors/monitor.js
@@ -2,17 +2,16 @@
* 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/. */
const {Ci,Cu,Cc} = require("chrome");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const Services = require("Services");
-var {setTimeout,clearTimeout} = require("sdk/timers");
function MonitorActor(aConnection) {
this.conn = aConnection;
this._updates = [];
this._started = false;
}
MonitorActor.prototype = {
--- a/devtools/server/actors/script.js
+++ b/devtools/server/actors/script.js
@@ -29,17 +29,17 @@ const { defer, resolve, reject, all } =
loader.lazyGetter(this, "Debugger", () => {
let Debugger = require("Debugger");
hackDebugger(Debugger);
return Debugger;
});
loader.lazyRequireGetter(this, "CssLogic", "devtools/shared/inspector/css-logic", true);
loader.lazyRequireGetter(this, "events", "sdk/event/core");
-loader.lazyRequireGetter(this, "setTimeout", "sdk/timers", true);
+loader.lazyRequireGetter(this, "mapURIToAddonID", "devtools/server/actors/utils/map-uri-to-addon-id");
/**
* A BreakpointActorMap is a map from locations to instances of BreakpointActor.
*/
function BreakpointActorMap() {
this._size = 0;
this._actors = {};
}
--- a/devtools/server/actors/storage.js
+++ b/devtools/server/actors/storage.js
@@ -7,17 +7,16 @@
const {Cc, Ci} = require("chrome");
const events = require("sdk/event/core");
const protocol = require("devtools/server/protocol");
const {LongStringActor} = require("devtools/server/actors/string");
const {DebuggerServer} = require("devtools/server/main");
const Services = require("Services");
const promise = require("promise");
const {isWindowIncluded} = require("devtools/shared/layout/utils");
-const {setTimeout, clearTimeout} = require("sdk/timers");
const specs = require("devtools/shared/specs/storage");
loader.lazyImporter(this, "OS", "resource://gre/modules/osfile.jsm");
loader.lazyImporter(this, "Sqlite", "resource://gre/modules/Sqlite.jsm");
loader.lazyImporter(this, "Task", "resource://gre/modules/Task.jsm", "Task");
var gTrackedMessageManager = new Map();
--- a/devtools/server/performance/timeline.js
+++ b/devtools/server/performance/timeline.js
@@ -20,17 +20,16 @@
* timeline.on("markers", function(markers) {...})
*/
const { Ci, Cu } = require("chrome");
const { Class } = require("sdk/core/heritage");
// Be aggressive about lazy loading, as this will run on every
// toolbox startup
loader.lazyRequireGetter(this, "events", "sdk/event/core");
-loader.lazyRequireGetter(this, "Timers", "sdk/timers");
loader.lazyRequireGetter(this, "Task", "resource://gre/modules/Task.jsm", true);
loader.lazyRequireGetter(this, "Memory", "devtools/server/performance/memory", true);
loader.lazyRequireGetter(this, "Framerate", "devtools/server/performance/framerate", true);
loader.lazyRequireGetter(this, "StackFrameCache", "devtools/server/actors/utils/stack", true);
loader.lazyRequireGetter(this, "EventTarget", "sdk/event/target", true);
// How often do we pull markers from the docShells, and therefore, how often do
// we send events to the front (knowing that when there are no markers in the
@@ -169,17 +168,17 @@ var Timeline = exports.Timeline = Class(
// Emit stack frames data if requested.
if (this._withFrames && this._withMarkers) {
let frames = this._stackFrames.makeEvent();
if (frames) {
events.emit(this, "frames", endTime, frames);
}
}
- this._dataPullTimeout = Timers.setTimeout(() => {
+ this._dataPullTimeout = setTimeout(() => {
this._pullTimelineData();
}, DEFAULT_TIMELINE_DATA_PULL_TIMEOUT);
},
/**
* Are we recording profile markers currently?
*/
isRecording: function () {
@@ -303,17 +302,17 @@ var Timeline = exports.Timeline = Class(
this._isRecording = false;
this._withMarkers = false;
this._withTicks = false;
this._withMemory = false;
this._withFrames = false;
this._withDocLoadingEvents = false;
this._withGCEvents = false;
- Timers.clearTimeout(this._dataPullTimeout);
+ clearTimeout(this._dataPullTimeout);
return endTime;
}),
/**
* When a new window becomes available in the tabActor, start recording its
* markers if we were recording.
*/
--- a/devtools/shared/DevToolsUtils.js
+++ b/devtools/shared/DevToolsUtils.js
@@ -7,17 +7,16 @@
/* General utilities used throughout devtools. */
var { Ci, Cu, Cc, components } = require("chrome");
var Services = require("Services");
var promise = require("promise");
loader.lazyRequireGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm", true);
-loader.lazyRequireGetter(this, "setTimeout", "Timer", true);
// Re-export the thread-safe utils.
const ThreadSafeDevToolsUtils = require("./ThreadSafeDevToolsUtils.js");
for (let key of Object.keys(ThreadSafeDevToolsUtils)) {
exports[key] = ThreadSafeDevToolsUtils[key];
}
/**
--- a/devtools/shared/Loader.jsm
+++ b/devtools/shared/Loader.jsm
@@ -275,20 +275,34 @@ DevToolsLoader.prototype = {
// });
//
// Bug 1248830 will work out a better plan here for our content module
// loading needs, especially as we head towards devtools.html.
define(factory) {
factory(this.require, this.exports, this.module);
},
};
- // Lazy define console in order to load Console.jsm only when it is used
+
+ // Lazily define a few things so that the corresponding jsms are
+ // only loaded when used.
XPCOMUtils.defineLazyGetter(this._provider.globals, "console", () => {
return Cu.import("resource://gre/modules/Console.jsm", {}).console;
});
+ XPCOMUtils.defineLazyGetter(this._provider.globals, "clearTimeout", () => {
+ return Cu.import("resource://gre/modules/Timer.jsm", {}).clearTimeout;
+ });
+ XPCOMUtils.defineLazyGetter(this._provider.globals, "setTimeout", () => {
+ return Cu.import("resource://gre/modules/Timer.jsm", {}).setTimeout;
+ });
+ XPCOMUtils.defineLazyGetter(this._provider.globals, "clearInterval", () => {
+ return Cu.import("resource://gre/modules/Timer.jsm", {}).clearInterval;
+ });
+ XPCOMUtils.defineLazyGetter(this._provider.globals, "setInterval", () => {
+ return Cu.import("resource://gre/modules/Timer.jsm", {}).setInterval;
+ });
this._provider.load();
this.require = Loader.Require(this._provider.loader, { id: "devtools" });
},
/**
* Choose a default tools provider based on the preferences.
*/
--- a/devtools/shared/client/connection-manager.js
+++ b/devtools/shared/client/connection-manager.js
@@ -2,17 +2,16 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
const {Cc, Ci, Cu, Cr} = require("chrome");
-const {setTimeout, clearTimeout} = require('sdk/timers');
const EventEmitter = require("devtools/shared/event-emitter");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const { DebuggerServer } = require("devtools/server/main");
const { DebuggerClient } = require("devtools/shared/client/main");
const Services = require("Services");
DevToolsUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
--- a/devtools/shared/discovery/discovery.js
+++ b/devtools/shared/discovery/discovery.js
@@ -28,17 +28,16 @@
*
* When a service is registered, is supplies a regular object with any details
* about itself (a port number, for example) in a service-defined format, which
* is then available to scanning devices.
*/
const { Cu, CC, Cc, Ci } = require("chrome");
const EventEmitter = require("devtools/shared/event-emitter");
-const { setTimeout, clearTimeout } = require("sdk/timers");
const Services = require("Services");
const UDPSocket = CC("@mozilla.org/network/udp-socket;1",
"nsIUDPSocket",
"init");
const SCAN_PORT = 50624;
const UPDATE_PORT = 50625;
--- a/devtools/shared/security/socket.js
+++ b/devtools/shared/security/socket.js
@@ -22,18 +22,16 @@ loader.lazyRequireGetter(this, "Debugger
loader.lazyRequireGetter(this, "discovery",
"devtools/shared/discovery/discovery");
loader.lazyRequireGetter(this, "cert",
"devtools/shared/security/cert");
loader.lazyRequireGetter(this, "Authenticators",
"devtools/shared/security/auth", true);
loader.lazyRequireGetter(this, "AuthenticationResult",
"devtools/shared/security/auth", true);
-loader.lazyRequireGetter(this, "setTimeout", "Timer", true);
-loader.lazyRequireGetter(this, "clearTimeout", "Timer", true);
DevToolsUtils.defineLazyGetter(this, "nsFile", () => {
return CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
});
DevToolsUtils.defineLazyGetter(this, "socketTransportService", () => {
return Cc["@mozilla.org/network/socket-transport-service;1"]
.getService(Ci.nsISocketTransportService);