Backed out changesets 4117364f58fb and cb99aff2574e (bug 888373) for xpcshell failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 02 Dec 2013 13:11:44 -0500
changeset 158308 5dc0d8f19d2604412e05b1181eabce54df7a4689
parent 158307 76e799f770699b76d8703b34e08e283fa0cfe87a
child 158309 bfa858a90cb040cd7724e2924ccabd258d273579
push id36966
push userryanvm@gmail.com
push dateMon, 02 Dec 2013 18:12:13 +0000
treeherdermozilla-inbound@5dc0d8f19d26 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs888373
milestone28.0a1
backs out4117364f58fb0d10c8f46b9f2bcbb718ac209e02
cb99aff2574efc2c3f938f341ad6174ddf8cb7ee
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 changesets 4117364f58fb and cb99aff2574e (bug 888373) for xpcshell failures.
toolkit/components/crashmonitor/CrashMonitor.jsm
toolkit/components/crashmonitor/crashmonitor.manifest
toolkit/components/crashmonitor/moz.build
toolkit/components/crashmonitor/nsCrashMonitor.js
toolkit/components/crashmonitor/test/unit/head.js
toolkit/components/crashmonitor/test/unit/test_init.js
toolkit/components/crashmonitor/test/unit/test_invalid_file.js
toolkit/components/crashmonitor/test/unit/test_missing_file.js
toolkit/components/crashmonitor/test/unit/test_register.js
toolkit/components/crashmonitor/test/unit/test_valid_file.js
toolkit/components/crashmonitor/test/unit/xpcshell.ini
toolkit/components/moz.build
deleted file mode 100644
--- a/toolkit/components/crashmonitor/CrashMonitor.jsm
+++ /dev/null
@@ -1,208 +0,0 @@
-/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-/**
- * Crash Monitor
- *
- * Monitors execution of a program to detect possible crashes. After
- * program termination, the monitor can be queried during the next run
- * to determine whether the last run exited cleanly or not.
- *
- * The monitoring is done by registering and listening for special
- * notifications, or checkpoints, known to be sent by the monitored
- * program as different stages in the execution are reached. As they
- * are observed, these notifications are written asynchronously to a
- * checkpoint file.
- *
- * During next program startup the crash monitor reads the checkpoint
- * file from the last session. If notifications are missing, a crash
- * has likely happened. By inspecting the notifications present, it is
- * possible to determine what stages were reached in the program
- * before the crash.
- *
- * Note that since the file is written asynchronously it is possible
- * that a received notification is lost if the program crashes right
- * after a checkpoint, but before crash monitor has been able to write
- * it to disk. Thus, while the presence of a notification in the
- * checkpoint file tells us that the corresponding stage was reached
- * during the last run, the absence of a notification after a crash
- * does not necessarily tell us that the checkpoint wasn't reached.
- */
-
-this.EXPORTED_SYMBOLS = [ "CrashMonitor" ];
-
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/osfile.jsm");
-Cu.import("resource://gre/modules/Promise.jsm");
-Cu.import("resource://gre/modules/Task.jsm");
-Cu.import("resource://gre/modules/AsyncShutdown.jsm");
-
-const NOTIFICATIONS = [
-  "final-ui-startup",
-  "sessionstore-windows-restored",
-  "quit-application-granted",
-  "quit-application",
-  "profile-change-net-teardown",
-  "profile-change-teardown",
-  "profile-before-change",
-  "sessionstore-final-state-write-complete"
-];
-
-let CrashMonitorInternal = {
-
-  /**
-   * Notifications received during the current session.
-   *
-   * Object where a property with a value of |true| means that the
-   * notification of the same name has been received at least once by
-   * the CrashMonitor during this session. Notifications that have not
-   * yet been received are not present as properties. |NOTIFICATIONS|
-   * lists the notifications tracked by the CrashMonitor.
-   */
-  checkpoints: {},
-
-  /**
-   * Notifications received during previous session.
-   *
-   * Available after |loadPreviousCheckpoints|. Promise which resolves
-   * to an object containing a set of properties, where a property
-   * with a value of |true| means that the notification with the same
-   * name as the property name was received at least once last
-   * session.
-   */
-  previousCheckpoints: null,
-
-  /* Deferred for AsyncShutdown blocker */
-  profileBeforeChangeDeferred: Promise.defer(),
-
-  /**
-   * Path to checkpoint file.
-   *
-   * Each time a new notification is received, this file is written to
-   * disc to reflect the information in |checkpoints|.
-   */
-  path: OS.Path.join(OS.Constants.Path.profileDir, "sessionCheckpoints.json"),
-
-  /**
-   * Load checkpoints from previous session asynchronously.
-   *
-   * @return {Promise} A promise that resolves/rejects once loading is complete
-   */
-  loadPreviousCheckpoints: function () {
-    let promise = Task.spawn(function () {
-      let notifications;
-      try {
-        let decoder = new TextDecoder();
-        let data = yield OS.File.read(CrashMonitorInternal.path);
-        let contents = decoder.decode(data);
-        notifications = JSON.parse(contents);
-      } catch (ex if ex instanceof OS.File.Error && ex.becauseNoSuchFile) {
-        // If checkpoint file cannot be read
-        throw new Task.Result(null);
-      } catch (ex) {
-        Cu.reportError("Error while loading crash monitor data: " + ex);
-        throw new Task.Result(null);
-      }
-      throw new Task.Result(Object.freeze(notifications));
-    });
-
-    CrashMonitorInternal.previousCheckpoints = promise;
-    return promise;
-  }
-};
-
-this.CrashMonitor = {
-
-  /**
-   * Notifications received during previous session.
-   *
-   * Return object containing the set of notifications received last
-   * session as keys with values set to |true|.
-   *
-   * @return {Promise} A promise resolving to previous checkpoints
-   */
-  get previousCheckpoints() {
-    if (!CrashMonitorInternal.initialized) {
-      throw new Error("CrashMonitor must be initialized before getting previous checkpoints");
-    }
-
-    return CrashMonitorInternal.previousCheckpoints
-  },
-
-  /**
-   * Initialize CrashMonitor.
-   *
-   * Should only be called from the CrashMonitor XPCOM component.
-   *
-   * @return {Promise}
-   */
-  init: function () {
-    if (CrashMonitorInternal.initialized) {
-      throw new Error("CrashMonitor.init() must only be called once!");
-    }
-
-    let promise = CrashMonitorInternal.loadPreviousCheckpoints();
-    // Add "profile-after-change" to checkpoint as this method is
-    // called after receiving it
-    CrashMonitorInternal.checkpoints["profile-after-change"] = true;
-
-    NOTIFICATIONS.forEach(function (aTopic) {
-      Services.obs.addObserver(this, aTopic, false);
-    }, this);
-
-    // Add shutdown blocker for profile-before-change
-    AsyncShutdown.profileBeforeChange.addBlocker(
-      "CrashMonitor: Writing notifications to file after receiving profile-before-change",
-      CrashMonitorInternal.profileBeforeChangeDeferred.promise
-    );
-
-    CrashMonitorInternal.initialized = true;
-    return promise;
-  },
-
-  /**
-   * Handle registered notifications.
-   *
-   * Update checkpoint file for every new notification received.
-   */
-  observe: function (aSubject, aTopic, aData) {
-    if (!(aTopic in CrashMonitorInternal.checkpoints)) {
-      // If this is the first time this notification is received,
-      // remember it and write it to file
-      CrashMonitorInternal.checkpoints[aTopic] = true;
-      Task.spawn(function() {
-        try {
-          let data = JSON.stringify(CrashMonitorInternal.checkpoints);
-
-          /* Write to the checkpoint file asynchronously, off the main
-           * thread, for performance reasons. Note that this means
-           * that there's not a 100% guarantee that the file will be
-           * written by the time the notification completes. The
-           * exception is profile-before-change which has a shutdown
-           * blocker. */
-          yield OS.File.writeAtomic(
-            CrashMonitorInternal.path,
-            data, {tmpPath: CrashMonitorInternal.path + ".tmp"});
-
-        } finally {
-          // Resolve promise for blocker
-          if (aTopic == "profile-before-change") {
-            CrashMonitorInternal.profileBeforeChangeDeferred.resolve();
-          }
-        }
-      });
-    }
-
-    if (NOTIFICATIONS.every(elem => elem in CrashMonitorInternal.checkpoints)) {
-      // All notifications received, unregister observers
-      NOTIFICATIONS.forEach(function (aTopic) {
-        Services.obs.removeObserver(this, aTopic);
-      }, this);
-    }
-  }
-};
-Object.freeze(this.CrashMonitor);
deleted file mode 100644
--- a/toolkit/components/crashmonitor/crashmonitor.manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-component {d9d75e86-8f17-4c57-993e-f738f0d86d42} nsCrashMonitor.js
-contract @mozilla.org/toolkit/crashmonitor;1 {d9d75e86-8f17-4c57-993e-f738f0d86d42}
-category profile-after-change CrashMonitor @mozilla.org/toolkit/crashmonitor;1
deleted file mode 100644
--- a/toolkit/components/crashmonitor/moz.build
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; 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/.
-
-XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
-
-EXTRA_JS_MODULES = [
-    'CrashMonitor.jsm',
-]
-
-XPIDL_MODULE = 'crashmonitor'
-
-EXTRA_COMPONENTS += [
-    'crashmonitor.manifest',
-]
-
-EXTRA_PP_COMPONENTS += [
-    'nsCrashMonitor.js',
-]
deleted file mode 100644
--- a/toolkit/components/crashmonitor/nsCrashMonitor.js
+++ /dev/null
@@ -1,25 +0,0 @@
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-let Scope = {}
-Components.utils.import("resource://gre/modules/CrashMonitor.jsm", Scope);
-let MonitorAPI = Scope.CrashMonitor;
-
-function CrashMonitor() {};
-
-CrashMonitor.prototype = {
-
-  classID: Components.ID("{d9d75e86-8f17-4c57-993e-f738f0d86d42}"),
-  contractID: "@mozilla.org/toolkit/crashmonitor;1",
-
-  QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver]),
-
-  observe: function (aSubject, aTopic, aData) {
-    switch (aTopic) {
-    case "profile-after-change":
-      MonitorAPI.init();
-    }
-  },
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CrashMonitor]);
deleted file mode 100644
--- a/toolkit/components/crashmonitor/test/unit/head.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "OS",
-                                  "resource://gre/modules/osfile.jsm");
-
-let sessionCheckpointsPath;
-
-/**
- * Start the tasks of the different tests
- */
-function run_test()
-{
-  do_get_profile();
-  sessionCheckpointsPath = OS.Path.join(OS.Constants.Path.profileDir,
-                                        "sessionCheckpoints.json");
-  Components.utils.import("resource://gre/modules/CrashMonitor.jsm");
-  run_next_test();
-}
deleted file mode 100644
--- a/toolkit/components/crashmonitor/test/unit/test_init.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-/**
- * Test that calling |init| twice throws an error
- */
-add_task(function test_init() {
-  CrashMonitor.init();
-  try {
-    CrashMonitor.init();
-    do_check_true(false);
-  } catch (ex) {
-    do_check_true(true);
-  }
-});
deleted file mode 100644
--- a/toolkit/components/crashmonitor/test/unit/test_invalid_file.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-/**
- * Test with sessionCheckpoints.json containing invalid data
- */
-add_task(function test_invalid_file() {
-  // Write bogus data to checkpoint file
-  let data = "1234";
-  yield OS.File.writeAtomic(sessionCheckpointsPath, data,
-                            {tmpPath: sessionCheckpointsPath + ".tmp"});
-
-  // An invalid file will cause |init| to throw an exception
-  try {
-    let status = yield CrashMonitor.init();
-    do_check_true(false);
-  } catch (ex) {
-    do_check_true(true);
-  }
-
-  // and |previousCheckpoints| will be rejected
-  try {
-    let checkpoints = yield CrashMonitor.previousCheckpoints;
-    do_check_true(false);
-  } catch (ex) {
-    do_check_true(true);
-  }
-});
deleted file mode 100644
--- a/toolkit/components/crashmonitor/test/unit/test_missing_file.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-/**
- * Test with non-existing sessionCheckpoints.json
- */
-add_task(function test_missing_file() {
-  CrashMonitor.init();
-  let checkpoints = yield CrashMonitor.previousCheckpoints;
-  do_check_eq(checkpoints, null);
-});
deleted file mode 100644
--- a/toolkit/components/crashmonitor/test/unit/test_register.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-/**
- * Test that CrashMonitor.jsm is correctly loaded from XPCOM component
- */
-add_task(function test_register() {
-  let cm = Components.classes["@mozilla.org/toolkit/crashmonitor;1"]
-                             .createInstance(Components.interfaces.nsIObserver);
-
-  // Send "profile-after-change" to trigger the initialization
-  cm.observe(null, "profile-after-change", null);
-
-  // If CrashMonitor was initialized properly a new call to |init|
-  // should fail
-  try {
-    CrashMonitor.init();
-    do_check_true(false);
-  } catch (ex) {
-    do_check_true(true);
-  }
-});
deleted file mode 100644
--- a/toolkit/components/crashmonitor/test/unit/test_valid_file.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-/**
- * Test with sessionCheckpoints.json containing valid data
- */
-add_task(function test_valid_file() {
-  // Write valid data to checkpoint file
-  let data = JSON.stringify({"final-ui-startup": true});
-  yield OS.File.writeAtomic(sessionCheckpointsPath, data,
-                            {tmpPath: sessionCheckpointsPath + ".tmp"});
-
-  CrashMonitor.init();
-  let checkpoints = yield CrashMonitor.previousCheckpoints;
-
-  do_check_true(checkpoints["final-ui-startup"]);
-  do_check_eq(Object.keys(checkpoints).length, 1);
-});
deleted file mode 100644
--- a/toolkit/components/crashmonitor/test/unit/xpcshell.ini
+++ /dev/null
@@ -1,9 +0,0 @@
-[DEFAULT]
-head = head.js
-tail =
-
-[test_init.js]
-[test_valid_file.js]
-[test_invalid_file.js]
-[test_missing_file.js]
-[test_register.js]
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -11,17 +11,16 @@ if CONFIG['MOZ_ENABLE_XREMOTE']:
 PARALLEL_DIRS += [
     'aboutmemory',
     'alerts',
     'apppicker',
     'commandlines',
     'console',
     'contentprefs',
     'cookie',
-    'crashmonitor',
     'diskspacewatcher',
     'downloads',
     'exthelper',
     'filepicker',
     'finalizationwitness',
     'find',
     'intl',
     'jsdownloads',