Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Tests if the a function call's stack is properly displayed in the UI
6 * and jumping to source in the debugger for the topmost call item works.
7 */
9 function ifTestingSupported() {
10 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
11 let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
13 yield reload(target);
15 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
16 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
17 SnapshotsListView._onRecordButtonClick();
18 yield promise.all([recordingFinished, callListPopulated]);
20 let callItem = CallsListView.getItemAtIndex(2);
21 let locationLink = $(".call-item-location", callItem.target);
23 is($(".call-item-stack", callItem.target), null,
24 "There should be no stack container available yet for the draw call.");
26 let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
27 EventUtils.sendMouseEvent({ type: "mousedown" }, locationLink, window);
28 yield callStackDisplayed;
30 isnot($(".call-item-stack", callItem.target), null,
31 "There should be a stack container available now for the draw call.");
32 is($all(".call-item-stack-fn", callItem.target).length, 4,
33 "There should be 4 functions on the stack for the draw call.");
35 let jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
36 EventUtils.sendMouseEvent({ type: "mousedown" }, $(".call-item-location", callItem.target));
37 yield jumpedToSource;
39 let toolbox = yield gDevTools.getToolbox(target);
40 let { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
42 is(view.Sources.selectedValue, SIMPLE_CANVAS_DEEP_STACK_URL,
43 "The expected source was shown in the debugger.");
44 is(view.editor.getCursor().line, 23,
45 "The expected source line is highlighted in the debugger.");
47 yield teardown(panel);
48 finish();
49 }