Backed out changeset cc4253078c54 (bug 1380081)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 11 Aug 2017 09:28:01 +0200
changeset 374259 fcbcb7b65bf2fb6532d0f1bfc7b421f00239155a
parent 374258 514f6411123722c30a773043ce2bef22486b4982
child 374260 dd34bd64de6a02be6860e14c23f90c8613e72c56
push id32318
push userkwierso@gmail.com
push dateFri, 11 Aug 2017 20:16:01 +0000
treeherdermozilla-central@80ff3f300e05 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1380081
milestone57.0a1
backs outcc4253078c54640c285d49b4d9ae56017219d0b9
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 changeset cc4253078c54 (bug 1380081)
toolkit/components/backgroundhangmonitor/BHRTelemetryService.js
toolkit/components/backgroundhangmonitor/moz.build
toolkit/components/backgroundhangmonitor/tests/.eslintrc.js
toolkit/components/backgroundhangmonitor/tests/child_cause_hang.js
toolkit/components/backgroundhangmonitor/tests/test_BHRObserver.js
toolkit/components/backgroundhangmonitor/tests/xpcshell.ini
--- a/toolkit/components/backgroundhangmonitor/BHRTelemetryService.js
+++ b/toolkit/components/backgroundhangmonitor/BHRTelemetryService.js
@@ -13,17 +13,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/TelemetryController.jsm");
 
 function BHRTelemetryService() {
   Services.obs.addObserver(this, "profile-before-change");
   Services.obs.addObserver(this, "xpcom-shutdown");
   Services.obs.addObserver(this, "bhr-thread-hang");
 
   this.resetPayload();
-}
+};
 
 BHRTelemetryService.prototype = Object.freeze({
   classID: Components.ID("{117c8cdf-69e6-4f31-a439-b8a654c67127}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
 
   TRANSMIT_HANG_COUNT: 100,
 
   resetPayload() {
--- a/toolkit/components/backgroundhangmonitor/moz.build
+++ b/toolkit/components/backgroundhangmonitor/moz.build
@@ -7,18 +7,16 @@
 # We only want to record and report BHR in nightly builds. We don't need to load
 # the BHRTelemetryService outside of nightly builds.
 if CONFIG['NIGHTLY_BUILD']:
     EXTRA_COMPONENTS += [
         'BHRTelemetryService.js',
         'BHRTelemetryService.manifest',
     ]
 
-    XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell.ini']
-
 XPIDL_SOURCES += [
     'nsIHangDetails.idl',
 ]
 
 XPIDL_MODULE = 'bhr'
 
 EXPORTS.mozilla += [
     'BackgroundHangMonitor.h',
deleted file mode 100644
--- a/toolkit/components/backgroundhangmonitor/tests/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
-  "extends": [
-    "plugin:mozilla/xpcshell-test"
-  ]
-};
deleted file mode 100644
--- a/toolkit/components/backgroundhangmonitor/tests/child_cause_hang.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let { classes: Cc, utils: Cu, interfaces: Ci, results: Cr } = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-function ensureProfilerInitialized() {
-  // Starting and stopping the profiler with the "stackwalk" flag will cause the
-  // profiler's stackwalking features to be synchronously initialized. This
-  // should prevent us from not initializing BHR quickly enough.
-  if (!Services.profiler.CanProfile()) {
-    return false;
-  }
-  let features = ["stackwalk"];
-  Services.profiler.StartProfiler(1000, 10, features, features.length);
-  Services.profiler.StopProfiler();
-  return true;
-}
-
-add_task(async function childCauseHang() {
-  if (!ensureProfilerInitialized()) {
-    return;
-  }
-
-  do_execute_soon(() => {
-    let startTime = Date.now();
-    while ((Date.now() - startTime) < 2000);
-  });
-
-
-  let hang = await new Promise(resolve => {
-    const onhang = subject => {
-      Services.obs.removeObserver(onhang, "bhr-thread-hang");
-      resolve(subject.QueryInterface(Ci.nsIHangDetails));
-    };
-    Services.obs.addObserver(onhang, "bhr-thread-hang");
-  });
-
-  equal(hang.process, "tab");
-  equal(hang.thread, "Gecko_Child");
-  // NOTE: This hang should also be sent to the parent process, where it'll be
-  // checked more.
-});
deleted file mode 100644
--- a/toolkit/components/backgroundhangmonitor/tests/test_BHRObserver.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let { classes: Cc, utils: Cu, interfaces: Ci, results: Cr } = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-function ensureProfilerInitialized() {
-  // Starting and stopping the profiler with the "stackwalk" flag will cause the
-  // profiler's stackwalking features to be synchronously initialized. This
-  // should prevent us from not initializing BHR quickly enough.
-  if (!Services.profiler.CanProfile()) {
-    return false;
-  }
-  let features = ["stackwalk"];
-  Services.profiler.StartProfiler(1000, 10, features, features.length);
-  Services.profiler.StopProfiler();
-  return true;
-}
-
-add_task(async function test_BHRObserver() {
-  if (!Services.telemetry.canRecordExtended) {
-    ok("Hang reporting not enabled.");
-    return;
-  }
-
-  if (!ensureProfilerInitialized()) {
-    return;
-  }
-
-  if (Services.appinfo.OS === "Linux" || Services.appinfo.OS === "Android") {
-    // We use the rt_tgsigqueueinfo syscall on Linux which requires a
-    // certain kernel version. It's not an error if the system running
-    // the test is older than that.
-    let kernel = Services.sysinfo.get("kernel_version") ||
-          Services.sysinfo.get("version");
-    if (Services.vc.compare(kernel, "2.6.31") < 0) {
-      ok("Hang reporting not supported for old kernel.");
-      return;
-    }
-  }
-
-  let hangsPromise = new Promise(resolve => {
-    let hangs = [];
-    const onThreadHang = subject => {
-      let hang = subject.QueryInterface(Ci.nsIHangDetails);
-      if (hang.thread.startsWith("Gecko")) {
-        hangs.push(hang);
-        if (hangs.length >= 3) {
-          Services.obs.removeObserver(onThreadHang, "bhr-thread-hang");
-          resolve(hangs);
-        }
-      }
-    };
-    Services.obs.addObserver(onThreadHang, "bhr-thread-hang");
-  });
-
-  // We're going to trigger two hangs, of various lengths. One should be a
-  // transient hang, and the other a permanent hang. We'll wait for the hangs to
-  // be recorded.
-
-  do_execute_soon(() => {
-    let startTime = Date.now();
-    while ((Date.now() - startTime) < 10000);
-  });
-
-  do_execute_soon(() => {
-    let startTime = Date.now();
-    while ((Date.now() - startTime) < 1000);
-  });
-
-  run_test_in_child("child_cause_hang.js");
-
-  // Now we wait for the hangs to have their bhr-thread-hang message fired for
-  // them, collect them, and analyize the response.
-  let hangs = await hangsPromise;
-  equal(hangs.length, 3);
-  hangs.forEach(hang => {
-    ok(hang.duration > 0);
-    ok(hang.thread == "Gecko" || hang.thread == "Gecko_Child");
-    equal(typeof hang.runnableName, "string");
-
-    // hang.stack
-    ok(Array.isArray(hang.stack));
-    hang.stack.forEach(entry => {
-      // XXX: Once we get merged stacks, we might get pseudostack or js frames
-      // in here too.
-      ok(Array.isArray(entry));
-      equal(entry.length, 2);
-      equal(typeof entry[0], "number");
-      equal(typeof entry[1], "string");
-    });
-
-    // hang.modules
-    ok(Array.isArray(hang.modules));
-    hang.modules.forEach(module => {
-      ok(Array.isArray(module));
-      equal(module.length, 2);
-      equal(typeof module[0], "string");
-      equal(typeof module[1], "string");
-    });
-
-    // hang.annotations
-    equal(typeof hang.annotations, "object");
-    Object.keys(hang.annotations).forEach(key => {
-      equal(typeof hang.annotations[key], "string");
-    });
-
-    // hang.pseudoStack
-    // XXX: This will go away once we get merged stacks
-    ok(Array.isArray(hang.pseudoStack));
-    ok(hang.pseudoStack.length > 0);
-    hang.pseudoStack.forEach(entry => {
-      equal(typeof entry, "string");
-    });
-  });
-});
deleted file mode 100644
--- a/toolkit/components/backgroundhangmonitor/tests/xpcshell.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test_BHRObserver.js]
-# BHR is disabled on android and outside of nightly
-skip-if = debug || os == "android" || release_or_beta
-support-files = child_cause_hang.js