diff --git a/browser/devtools/debugger/debugger-panes.js b/browser/devtools/debugger/debugger-panes.js index d3c722fa3766..606fa4fa96a6 100644 --- a/browser/devtools/debugger/debugger-panes.js +++ b/browser/devtools/debugger/debugger-panes.js @@ -931,7 +931,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { /** * Called when the add breakpoint key sequence was pressed. */ - _onCmdAddBreakpoint: function() { + _onCmdAddBreakpoint: function(e) { let url = DebuggerView.Sources.selectedValue; let line = DebuggerView.editor.getCursor().line + 1; let location = { url: url, line: line }; @@ -1807,6 +1807,12 @@ VariableBubbleView.prototype = { this._editorContainer.removeEventListener("mouseleave", this._onMouseLeave, false); }, + /** + * Specifies whether literals can be (redundantly) inspected in a popup. + * This behavior is deprecated, but still tested in a few places. + */ + _ignoreLiterals: true, + /** * Searches for an identifier underneath the specified position in the * source editor, and if found, opens a VariablesView inspection popup. @@ -1846,7 +1852,8 @@ VariableBubbleView.prototype = { let identifierInfo = parsedSource.getIdentifierAt({ line: scriptLine + 1, column: scriptColumn, - scriptIndex: scriptInfo.index + scriptIndex: scriptInfo.index, + ignoreLiterals: this._ignoreLiterals }); // If the info is null, we're not hovering any identifier. diff --git a/browser/devtools/debugger/debugger.xul b/browser/devtools/debugger/debugger.xul index 299c0d03b8e0..5398d5c30b21 100644 --- a/browser/devtools/debugger/debugger.xul +++ b/browser/devtools/debugger/debugger.xul @@ -57,7 +57,7 @@ + oncommand="DepbuggerView.Filtering._doFunctionSearch()"/> debuggee.start()); + yield waitForSourceAndCaretAndScopes(panel, ".html", 24); + + yield openVarPopup(panel, { line: 15, ch: 12 }); + ok(true, "The variable inspection popup was shown for the real variable."); + + once(tooltip, "popupshown").then(() => { + ok(false, "The variable inspection popup shouldn't have been opened."); + }); + + reopenVarPopup(panel, { line: 17, ch: 27 }); + yield waitForTime(1000); + + yield resumeDebuggerThenCloseAndFinish(panel); + }); +} diff --git a/browser/devtools/shared/Parser.jsm b/browser/devtools/shared/Parser.jsm index 1e95cb34ddd9..d61b96d17f05 100644 --- a/browser/devtools/shared/Parser.jsm +++ b/browser/devtools/shared/Parser.jsm @@ -136,8 +136,8 @@ SyntaxTreesPool.prototype = { /** * @see SyntaxTree.prototype.getIdentifierAt */ - getIdentifierAt: function({ line, column, scriptIndex }) { - return this._call("getIdentifierAt", scriptIndex, line, column)[0]; + getIdentifierAt: function({ line, column, scriptIndex, ignoreLiterals }) { + return this._call("getIdentifierAt", scriptIndex, line, column, ignoreLiterals)[0]; }, /** @@ -256,11 +256,13 @@ SyntaxTree.prototype = { * The line in the source. * @param number aColumn * The column in the source. + * @param boolean aIgnoreLiterals + * Specifies if alone literals should be ignored. * @return object * An object containing identifier information as { name, location, * evalString } properties, or null if nothing is found. */ - getIdentifierAt: function(aLine, aColumn) { + getIdentifierAt: function(aLine, aColumn, aIgnoreLiterals) { let info = null; SyntaxTreeVisitor.walk(this.AST, { @@ -286,7 +288,9 @@ SyntaxTree.prototype = { * @param Node aNode */ onLiteral: function(aNode) { - this.onIdentifier(aNode); + if (!aIgnoreLiterals) { + this.onIdentifier(aNode); + } }, /** @@ -705,11 +709,7 @@ let ParserHelpers = { case "Identifier": return aNode.name; case "Literal": - if (typeof aNode.value == "string") { - return "\"" + aNode.value + "\""; - } else { - return aNode.value + ""; - } + return uneval(aNode.value); default: return ""; }