Backed out 4 changesets (bug 1500074, bug 1500072) for devtools failures in browser_browserloader_mocks.js CLOSED TREE
authorNoemi Erli <nerli@mozilla.com>
Wed, 13 Feb 2019 15:32:27 +0200
changeset 458881 a3ef08e9f99e
parent 458880 ce68e72b6fb6
child 458882 d16f7174737e
push id35551
push usershindli@mozilla.com
push dateWed, 13 Feb 2019 21:34:09 +0000
treeherdermozilla-central@08f794a4928e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1500074, 1500072
milestone67.0a1
backs oute381b765ee73
7cb353ea123d
9d792d03c36b
a11b90e9e698
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 4 changesets (bug 1500074, bug 1500072) for devtools failures in browser_browserloader_mocks.js CLOSED TREE Backed out changeset e381b765ee73 (bug 1500074) Backed out changeset 7cb353ea123d (bug 1500072) Backed out changeset 9d792d03c36b (bug 1500072) Backed out changeset a11b90e9e698 (bug 1500072)
devtools/client/framework/moz.build
devtools/client/framework/test/metrics/browser_metrics_debugger.ini
devtools/client/framework/test/metrics/browser_metrics_debugger.js
devtools/client/framework/test/metrics/browser_metrics_inspector.js
devtools/client/framework/test/metrics/browser_metrics_netmonitor.ini
devtools/client/framework/test/metrics/browser_metrics_netmonitor.js
devtools/client/framework/test/metrics/browser_metrics_webconsole.js
devtools/client/framework/test/metrics/head.js
devtools/client/shared/browser-loader.js
devtools/client/webconsole/main.js
--- a/devtools/client/framework/moz.build
+++ b/devtools/client/framework/moz.build
@@ -1,19 +1,17 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 BROWSER_CHROME_MANIFESTS += [
     'test/browser.ini',
-    'test/metrics/browser_metrics_debugger.ini',
     'test/metrics/browser_metrics_inspector.ini',
-    'test/metrics/browser_metrics_netmonitor.ini',
     'test/metrics/browser_metrics_webconsole.ini',
 ]
 XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
 
 DIRS += [
     'components',
 ]
 
deleted file mode 100644
--- a/devtools/client/framework/test/metrics/browser_metrics_debugger.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-[DEFAULT]
-tags = devtools
-subsuite = devtools
-support-files =
-  head.js
-  !/devtools/client/shared/test/shared-head.js
-  !/devtools/client/shared/test/telemetry-test-helpers.js
-
-# Each metrics tests is loaded in a separate .ini file. This way the test is executed
-# individually, without any other test being executed before or after.
-[browser_metrics_debugger.js]
-skip-if = os != 'linux' || debug || asan # Results should be platform agnostic - only run on linux64-opt
deleted file mode 100644
--- a/devtools/client/framework/test/metrics/browser_metrics_debugger.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/* import-globals-from ../../../shared/test/shared-head.js */
-
-/**
- * This test records the number of modules loaded by DevTools, as well as the total count
- * of characters in those modules, when opening the debugger. These metrics are
- * retrieved by perfherder via logs.
- */
-
-const TEST_URL = "data:text/html;charset=UTF-8,<div>Debugger modules load test</div>";
-
-add_task(async function() {
-  const toolbox = await openNewTabAndToolbox(TEST_URL, "jsdebugger");
-  const panel = toolbox.getCurrentPanel();
-
-  // Retrieve the browser loader dedicated to the Debugger.
-  const debuggerLoader = panel.panelWin.getBrowserLoaderForWindow();
-  const loaders = [loader.provider.loader, debuggerLoader.loader];
-
-  runMetricsTest({
-    filterString: "devtools/client/debugger",
-    loaders,
-    panelName: "debugger",
-  });
-});
--- a/devtools/client/framework/test/metrics/browser_metrics_inspector.js
+++ b/devtools/client/framework/test/metrics/browser_metrics_inspector.js
@@ -16,14 +16,52 @@
 const TEST_URL = "data:text/html;charset=UTF-8,<div>Inspector modules load test</div>";
 
 add_task(async function() {
   await openNewTabAndToolbox(TEST_URL, "inspector");
 
   // The inspector does not use a dedicated browser loader.
   const loaders = [loader.provider.loader];
 
-  runMetricsTest({
-    filterString: "devtools/client/inspector",
-    loaders,
-    panelName: "inspector",
-  });
+  const allModules = getFilteredModules("", loaders);
+  const inspectorModules = getFilteredModules("devtools/client/inspector", loaders);
+
+  const allModulesCount = allModules.length;
+  const inspectorModulesCount = inspectorModules.length;
+
+  const allModulesChars = countCharsInModules(allModules);
+  const inspectorModulesChars = countCharsInModules(inspectorModules);
+
+  const PERFHERDER_DATA = {
+    framework: {
+      name: "devtools",
+    },
+    suites: [{
+      name: "inspector-metrics",
+      value: allModulesChars,
+      subtests: [
+        {
+          name: "inspector-modules",
+          value: inspectorModulesCount,
+        },
+        {
+          name: "inspector-chars",
+          value: inspectorModulesChars,
+        },
+        {
+          name: "all-modules",
+          value: allModulesCount,
+        },
+        {
+          name: "all-chars",
+          value: allModulesChars,
+        },
+      ],
+    }],
+  };
+  info("PERFHERDER_DATA: " + JSON.stringify(PERFHERDER_DATA));
+
+  // Simply check that we found valid values.
+  ok(allModulesCount > inspectorModulesCount &&
+     inspectorModulesCount > 0, "Successfully recorded module count for Inspector");
+  ok(allModulesChars > inspectorModulesChars &&
+     inspectorModulesChars > 0, "Successfully recorded char count for Inspector");
 });
