Files
palemoon27/toolkit/devtools/webconsole/test/browser_webconsole_closure_inspection.js
T
roytam1 a101af758e import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 967319 - Sort object properties in natural order in the Variables View. r=jaws (e604fc318)
- Bug 1023386 - Split and filter properties remotely for objects. r=past (b4889035f)
- Bug 1149115 - Make sure source actors are created before breakpoints are reset;r=jlong (76561a3fd)
- Bug 1154606 - improve error in debugger when loading source fails r=jsantell (3678eca90)
- Bug 1159731 - Move all Addon actor subclasses to a dedicated file. r=ejpbruel (45e012a98)
- Bug 1096294 - Display pseudo-arrays like arrays in the console; r=pbrosset (b4b129b3a)
- Bug 1169064 - Part 1: Move ObjectActor to object.js r=fitzgen (579cb4f86)
- Bug 1169064 - Part 2: Formatted object.js and removed unused protocol request arguments r=fitzgen (4f3178a6a)
- Bug 792063 - Add status console shortcut to return the previous command result;r=past (fc1317f9b)
- Bug 1169064 - Part 3: Refactor LongStringActor, createValueGrip, stringIsLong and longStripGrip from script.js to object.js r=fitzgen (ecdff41b7)
- AltiVec/VMX is 32bit only, use double cast passing uintptr_t to int to fix compilation on PPC64 (93985b589)
- Bug 1084525 - Part 7: Expose Promise life time in object grip r=fitzgen (db5000041)
- Bug 1084525 - Part 8: Expose Promise time to settle in object grip r=fitzgen (65b7beb26)
- Bug 1084525 - Part 9: Implement getDependentPromises method in ObjectClient r=fitzgen (8cc8be31d)
- Bug 1148753 - Update browser content toolbox to create a TabSources instance. r=jryans (df6bf505f)
- Bug 1050691 - Click on a function on the console should go to the debugger. r=jlongster (e0d225db1)
- Bug 1084525 - Part 10: Implement getAllocationStack method in ObjectClient r=fitzgen (199ce4dd9)
- Bug 1084525 - Part 12: Fix eslint complaints in promise.js r=fitzgen (7d0a38afe)
- Bug 1084525 - Part 13: Add test for asserting the Promise allocation stack in chrome debugging r=fitzgen (60278cf1d)
- Bug 1164564 - Refactor Promise-backend.js so it can be required as a CommonJS module on the main thread;r=paolo (7cfe3cdd9)
- Bug 1181506 - Define Cc and Ci. r=Yoric (bc3968be3)
2021-04-20 09:17:23 +08:00

98 lines
2.9 KiB
JavaScript

/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Check that inspecting a closure in the variables view sidebar works when
// execution is paused.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-closures.html";
let gWebConsole, gJSTerm, gVariablesView;
function test()
{
registerCleanupFunction(() => {
gWebConsole = gJSTerm = gVariablesView = null;
});
loadTab(TEST_URI).then(() => {
openConsole().then((hud) => {
openDebugger().then(({ toolbox, panelWin }) => {
let deferred = promise.defer();
panelWin.gThreadClient.addOneTimeListener("resumed", (aEvent, aPacket) => {
ok(true, "Debugger resumed");
deferred.resolve({ toolbox: toolbox, panelWin: panelWin });
});
return deferred.promise;
}).then(({ toolbox, panelWin }) => {
let deferred = promise.defer();
panelWin.once(panelWin.EVENTS.FETCHED_SCOPES, (aEvent, aPacket) => {
ok(true, "Scopes were fetched");
toolbox.selectTool("webconsole").then(() => consoleOpened(hud));
deferred.resolve();
});
let button = content.document.querySelector("button");
ok(button, "button element found");
EventUtils.synthesizeMouseAtCenter(button, {}, content);
return deferred.promise;
});
});
});
}
function consoleOpened(hud)
{
gWebConsole = hud;
gJSTerm = hud.jsterm;
gJSTerm.execute("window.george.getName");
waitForMessages({
webconsole: gWebConsole,
messages: [{
text: "function _pfactory/<.getName()",
category: CATEGORY_OUTPUT,
objects: true,
}],
}).then(onExecuteGetName);
}
function onExecuteGetName(aResults)
{
let clickable = aResults[0].clickableElements[0];
ok(clickable, "clickable object found");
gJSTerm.once("variablesview-fetched", onGetNameFetch);
let contextMenu =
gWebConsole.iframeWindow.document.getElementById("output-contextmenu");
waitForContextMenu(contextMenu, clickable, () => {
let openInVarView = contextMenu.querySelector("#menu_openInVarView");
ok(openInVarView.disabled === false,
"the \"Open In Variables View\" context menu item should be clickable");
// EventUtils.synthesizeMouseAtCenter seems to fail here in Mac OSX
openInVarView.click();
});
}
function onGetNameFetch(aEvent, aVar)
{
gVariablesView = aVar._variablesView;
ok(gVariablesView, "variables view object");
findVariableViewProperties(aVar, [
{ name: /_pfactory/, value: "" },
], { webconsole: gWebConsole }).then(onExpandClosure);
}
function onExpandClosure(aResults)
{
let prop = aResults[0].matchedProp;
ok(prop, "matched the name property in the variables view");
gVariablesView.window.focus();
gJSTerm.once("sidebar-closed", finishTest);
EventUtils.synthesizeKey("VK_ESCAPE", {});
}