diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-10.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-10.js')
-rw-r--r-- | devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-10.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-10.js b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-10.js new file mode 100644 index 000000000..15dd02c44 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-10.js @@ -0,0 +1,67 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Makes sure the source editor's scroll location doesn't change when + * a variable inspection popup is opened and a watch expression is + * also evaluated at the same time. + */ + +const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; + +function test() { + Task.spawn(function* () { + let options = { + source: TAB_URL, + line: 1 + }; + let [tab,, panel] = yield initDebugger(TAB_URL, options); + let win = panel.panelWin; + let events = win.EVENTS; + let editor = win.DebuggerView.editor; + let editorContainer = win.document.getElementById("editor"); + let bubble = win.DebuggerView.VariableBubble; + let expressions = win.DebuggerView.WatchExpressions; + let tooltip = bubble._tooltip.panel; + + let onCaretAndScopes = waitForCaretAndScopes(panel, 24); + callInTab(tab, "start"); + yield onCaretAndScopes; + + let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); + expressions.addExpression("this"); + editor.focus(); + yield expressionsEvaluated; + + // Scroll to the top of the editor and inspect variables. + let breakpointScrollPosition = editor.getScrollInfo().top; + editor.setFirstVisibleLine(0); + let topmostScrollPosition = editor.getScrollInfo().top; + + ok(topmostScrollPosition < breakpointScrollPosition, + "The editor is now scrolled to the top (0)."); + is(editor.getFirstVisibleLine(), 0, + "The editor is now scrolled to the top (1)."); + + let failPopup = () => ok(false, "The popup has got unexpectedly hidden."); + let failScroll = () => ok(false, "The editor has got unexpectedly scrolled."); + tooltip.addEventListener("popuphiding", failPopup); + editorContainer.addEventListener("scroll", failScroll); + editor.on("scroll", () => { + if (editor.getScrollInfo().top > topmostScrollPosition) { + ok(false, "The editor scrolled back to the breakpoint location."); + } + }); + + expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); + yield openVarPopup(panel, { line: 14, ch: 15 }); + yield expressionsEvaluated; + + tooltip.removeEventListener("popuphiding", failPopup); + editorContainer.removeEventListener("scroll", failScroll); + + yield resumeDebuggerThenCloseAndFinish(panel); + }); +} |