deleted file mode 100644
--- a/devtools/client/framework/test/metrics/browser_metrics_netmonitor.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-[DEFAULT]
-tags = devtools
-subsuite = devtools
-support-files =
-  head.js
-  !/devtools/client/shared/test/shared-head.js
-  !/devtools/client/shared/test/telemetry-test-helpers.js
-
-# Each metrics tests is loaded in a separate .ini file. This way the test is executed
-# individually, without any other test being executed before or after.
-[browser_metrics_netmonitor.js]
-skip-if = os != 'linux' || debug || asan # Results should be platform agnostic - only run on linux64-opt
deleted file mode 100644
--- a/devtools/client/framework/test/metrics/browser_metrics_netmonitor.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/* import-globals-from ../../../shared/test/shared-head.js */
-
-/**
- * This test records the number of modules loaded by DevTools, as well as the total count
- * of characters in those modules, when opening the netmonitor. These metrics are
- * retrieved by perfherder via logs.
- */
-
-const TEST_URL = "data:text/html;charset=UTF-8,<div>Netmonitor modules load test</div>";
-
-add_task(async function() {
-  const toolbox = await openNewTabAndToolbox(TEST_URL, "netmonitor");
-  const panel = toolbox.getCurrentPanel();
-
-  // Retrieve the browser loader dedicated to the Netmonitor.
-  const netmonitorLoader = panel.panelWin.getBrowserLoaderForWindow();
-  const loaders = [loader.provider.loader, netmonitorLoader.loader];
-
-  runMetricsTest({
-    filterString: "devtools/client/netmonitor",
-    loaders,
-    panelName: "netmonitor",
-  });
-});
--- a/devtools/client/framework/test/metrics/browser_metrics_webconsole.js
+++ b/devtools/client/framework/test/metrics/browser_metrics_webconsole.js
@@ -12,20 +12,58 @@
  * of characters in those modules, when opening the webconsole. These metrics are
  * retrieved by perfherder via logs.
  */
 
 const TEST_URL = "data:text/html;charset=UTF-8,<div>Webconsole modules load test</div>";
 
 add_task(async function() {
   const toolbox = await openNewTabAndToolbox(TEST_URL, "webconsole");
-  const panel = toolbox.getCurrentPanel();
+  const hud = toolbox.getCurrentPanel().hud;
 
   // Retrieve the browser loader dedicated to the WebConsole.
-  const webconsoleLoader = panel._frameWindow.getBrowserLoaderForWindow();
+  const webconsoleLoader = hud.ui.browserLoader;
   const loaders = [loader.provider.loader, webconsoleLoader.loader];
 
-  runMetricsTest({
-    filterString: "devtools/client/webconsole",
-    loaders,
-    panelName: "webconsole",
-  });
+  const allModules = getFilteredModules("", loaders);
+  const webconsoleModules = getFilteredModules("devtools/client/webconsole", loaders);
+
+  const allModulesCount = allModules.length;
+  const webconsoleModulesCount = webconsoleModules.length;
+
+  const allModulesChars = countCharsInModules(allModules);
+  const webconsoleModulesChars = countCharsInModules(webconsoleModules);
+
+  const PERFHERDER_DATA = {
+    framework: {
+      name: "devtools",
+    },
+    suites: [{
+      name: "webconsole-metrics",
+      value: allModulesChars,
+      subtests: [
+        {
+          name: "webconsole-modules",
+          value: webconsoleModulesCount,
+        },
+        {
+          name: "webconsole-chars",
+          value: webconsoleModulesChars,
+        },
+        {
+          name: "all-modules",
+          value: allModulesCount,
+        },
+        {
+          name: "all-chars",
+          value: allModulesChars,
+        },
+      ],
+    }],
+  };
+  info("PERFHERDER_DATA: " + JSON.stringify(PERFHERDER_DATA));
+
+  // Simply check that we found valid values.
+  ok(allModulesCount > webconsoleModulesCount &&
+     webconsoleModulesCount > 0, "Successfully recorded module count for WebConsole");
+  ok(allModulesChars > webconsoleModulesChars &&
+     webconsoleModulesChars > 0, "Successfully recorded char count for WebConsole");
 });
