diff --git a/browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js b/browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js
index 72863d6a7ad5..0a7cfdef5e9f 100644
--- a/browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js
+++ b/browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js
@@ -1,6 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
+Cu.import("resource://gre/modules/PromiseUtils.jsm");
+
/**
* With e10s, plugins must run in their own process. This means we have
* three processes at a minimum when we're running a plugin:
@@ -79,51 +81,56 @@ function preparePlugin(browser, pluginFallbackState) {
});
}
-add_task(async function setup() {
- // Bypass click-to-play
- setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED);
+// Bypass click-to-play
+setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED);
- // Clear out any minidumps we create from plugins - we really don't care
- // about them.
- let crashObserver = (subject, topic, data) => {
- if (topic != "plugin-crashed") {
- return;
- }
+// Deferred promise object used by the test to wait for the crash handler
+let crashDeferred = null;
- let propBag = subject.QueryInterface(Ci.nsIPropertyBag2);
- let minidumpID = propBag.getPropertyAsAString("pluginDumpID");
+// Clear out any minidumps we create from plugins - we really don't care
+// about them.
+let crashObserver = (subject, topic, data) => {
+ if (topic != "plugin-crashed") {
+ return;
+ }
- Services.crashmanager.ensureCrashIsPresent(minidumpID).then(() => {
- let minidumpDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
- minidumpDir.append("minidumps");
+ let propBag = subject.QueryInterface(Ci.nsIPropertyBag2);
+ let minidumpID = propBag.getPropertyAsAString("pluginDumpID");
- let pluginDumpFile = minidumpDir.clone();
- pluginDumpFile.append(minidumpID + ".dmp");
+ Services.crashmanager.ensureCrashIsPresent(minidumpID).then(() => {
+ let minidumpDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ minidumpDir.append("minidumps");
- let extraFile = minidumpDir.clone();
- extraFile.append(minidumpID + ".extra");
+ let pluginDumpFile = minidumpDir.clone();
+ pluginDumpFile.append(minidumpID + ".dmp");
- ok(pluginDumpFile.exists(), "Found minidump");
- ok(extraFile.exists(), "Found extra file");
+ let extraFile = minidumpDir.clone();
+ extraFile.append(minidumpID + ".extra");
- pluginDumpFile.remove(false);
- extraFile.remove(false);
- });
- };
+ ok(pluginDumpFile.exists(), "Found minidump");
+ ok(extraFile.exists(), "Found extra file");
- Services.obs.addObserver(crashObserver, "plugin-crashed");
- // plugins.testmode will make BrowserPlugins:Test:ClearCrashData work.
- Services.prefs.setBoolPref("plugins.testmode", true);
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref("plugins.testmode");
- Services.obs.removeObserver(crashObserver, "plugin-crashed");
+ pluginDumpFile.remove(false);
+ extraFile.remove(false);
+ crashDeferred.resolve();
});
+};
+
+Services.obs.addObserver(crashObserver, "plugin-crashed");
+// plugins.testmode will make BrowserPlugins:Test:ClearCrashData work.
+Services.prefs.setBoolPref("plugins.testmode", true);
+registerCleanupFunction(() => {
+ Services.prefs.clearUserPref("plugins.testmode");
+ Services.obs.removeObserver(crashObserver, "plugin-crashed");
});
/**
* In this case, the chrome process hears about the crash first.
*/
add_task(async function testChromeHearsPluginCrashFirst() {
+ // Setup the crash observer promise
+ crashDeferred = PromiseUtils.defer();
+
// Open a remote window so that we can run this test even if e10s is not
// enabled by default.
let win = await BrowserTestUtils.openNewBrowserWindow({remote: true});
@@ -183,12 +190,16 @@ add_task(async function testChromeHearsPluginCrashFirst() {
"Should have been showing crash report UI");
});
await BrowserTestUtils.closeWindow(win);
+ await crashDeferred.promise;
});
/**
* In this case, the content process hears about the crash first.
*/
add_task(async function testContentHearsCrashFirst() {
+ // Setup the crash observer promise
+ crashDeferred = PromiseUtils.defer();
+
// Open a remote window so that we can run this test even if e10s is not
// enabled by default.
let win = await BrowserTestUtils.openNewBrowserWindow({remote: true});
@@ -253,4 +264,5 @@ add_task(async function testContentHearsCrashFirst() {
});
await BrowserTestUtils.closeWindow(win);
+ await crashDeferred.promise;
});
diff --git a/browser/base/content/test/tabcrashed/browser_clearEmail.js b/browser/base/content/test/tabcrashed/browser_clearEmail.js
index 0aa89881b586..0b753bffa8c8 100644
--- a/browser/base/content/test/tabcrashed/browser_clearEmail.js
+++ b/browser/base/content/test/tabcrashed/browser_clearEmail.js
@@ -34,7 +34,9 @@ add_task(async function test_clear_email() {
prefs.setBoolPref("emailMe", true);
let tab = gBrowser.getTabForBrowser(browser);
- await BrowserTestUtils.crashBrowser(browser);
+ await BrowserTestUtils.crashBrowser(browser,
+ /* shouldShowTabCrashPage */ true,
+ /* shouldClearMinidumps */ false);
let doc = browser.contentDocument;
// Since about:tabcrashed will run in the parent process, we can safely
diff --git a/dom/ipc/tests/chrome.ini b/dom/ipc/tests/chrome.ini
index b6e3d48013de..9bc07c5edd6b 100644
--- a/dom/ipc/tests/chrome.ini
+++ b/dom/ipc/tests/chrome.ini
@@ -2,7 +2,6 @@
skip-if = os == 'android'
support-files =
process_error.xul
- process_error_contentscript.js
[test_process_error.xul]
skip-if = !crashreporter
diff --git a/dom/ipc/tests/process_error.xul b/dom/ipc/tests/process_error.xul
index 2e51a2760fee..e04fc2e60101 100644
--- a/dom/ipc/tests/process_error.xul
+++ b/dom/ipc/tests/process_error.xul
@@ -7,6 +7,7 @@
diff --git a/dom/ipc/tests/process_error_contentscript.js b/dom/ipc/tests/process_error_contentscript.js
deleted file mode 100644
index 789b8a37f9aa..000000000000
--- a/dom/ipc/tests/process_error_contentscript.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Components.utils.import("resource://gre/modules/ctypes.jsm");
-
-privateNoteIntentionalCrash();
-
-var zero = new ctypes.intptr_t(8);
-var badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t));
-var crash = badptr.contents;
diff --git a/dom/plugins/test/mochitest/hang_test.js b/dom/plugins/test/mochitest/hang_test.js
index 03a387e64861..bb1b66afa82d 100644
--- a/dom/plugins/test/mochitest/hang_test.js
+++ b/dom/plugins/test/mochitest/hang_test.js
@@ -42,14 +42,10 @@ var testObserver = {
let additionalDumps = extraData.additional_minidumps.split(',');
ok(additionalDumps.indexOf('browser') >= 0, "browser in additional_minidumps");
- let additionalDumpFiles = [];
for (let name of additionalDumps) {
let file = profD.clone();
file.append(pluginId + "-" + name + ".dmp");
ok(file.exists(), "additional dump '"+name+"' exists");
- if (file.exists()) {
- additionalDumpFiles.push(file);
- }
}
// check cpu usage field
@@ -103,7 +99,5 @@ function onPluginCrashed(aEvent) {
getService(Ci.nsIObserverService);
os.removeObserver(testObserver, "plugin-crashed");
- Services.crashmanager.ensureCrashIsPresent(aEvent.pluginDumpID).then(() => {
- SimpleTest.finish();
- });
+ SimpleTest.finish();
}
diff --git a/dom/plugins/test/mochitest/test_busy_hang.xul b/dom/plugins/test/mochitest/test_busy_hang.xul
index f79ec1484f18..cb4df7692d48 100644
--- a/dom/plugins/test/mochitest/test_busy_hang.xul
+++ b/dom/plugins/test/mochitest/test_busy_hang.xul
@@ -19,8 +19,6 @@