Bug 1346995 - Replace promiseErrorPageLoaded with BrowserTestUtils.waitForErrorPage in browser_ssl_error_reports.js
Replaced it with BrowserTestUtils.waitForErrorPage instead.
MozReview-Commit-ID: KsVjMlaZaa6
--- a/browser/base/content/test/general/browser_ssl_error_reports.js
+++ b/browser/base/content/test/general/browser_ssl_error_reports.js
@@ -61,17 +61,17 @@ function* testSendReportAutomatically(te
// Add a tab and wait until it's loaded.
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
let browser = tab.linkedBrowser;
// Load the page and wait for the error report submission.
let promiseStatus = createReportResponseStatusPromise(URL_REPORTS + suffix);
browser.loadURI(testURL);
- yield promiseErrorPageLoaded(browser);
+ yield BrowserTestUtils.waitForErrorPage(browser);
ok(!isErrorStatus(yield promiseStatus),
"SSL error report submitted successfully");
// Check that we loaded the right error page.
yield checkErrorPage(browser, errorURISuffix);
// Cleanup.
@@ -85,17 +85,17 @@ function* testSetAutomatic(testURL, suff
Services.prefs.setCharPref(PREF_REPORT_URL, URL_REPORTS + suffix);
// Add a tab and wait until it's loaded.
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
let browser = tab.linkedBrowser;
// Load the page.
browser.loadURI(testURL);
- yield promiseErrorPageLoaded(browser);
+ yield BrowserTestUtils.waitForErrorPage(browser);
// Check that we loaded the right error page.
yield checkErrorPage(browser, errorURISuffix);
let statusPromise = createReportResponseStatusPromise(URL_REPORTS + suffix);
// Click the checkbox, enable automatic error reports.
yield ContentTask.spawn(browser, null, function* () {
@@ -126,17 +126,17 @@ function* testSetAutomatic(testURL, suff
function* testSendReportDisabled(testURL, errorURISuffix) {
// Add a tab and wait until it's loaded.
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
let browser = tab.linkedBrowser;
// Load the page.
browser.loadURI(testURL);
- yield promiseErrorPageLoaded(browser);
+ yield BrowserTestUtils.waitForErrorPage(browser);
// Check that we loaded the right error page.
yield checkErrorPage(browser, errorURISuffix);
// Check that the error reporting section is hidden.
yield ContentTask.spawn(browser, null, function* () {
let section = content.document.getElementById("certificateErrorReporting");
Assert.equal(content.getComputedStyle(section).display, "none",
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -786,25 +786,16 @@ function promiseOnBookmarkItemAdded(aExp
Ci.nsINavBookmarkObserver,
])
};
info("Waiting for a bookmark to be added");
PlacesUtils.bookmarks.addObserver(bookmarksObserver, false);
});
}
-function promiseErrorPageLoaded(browser) {
- return new Promise(resolve => {
- browser.addEventListener("DOMContentLoaded", function onLoad() {
- browser.removeEventListener("DOMContentLoaded", onLoad, false, true);
- resolve();
- }, false, true);
- });
-}
-
function* loadBadCertPage(url) {
const EXCEPTION_DIALOG_URI = "chrome://pippki/content/exceptionDialog.xul";
let exceptionDialogResolved = new Promise(function(resolve) {
// When the certificate exception dialog has opened, click the button to add
// an exception.
let certExceptionDialogObserver = {
observe(aSubject, aTopic, aData) {
if (aTopic == "cert-exception-ui-ready") {