diff --git a/testing/talos/talos/tests/devtools/addon/bootstrap.js b/testing/talos/talos/tests/devtools/addon/bootstrap.js
index 7a6fa61c561f..f753c05b0e8b 100644
--- a/testing/talos/talos/tests/devtools/addon/bootstrap.js
+++ b/testing/talos/talos/tests/devtools/addon/bootstrap.js
@@ -11,7 +11,6 @@
// Reads the chrome.manifest from a legacy non-restartless extension and loads
// its overlays into the appropriate top-level windows.
-ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const windowTracker = {
@@ -35,12 +34,6 @@ const windowTracker = {
},
};
-function readSync(uri) {
- let channel = NetUtil.newChannel({uri, loadUsingSystemPrincipal: true});
- let buffer = NetUtil.readInputStream(channel.open2());
- return new TextDecoder().decode(buffer);
-}
-
function startup(data, reason) {
Services.scriptloader.loadSubScript(data.resourceURI.resolve("content/initialize_browser.js"));
windowTracker.init();
diff --git a/testing/talos/talos/tests/devtools/addon/content/addon-test-frontend.js b/testing/talos/talos/tests/devtools/addon/content/addon-test-frontend.js
index e00c562c4fc7..35452b13b747 100644
--- a/testing/talos/talos/tests/devtools/addon/content/addon-test-frontend.js
+++ b/testing/talos/talos/tests/devtools/addon/content/addon-test-frontend.js
@@ -1,12 +1,6 @@
// This file is the common bits for the test runner frontend, originally
// extracted out of the tart.html frontend when creating the damp test.
-/* globals updateConfig, defaultConfig, config */ /* from damp.html */
-
-function $(id) {
- return document.getElementById(id);
-}
-
// Executes command at the chrome process.
// Limited to one argument (data), which is enough for TART.
// doneCallback will be called once done and, if applicable, with the result as argument.
@@ -29,136 +23,12 @@ function chromeExec(commandName, data, doneCallback) {
);
}
-function toClipboard(text) {
- chromeExec("toClipboard", text);
-}
-
function runTest(config, doneCallback) {
chromeExec("runTest", config, doneCallback);
}
-function sum(values) {
- return values.reduce(function(a, b) { return a + b; });
-}
-
-function average(values) {
- return values.length ? sum(values) / values.length : 999999999;
-}
-
-function stddev(values, avg) {
- if (undefined == avg) avg = average(values);
- if (values.length <= 1) return 0;
-
- return Math.sqrt(
- values.map(function(v) { return Math.pow(v - avg, 2); })
- .reduce(function(a, b) { return a + b; }) / (values.length - 1));
-}
-
-var lastResults = '["[no results collected]"]';
-
-function doneTest(dispResult) {
- $("hide-during-run").style.display = "block";
- $("show-during-run").style.display = "none";
- if (dispResult) {
- // Array of test results, each element has .name and .value (test name and test result).
- // Test result may also be an array of numeric values (all the intervals)
-
- lastResults = JSON.stringify(dispResult); // for "Copy to clipboard" button
-
- var stats = {}; // Used for average, stddev when repeat!=1
- var isRepeat = false;
-
- for (var i in dispResult) {
- var di = dispResult[i];
- var disp = [].concat(di.value).map(function(a) { return " " + (isNaN(a) ? -1 : a.toFixed(1)); }).join(" ");
- dispResult[i] = String(di.name) + ": " + disp;
- if (di.name.includes(".half") || di.name.includes(".all"))
- dispResult[i] = "" + dispResult[i] + "";
- if (di.name.includes(".raw"))
- dispResult[i] = " " + dispResult[i]; // Add space before raw results (which are the first result of an animation)
-
- // stats:
- if (!di.name.includes(".raw")) {
- if (!stats[di.name]) {
- stats[di.name] = [];
- } else {
- isRepeat = true;
- }
-
- stats[di.name].push(di.value);
- }
- }
-
- var dispStats = "";
- if (isRepeat) {
- dispStats = "
Aggregated: ";
- for (var s in stats) {
- if (s.includes(".half") )
- dispStats += " ";
- dispStats += s + " Average (" + stats[s].length + "): " + average(stats[s]).toFixed(2) + " stddev: " + stddev(stats[s]).toFixed(2) + " ";
- }
-
- dispStats += "Individual animations: ";
- }
-
- // eslint-disable-next-line no-unsanitized/property
- $("run-results").innerHTML = " Results : " + dispStats + dispResult.join(" ");
- }
-}
-
-function triggerStart() {
- updateConfig();
- $("hide-during-run").style.display = "none";
- $("show-during-run").style.display = "block";
- $("run-results").innerHTML = "";
-
- runTest(config, doneTest);
-}
-
-function deselectAll() {
- for (var test of defaultConfig.subtests) {
- $("subtest-" + test.name).checked = false;
- }
-}
-
-// E.g. returns "world" for key "hello", "2014" for key "year", and "" for key "dummy":
-// http://localhost/x.html#hello=world&x=12&year=2014
-function getUriHashValue(key) {
- var k = String(key) + "=";
- var uriVars = unescape(document.location.hash).substr(1).split("&");
- for (var i in uriVars) {
- if (uriVars[i].indexOf(k) == 0)
- return uriVars[i].substr(k.length);
- }
- return "";
-}
-
-// URL e.g. chrome://devtools/content/devtools.html#auto&tests=["simple","iconFadeDpiCurrent"]
-// Note - there's no error checking for arguments parsing errors.
-// Any errors will express as either javascript errors or not reading the args correctly.
-// This is not an "official" part of the UI, and when used in talos, will fail early
-// enough to not cause "weird" issues too late.
-function updateOptionsFromUrl() {
- var uriTests = getUriHashValue("tests");
- var tests = uriTests ? JSON.parse(uriTests) : [];
-
- if (tests.length) {
- for (var test of defaultConfig.subtests) {
- $("subtest-" + test.name).checked = false;
- for (var t in tests) {
- if (tests[t] == test.name) {
- $("subtest-" + test.name).checked = true;
- }
- }
- }
- }
-}
-
function init() {
- updateOptionsFromUrl();
- if (document.location.hash.indexOf("#auto") == 0) {
- triggerStart();
- }
+ runTest();
}
addEventListener("load", init);
diff --git a/testing/talos/talos/tests/devtools/addon/content/damp-tests.js b/testing/talos/talos/tests/devtools/addon/content/damp-tests.js
index e8eddfd1dc70..d747605ad88a 100644
--- a/testing/talos/talos/tests/devtools/addon/content/damp-tests.js
+++ b/testing/talos/talos/tests/devtools/addon/content/damp-tests.js
@@ -4,6 +4,8 @@
"use strict";
+/* globals module */
+
/**
* This is the registry for all DAMP tests. Tests will be run in the order specified by
* the DAMP_TESTS array.
@@ -17,7 +19,7 @@
* - {Boolean} cold: set to true to run the test only during the first run of the browser
*/
-window.DAMP_TESTS = [
+module.exports = [
{
name: "inspector.cold-open",
path: "inspector/cold-open.js",
diff --git a/testing/talos/talos/tests/devtools/addon/content/damp.html b/testing/talos/talos/tests/devtools/addon/content/damp.html
index 00b83f6461f9..817f5f3a6048 100644
--- a/testing/talos/talos/tests/devtools/addon/content/damp.html
+++ b/testing/talos/talos/tests/devtools/addon/content/damp.html
@@ -1,68 +1,11 @@
-
-DAMP - Devtools At Maximum Performance
+
+ DAMP - Devtools At Maximum Performance
-
-
-
+
-