зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
d51709da87
Коммит
85d5cecac7
|
@ -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(
|
||||
|
|
Загрузка…
Ссылка в новой задаче