Bug 1437852 - Enable browser_console_restore.js in new frontend r=bgrins

MozReview-Commit-ID: Fk7yT1gXKI9

--HG--
extra : rebase_source : ea793d4085e67b969d8b6ec132332bd86091b30b
This commit is contained in:
Michael Ratcliffe 2018-02-14 15:59:35 +00:00
Родитель deee29c647
Коммит 39866a29b9
3 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -185,7 +185,6 @@ skip-if = true # Bug 1437850
[browser_console_open_or_focus.js]
skip-if = true # Bug 1437851
[browser_console_restore.js]
skip-if = true # Bug 1437852
[browser_console_webconsole_ctrlw_close_tab.js]
skip-if = true # Bug 1437854
[browser_console_webconsole_iframe_messages.js]

Просмотреть файл

@ -3,12 +3,14 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from head.js */
// Check that the browser console gets session state is set correctly, and that
// it re-opens when restore is requested.
"use strict";
add_task(async function() {
add_task(async function () {
is(HUDService.getBrowserConsoleSessionState(), false, "Session state false by default");
HUDService.storeBrowserConsoleSessionState();
is(HUDService.getBrowserConsoleSessionState(), false,
@ -19,7 +21,7 @@ add_task(async function() {
is(HUDService.getBrowserConsoleSessionState(), true,
"Session state true (since Browser Console is opened)");
info("Closing the browser console and waiting for the session restore to reopen it")
info("Closing the browser console and waiting for the session restore to reopen it");
await HUDService.toggleBrowserConsole();
let opened = waitForBrowserConsole();
@ -27,6 +29,6 @@ add_task(async function() {
browserConsole: true
});
info("Waiting for the console to open after session restore")
info("Waiting for the console to open after session restore");
await opened;
});

Просмотреть файл

@ -591,3 +591,18 @@ function selectNode(hud, node) {
return selection;
}
async function waitForBrowserConsole() {
return new Promise(resolve => {
Services.obs.addObserver(function observer(subject) {
Services.obs.removeObserver(observer, "web-console-created");
subject.QueryInterface(Ci.nsISupportsString);
let hud = HUDService.getBrowserConsole();
ok(hud, "browser console is open");
is(subject.data, hud.hudId, "notification hudId is correct");
executeSoon(() => resolve(hud));
}, "web-console-created");
});
}