Bug 1363539 - Remove dependency on DevTools from test_onGarbageCollection.html. r=sfink

MozReview-Commit-ID: LQ8oCAyC7sF

--HG--
extra : rebase_source : 82284076bcff9fa34d7410b22ce90bb6182d3a09
This commit is contained in:
Alexandre Poirot 2017-02-22 12:45:11 +01:00
Родитель 172da9b6e3
Коммит 097e90a04c
1 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -13,13 +13,18 @@
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
const Cu = Components.utils; const Cu = Components.utils;
Cu.import("resource://devtools/shared/Loader.jsm");
const require = devtools.require;
const { gc } = Cu.getJSTestingFunctions(); const { gc } = Cu.getJSTestingFunctions();
const Debugger = require("Debugger"); // Instanciate `Debugger` in a sandbox as Debugger requires to be created
const dbg = new Debugger(this); // in a compartment different than the debuggee.
let sandbox = Cu.Sandbox(Components.Constructor("@mozilla.org/systemprincipal;1", "nsIPrincipal")());
Cu.evalInSandbox(
"Components.utils.import('resource://gre/modules/jsdebugger.jsm');" +
"addDebuggerToGlobal(this);",
sandbox
);
const dbg = new sandbox.Debugger(this);
dbg.memory.onGarbageCollection = function (data) { dbg.memory.onGarbageCollection = function (data) {
// Don't keep calling this hook after we finish. // Don't keep calling this hook after we finish.