--- a/devtools/client/framework/test/metrics/head.js
+++ b/devtools/client/framework/test/metrics/head.js
@@ -25,62 +25,8 @@ function countCharsInModules(modules) {
     try {
       return sum + require("raw!" + uri).length;
     } catch (e) {
       // Ignore failures
       return sum;
     }
   }, 0);
 }
-
-/**
- * Record module loading data.
- *
- * @param {Object}
- * - filterString {String} path to use to filter modules specific to the current panel
- * - loaders {Array} Array of Loaders to check for modules
- * - panelName {String} reused in identifiers for perfherder data
- */
-function runMetricsTest({ filterString, loaders, panelName }) {
-  const allModules = getFilteredModules("", loaders);
-  const panelModules = getFilteredModules(filterString, loaders);
-
-  const allModulesCount = allModules.length;
-  const panelModulesCount = panelModules.length;
-
-  const allModulesChars = countCharsInModules(allModules);
-  const panelModulesChars = countCharsInModules(panelModules);
-
-  const PERFHERDER_DATA = {
-    framework: {
-      name: "devtools",
-    },
-    suites: [{
-      name: panelName + "-metrics",
-      value: allModulesChars,
-      subtests: [
-        {
-          name: panelName + "-modules",
-          value: panelModulesCount,
-        },
-        {
-          name: panelName + "-chars",
-          value: panelModulesChars,
-        },
-        {
-          name: "all-modules",
-          value: allModulesCount,
-        },
-        {
-          name: "all-chars",
-          value: allModulesChars,
-        },
-      ],
-    }],
-  };
-  info("PERFHERDER_DATA: " + JSON.stringify(PERFHERDER_DATA));
-
-  // Simply check that we found valid values.
-  ok(allModulesCount > panelModulesCount &&
-     panelModulesCount > 0, "Successfully recorded module count for " + panelName);
-  ok(allModulesChars > panelModulesChars &&
-     panelModulesChars > 0, "Successfully recorded char count for " + panelName);
-}
--- a/devtools/client/shared/browser-loader.js
+++ b/devtools/client/shared/browser-loader.js
@@ -183,20 +183,16 @@ function BrowserLoaderBuilder({ baseURI,
         lazyServiceGetter: devtools.lazyServiceGetter,
         lazyRequireGetter: this.lazyRequireGetter.bind(this),
       },
     },
   };
 
   const mainModule = loaders.Module(baseURI, joinURI(baseURI, "main.js"));
   this.loader = loaders.Loader(opts);
-  // When running tests, expose the BrowserLoader instance for metrics tests.
-  if (flags.testing) {
-    window.getBrowserLoaderForWindow = () => this;
-  }
   this.require = loaders.Require(this.loader, mainModule);
 }
 
 BrowserLoaderBuilder.prototype = {
   /**
    * Define a getter property on the given object that requires the given
    * module. This enables delaying importing modules until the module is
    * actually used.
--- a/devtools/client/webconsole/main.js
+++ b/devtools/client/webconsole/main.js
@@ -7,14 +7,19 @@
 "use strict";
 
 const { BrowserLoader } = ChromeUtils.import("resource://devtools/client/shared/browser-loader.js");
 
 this.WebConsoleWrapper = function(parentNode, hud, toolbox, owner, document) {
   // Initialize module loader and load all modules of the new inline
   // preview feature. The entire code-base doesn't need any extra
   // privileges and runs entirely in content scope.
-  const WebConsoleWrapper = BrowserLoader({
+  const browserLoader = BrowserLoader({
     baseURI: "resource://devtools/client/webconsole/",
     window,
-  }).require("./webconsole-wrapper");
+  });
+
+  // Expose the browserLoader instance on the webconsole hud for metrics tests.
+  hud.browserLoader = browserLoader;
+
+  const WebConsoleWrapper = browserLoader.require("./webconsole-wrapper");
   return new WebConsoleWrapper(parentNode, hud, toolbox, owner, document);
 };