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.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Tests if the a function call's stack is properly displayed in the UI |
michael@0 | 6 | * and jumping to source in the debugger for the topmost call item works. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | function ifTestingSupported() { |
michael@0 | 10 | let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL); |
michael@0 | 11 | let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin; |
michael@0 | 12 | |
michael@0 | 13 | yield reload(target); |
michael@0 | 14 | |
michael@0 | 15 | let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED); |
michael@0 | 16 | let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED); |
michael@0 | 17 | SnapshotsListView._onRecordButtonClick(); |
michael@0 | 18 | yield promise.all([recordingFinished, callListPopulated]); |
michael@0 | 19 | |
michael@0 | 20 | let callItem = CallsListView.getItemAtIndex(2); |
michael@0 | 21 | let locationLink = $(".call-item-location", callItem.target); |
michael@0 | 22 | |
michael@0 | 23 | is($(".call-item-stack", callItem.target), null, |
michael@0 | 24 | "There should be no stack container available yet for the draw call."); |
michael@0 | 25 | |
michael@0 | 26 | let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED); |
michael@0 | 27 | EventUtils.sendMouseEvent({ type: "mousedown" }, locationLink, window); |
michael@0 | 28 | yield callStackDisplayed; |
michael@0 | 29 | |
michael@0 | 30 | isnot($(".call-item-stack", callItem.target), null, |
michael@0 | 31 | "There should be a stack container available now for the draw call."); |
michael@0 | 32 | is($all(".call-item-stack-fn", callItem.target).length, 4, |
michael@0 | 33 | "There should be 4 functions on the stack for the draw call."); |
michael@0 | 34 | |
michael@0 | 35 | let jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER); |
michael@0 | 36 | EventUtils.sendMouseEvent({ type: "mousedown" }, $(".call-item-location", callItem.target)); |
michael@0 | 37 | yield jumpedToSource; |
michael@0 | 38 | |
michael@0 | 39 | let toolbox = yield gDevTools.getToolbox(target); |
michael@0 | 40 | let { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger"); |
michael@0 | 41 | |
michael@0 | 42 | is(view.Sources.selectedValue, SIMPLE_CANVAS_DEEP_STACK_URL, |
michael@0 | 43 | "The expected source was shown in the debugger."); |
michael@0 | 44 | is(view.editor.getCursor().line, 23, |
michael@0 | 45 | "The expected source line is highlighted in the debugger."); |
michael@0 | 46 | |
michael@0 | 47 | yield teardown(panel); |
michael@0 | 48 | finish(); |
michael@0 | 49 | } |