Bug 1575979 - Avoid undefined toolbox error when warping to messages, r=loganfsmyth.

Differential Revision: https://phabricator.services.mozilla.com/D43148

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brian Hackett 2019-08-23 04:43:42 +00:00
Родитель d51709da87
Коммит 85d5cecac7
2 изменённых файлов: 20 добавлений и 22 удалений

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

@ -1736,26 +1736,6 @@ async function getDebuggerSplitConsole(dbg) {
return toolbox.getPanel("webconsole");
}
async function openConsoleContextMenu(hud, element) {
const onConsoleMenuOpened = hud.ui.wrapper.once("menu-open");
synthesizeContextMenuEvent(element);
await onConsoleMenuOpened;
const toolbox = gDevTools.getToolbox(hud.target);
return toolbox.topDoc.getElementById("webconsole-menu");
}
function hideConsoleContextMenu(hud) {
const toolbox = gDevTools.getToolbox(hud.target);
const popup = toolbox.topDoc.getElementById("webconsole-menu");
if (!popup) {
return Promise.resolve();
}
const onPopupHidden = once(popup, "popuphidden");
popup.hidePopup();
return onPopupHidden;
}
// Return a promise that resolves with the result of a thread evaluating a
// string in the topmost frame.
async function evaluateInTopFrame(target, text) {

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

@ -142,7 +142,7 @@ async function warpToMessage(hud, dbg, text) {
ok(messages.length == 1, "Found one message");
const message = messages.pop();
const menuPopup = await openConsoleContextMenu(hud, message);
const menuPopup = await openConsoleContextMenu(message);
console.log(`.>> menu`, menuPopup);
const timeWarpItem = menuPopup.querySelector("#console-menu-time-warp");
@ -150,7 +150,7 @@ async function warpToMessage(hud, dbg, text) {
timeWarpItem.click();
await hideConsoleContextMenu(hud);
await hideConsoleContextMenu();
await once(Services.ppmm, "TimeWarpFinished");
await waitForPaused(dbg);
@ -158,6 +158,24 @@ async function warpToMessage(hud, dbg, text) {
ok(messages.length == 1, "Found one paused message");
return message;
async function openConsoleContextMenu(element) {
const onConsoleMenuOpened = hud.ui.wrapper.once("menu-open");
synthesizeContextMenuEvent(element);
await onConsoleMenuOpened;
return dbg.toolbox.topDoc.getElementById("webconsole-menu");
}
function hideConsoleContextMenu() {
const popup = dbg.toolbox.topDoc.getElementById("webconsole-menu");
if (!popup) {
return Promise.resolve();
}
const onPopupHidden = once(popup, "popuphidden");
popup.hidePopup();
return onPopupHidden;
}
}
const { PromiseTestUtils } = ChromeUtils.import(