Files
palemoon27/toolkit/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-01.js
T
roytam1 b4028f07d5 import changes from `dev' branch of rmottola/Arctic-Fox:
- rough apply of Bug 1154275 - Remove ise() in favor of is(); r=Ms2ger (34cf63726)
- Bug 1174954 part 1. Stop throwing DOMErrors from JS-implemented webidBug 1174954 part 1. Stop throwing DOMErrors from JS-implemented webid (ff7b25af0)
- Bug 1173593. Make it possible to throw TypeError (or, in fact, any other Error from the content compartment) from js-implemented webidl. r=bholley (328c181a6)
- Bug 1174954 part 2. Remove the special-casing of DOMError in JS-implemented webidl code. r=bholley (d8784c655)
- Bug 1174954 part 3. Remove ReportJSExceptionFromJSImplementation, since it no longer does anything interesting. r=bholley (e5e6360df)
- Bug 1170716 - Part 1: Add js shell functions to get last warning. r=jandem (391a75cfa)
- Bug 1170716 - Part 2: Report unreachable code after return statement as JSEXN_NONE. r=jandem (5396c950a)
- Bug 1170716 - Part 3: Use getLastWarning in test for warning with JSEXN_NONE. r=jandem (20453ed86)
- Bug 1173787. The column number of an exception populated via PopulateReportBlame should be 1-based. r=fitzgen (ccc3d63f6)
- Bug 1148593 - Create async stack in callback objects. r=bz, r=fitzgen (ec0802480)
- Bug 1170097 - Part 2: Add originAttributesToCookieJar. r=bholley (0358faa1c)
- Bug 1169044 - Patch 2 - Split URLSearchParams parsing logic into non-CCed URLParams. r=baku (2d228a166)
- make qcms support for AltiVec compile-time selected like in TenFourFox and make thus compilation without it work (a343e775a)
2021-04-21 09:28:07 +08:00

77 lines
3.4 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests if the a function call's stack is properly displayed in the UI.
*/
function ifTestingSupported() {
let { target, panel } = yield initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
yield reload(target);
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
SnapshotsListView._onRecordButtonClick();
yield promise.all([recordingFinished, callListPopulated]);
let callItem = CallsListView.getItemAtIndex(2);
let locationLink = $(".call-item-location", callItem.target);
is($(".call-item-stack", callItem.target), null,
"There should be no stack container available yet for the draw call.");
let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
EventUtils.sendMouseEvent({ type: "mousedown" }, locationLink, window);
yield callStackDisplayed;
isnot($(".call-item-stack", callItem.target), null,
"There should be a stack container available now for the draw call.");
// We may have more than 4 functions, depending on whether async
// stacks are available.
ok($all(".call-item-stack-fn", callItem.target).length >= 4,
"There should be at least 4 functions on the stack for the draw call.");
ok($all(".call-item-stack-fn-name", callItem.target)[0].getAttribute("value")
.contains("C()"),
"The first function on the stack has the correct name.");
ok($all(".call-item-stack-fn-name", callItem.target)[1].getAttribute("value")
.contains("B()"),
"The second function on the stack has the correct name.");
ok($all(".call-item-stack-fn-name", callItem.target)[2].getAttribute("value")
.contains("A()"),
"The third function on the stack has the correct name.");
ok($all(".call-item-stack-fn-name", callItem.target)[3].getAttribute("value")
.contains("drawRect()"),
"The fourth function on the stack has the correct name.");
is($all(".call-item-stack-fn-location", callItem.target)[0].getAttribute("value"),
"doc_simple-canvas-deep-stack.html:26",
"The first function on the stack has the correct location.");
is($all(".call-item-stack-fn-location", callItem.target)[1].getAttribute("value"),
"doc_simple-canvas-deep-stack.html:28",
"The second function on the stack has the correct location.");
is($all(".call-item-stack-fn-location", callItem.target)[2].getAttribute("value"),
"doc_simple-canvas-deep-stack.html:30",
"The third function on the stack has the correct location.");
is($all(".call-item-stack-fn-location", callItem.target)[3].getAttribute("value"),
"doc_simple-canvas-deep-stack.html:35",
"The fourth function on the stack has the correct location.");
let jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
EventUtils.sendMouseEvent({ type: "mousedown" }, $(".call-item-stack-fn-location", callItem.target));
yield jumpedToSource;
let toolbox = yield gDevTools.getToolbox(target);
let { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
is(view.Sources.selectedValue, getSourceActor(view.Sources, SIMPLE_CANVAS_DEEP_STACK_URL),
"The expected source was shown in the debugger.");
is(view.editor.getCursor().line, 25,
"The expected source line is highlighted in the debugger.");
yield teardown(panel);
finish();
}