mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 965171 - Opening a variables view popup will change the scroll position in the editor if a watch expression is present, r=past
This commit is contained in:
parent
7c5d18cfc0
commit
72202b3af5
@ -835,7 +835,9 @@ StackFrames.prototype = {
|
||||
// Don't change the editor's location if the execution was paused by a
|
||||
// public client evaluation. This is useful for adding overlays on
|
||||
// top of the editor, like a variable inspection popup.
|
||||
if (this._currentFrameDescription != FRAME_TYPE.PUBLIC_CLIENT_EVAL) {
|
||||
let isClientEval = this._currentFrameDescription == FRAME_TYPE.PUBLIC_CLIENT_EVAL;
|
||||
let isPopupShown = DebuggerView.VariableBubble.contentsShown();
|
||||
if (!isClientEval && !isPopupShown) {
|
||||
// Move the editor's caret to the proper url and line.
|
||||
DebuggerView.setEditorLocation(where.url, where.line);
|
||||
// Highlight the breakpoint at the specified url and line if it exists.
|
||||
|
@ -1908,6 +1908,16 @@ VariableBubbleView.prototype = {
|
||||
this._tooltip.hide();
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks whether the inspection popup is shown.
|
||||
*
|
||||
* @return boolean
|
||||
* True if the panel is shown or showing, false otherwise.
|
||||
*/
|
||||
contentsShown: function() {
|
||||
return this._tooltip.isShown();
|
||||
},
|
||||
|
||||
/**
|
||||
* Functions for getting customized variables view evaluation macros.
|
||||
*
|
||||
|
@ -243,6 +243,7 @@ support-files =
|
||||
[browser_dbg_variables-view-popup-07.js]
|
||||
[browser_dbg_variables-view-popup-08.js]
|
||||
[browser_dbg_variables-view-popup-09.js]
|
||||
[browser_dbg_variables-view-popup-10.js]
|
||||
[browser_dbg_variables-view-reexpand-01.js]
|
||||
[browser_dbg_variables-view-reexpand-02.js]
|
||||
[browser_dbg_variables-view-webidl.js]
|
||||
|
@ -20,6 +20,8 @@ function test() {
|
||||
// Inspect variable.
|
||||
yield openVarPopup(panel, { line: 15, ch: 12 });
|
||||
|
||||
ok(bubble.contentsShown(),
|
||||
"The variable should register as being shown.");
|
||||
ok(!bubble._tooltip.isEmpty(),
|
||||
"The variable inspection popup isn't empty.");
|
||||
ok(bubble._markedText,
|
||||
@ -29,6 +31,8 @@ function test() {
|
||||
|
||||
yield hideVarPopup(panel);
|
||||
|
||||
ok(!bubble.contentsShown(),
|
||||
"The variable should register as being hidden.");
|
||||
ok(bubble._tooltip.isEmpty(),
|
||||
"The variable inspection popup is now empty.");
|
||||
ok(!bubble._markedText,
|
||||
|
@ -50,14 +50,16 @@ function test() {
|
||||
verifyContents("\"second scope\"", "token-string");
|
||||
checkView(0, 20);
|
||||
|
||||
// Change frame.
|
||||
// Hide the popup and change the frame.
|
||||
yield hideVarPopup(panel);
|
||||
|
||||
let updatedFrame = waitForDebuggerEvents(panel, events.FETCHED_SCOPES);
|
||||
frames.selectedDepth = 1;
|
||||
yield updatedFrame;
|
||||
checkView(1, 15);
|
||||
|
||||
// Inspect variable in oldest frame.
|
||||
yield reopenVarPopup(panel, { line: 13, ch: 12 });
|
||||
yield openVarPopup(panel, { line: 13, ch: 12 });
|
||||
verifyContents("\"first scope\"", "token-string");
|
||||
checkView(1, 15);
|
||||
|
||||
|
@ -0,0 +1,61 @@
|
||||
/* 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 [tab, debuggee, panel] = yield initDebugger(TAB_URL);
|
||||
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;
|
||||
|
||||
// Allow this generator function to yield first.
|
||||
executeSoon(() => debuggee.start());
|
||||
yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
|
||||
|
||||
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.");
|
||||
}
|
||||
});
|
||||
|
||||
let 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);
|
||||
});
|
||||
}
|
@ -89,6 +89,7 @@ const CM_MAPPING = [
|
||||
"clearHistory",
|
||||
"openDialog",
|
||||
"refresh",
|
||||
"getScrollInfo",
|
||||
"getOption",
|
||||
"setOption"
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user