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 * Makes sure the source editor's scroll location doesn't change when
6 * a variable inspection popup is opened and a watch expression is
7 * also evaluated at the same time.
8 */
10 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
12 function test() {
13 Task.spawn(function() {
14 let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
15 let win = panel.panelWin;
16 let events = win.EVENTS;
17 let editor = win.DebuggerView.editor;
18 let editorContainer = win.document.getElementById("editor");
19 let bubble = win.DebuggerView.VariableBubble;
20 let expressions = win.DebuggerView.WatchExpressions;
21 let tooltip = bubble._tooltip.panel;
23 // Allow this generator function to yield first.
24 executeSoon(() => debuggee.start());
25 yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
27 let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
28 expressions.addExpression("this");
29 editor.focus();
30 yield expressionsEvaluated;
32 // Scroll to the top of the editor and inspect variables.
33 let breakpointScrollPosition = editor.getScrollInfo().top;
34 editor.setFirstVisibleLine(0);
35 let topmostScrollPosition = editor.getScrollInfo().top;
37 ok(topmostScrollPosition < breakpointScrollPosition,
38 "The editor is now scrolled to the top (0).");
39 is(editor.getFirstVisibleLine(), 0,
40 "The editor is now scrolled to the top (1).");
42 let failPopup = () => ok(false, "The popup has got unexpectedly hidden.");
43 let failScroll = () => ok(false, "The editor has got unexpectedly scrolled.");
44 tooltip.addEventListener("popuphiding", failPopup);
45 editorContainer.addEventListener("scroll", failScroll);
46 editor.on("scroll", () => {
47 if (editor.getScrollInfo().top > topmostScrollPosition) {
48 ok(false, "The editor scrolled back to the breakpoint location.");
49 }
50 });
52 let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
53 yield openVarPopup(panel, { line: 14, ch: 15 });
54 yield expressionsEvaluated;
56 tooltip.removeEventListener("popuphiding", failPopup);
57 editorContainer.removeEventListener("scroll", failScroll);
59 yield resumeDebuggerThenCloseAndFinish(panel);
60 });
61 }