Bug 1684857 - [devtools] Export current DAMP runner from damp.js r=ochameau,perftest-reviewers,kimberlythegeek

Depends on D97733

Exporting the current DAMP runner as a singleton from damp.js simplifies the dependency management between damp.js and head.js

Differential Revision: https://phabricator.services.mozilla.com/D100670
This commit is contained in:
Julian Descottes 2021-01-06 08:26:52 +00:00
Родитель 7c4527f7ab
Коммит a3709d6c16
3 изменённых файлов: 7 добавлений и 17 удалений

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

@ -54,9 +54,8 @@ this.damp = class extends ExtensionAPI {
loader.loader.globals.rootURI = rootURI;
loader.loader.globals.dampWindow = context.appWindow;
dump("[damp-api] Instanciate the DAMP runner and start the test\n");
const { Damp } = require("damp-test/damp");
const damp = new Damp();
dump("[damp-api] Retrieve the DAMP runner and start the test\n");
const { damp } = require("damp-test/damp");
return damp.startTest();
},
},

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

@ -19,7 +19,6 @@ const Services = require("Services");
const { AddonManager } = require("resource://gre/modules/AddonManager.jsm");
const DampLoadParentModule = require("damp-test/actors/DampLoadParent.jsm");
const dampTestHead = require("damp-test/tests/head.js");
const DAMP_TESTS = require("damp-test/damp-tests.js");
const env = Cc["@mozilla.org/process/environment;1"].getService(
@ -245,9 +244,6 @@ Damp.prototype = {
// Name of the test currently executed (i.e. path from /tests folder)
_currentTest: null,
// Is DAMP finished executing? Help preventing async execution when DAMP had an error
_done: false,
_runNextTest() {
clearTimeout(this._timeout);
@ -340,6 +336,7 @@ Damp.prototype = {
_doneInternal() {
// Ignore any duplicated call to this method
// Call startTest() again in order to reset this flag.
if (this._done) {
return;
}
@ -438,8 +435,8 @@ Damp.prototype = {
});
try {
dump("Initialize the head file with a reference to this DAMP instance\n");
dampTestHead.initialize(this);
// Is DAMP finished executing? Help preventing async execution when DAMP had an error
this._done = false;
this._registerDampLoadActors();
@ -538,4 +535,4 @@ Damp.prototype = {
},
};
exports.Damp = Damp;
exports.damp = new Damp();

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

@ -31,13 +31,7 @@ exports.SIMPLE_URL = PAGES_BASE_URL + "simple.html";
exports.COMPLICATED_URL =
"http://www.bild.de-talos/fis/tp5n/bild.de/www.bild.de/index.html";
let damp = null;
/*
* This method should be called by js before starting the tests.
*/
exports.initialize = function(_damp) {
damp = _damp;
};
const { damp } = require("damp-test/damp");
function garbageCollect() {
return damp.garbageCollect();