Skip to content

Commit

Permalink
Bug 1394804 - Lazy load all dependencies from DAMP. r=bgrins
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: EeT3bm6U2ZF

--HG--
extra : rebase_source : 93a4729c64509d8baa894e3488c72e26b72b8b8f
  • Loading branch information
ochameau committed Sep 20, 2017
1 parent 63b0ef8 commit 2f88cfb
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions testing/talos/talos/tests/devtools/addon/content/damp.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
Components.utils.import("resource://devtools/client/framework/gDevTools.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");

const { devtools } =
Components.utils.import("resource://devtools/shared/Loader.jsm", {});
const ThreadSafeChromeUtils = devtools.require("ThreadSafeChromeUtils");
const { EVENTS } = devtools.require("devtools/client/netmonitor/src/constants");
const { Services } = Components.utils.import("resource://gre/modules/Services.jsm", {});
const { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});

XPCOMUtils.defineLazyGetter(this, "require", function() {
let { require } =
Components.utils.import("resource://devtools/shared/Loader.jsm", {});
return require;
});
XPCOMUtils.defineLazyGetter(this, "gDevTools", function() {
let { gDevTools } = require("devtools/client/framework/devtools");
return gDevTools;
});
XPCOMUtils.defineLazyGetter(this, "EVENTS", function() {
let { EVENTS } = require("devtools/client/netmonitor/src/constants");
return EVENTS;
});
XPCOMUtils.defineLazyGetter(this, "TargetFactory", function() {
let { TargetFactory } = require("devtools/client/framework/target");
return TargetFactory;
});
XPCOMUtils.defineLazyGetter(this, "ThreadSafeChromeUtils", function() {
return require("ThreadSafeChromeUtils");
});

const webserver = Services.prefs.getCharPref("addon.test.damp.webserver");

Expand Down Expand Up @@ -65,7 +81,7 @@ Damp.prototype = {

openToolbox(tool = "webconsole") {
let tab = getActiveTab(getMostRecentBrowserWindow());
let target = devtools.TargetFactory.forTab(tab);
let target = TargetFactory.forTab(tab);
let startRecordTimestamp = performance.now();
let showPromise = gDevTools.showToolbox(target, tool);

Expand All @@ -80,7 +96,7 @@ Damp.prototype = {

closeToolbox: Task.async(function* () {
let tab = getActiveTab(getMostRecentBrowserWindow());
let target = devtools.TargetFactory.forTab(tab);
let target = TargetFactory.forTab(tab);
yield target.client.waitForRequestsToSettle();
let startRecordTimestamp = performance.now();
yield gDevTools.closeToolbox(target);
Expand All @@ -92,7 +108,7 @@ Damp.prototype = {

saveHeapSnapshot(label) {
let tab = getActiveTab(getMostRecentBrowserWindow());
let target = devtools.TargetFactory.forTab(tab);
let target = TargetFactory.forTab(tab);
let toolbox = gDevTools.getToolbox(target);
let panel = toolbox.getCurrentPanel();
let memoryFront = panel.panelWin.gFront;
Expand Down Expand Up @@ -465,7 +481,7 @@ Damp.prototype = {
*/
waitForAllRequestsFinished() {
let tab = getActiveTab(getMostRecentBrowserWindow());
let target = devtools.TargetFactory.forTab(tab);
let target = TargetFactory.forTab(tab);
let toolbox = gDevTools.getToolbox(target);
let window = toolbox.getCurrentPanel().panelWin;

Expand Down

0 comments on commit 2f88cfb

Please sign in to comment.