author | Victor Porof <vporof@mozilla.com> |
Tue, 28 Jan 2014 12:18:20 +0200 | |
changeset 165559 | 321d5443344db741b2dd325fa1241b187b426c8a |
parent 165558 | e2aa30eb26497f779298ccb93e8db4b789b90e2c |
child 165560 | 4ff11d0219ccc1a108eb8512d6760001fde264f4 |
push id | 26097 |
push user | ryanvm@gmail.com |
push date | Tue, 28 Jan 2014 21:18:27 +0000 |
treeherder | mozilla-central@128c86a925d7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | past |
bugs | 963932 |
milestone | 29.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/devtools/debugger/debugger-toolbar.js | file | annotate | diff | comparison | revisions | |
browser/devtools/shared/Parser.jsm | file | annotate | diff | comparison | revisions |
--- a/browser/devtools/debugger/debugger-toolbar.js +++ b/browser/devtools/debugger/debugger-toolbar.js @@ -1386,34 +1386,34 @@ FilteredFunctionsView.prototype = Herita * @param array aSources * An array of [url, text] tuples for each source. */ _doSearch: function(aToken, aSources, aStore = []) { // Continue parsing even if the searched token is an empty string, to // cache the syntax tree nodes generated by the reflection API. // Make sure the currently displayed source is parsed first. Once the - // maximum allowed number of resutls are found, parsing will be halted. + // maximum allowed number of results are found, parsing will be halted. let currentUrl = DebuggerView.Sources.selectedValue; let currentSource = aSources.filter(([sourceUrl]) => sourceUrl == currentUrl)[0]; aSources.splice(aSources.indexOf(currentSource), 1); aSources.unshift(currentSource); // If not searching for a specific function, only parse the displayed source, // which is now the first item in the sources array. if (!aToken) { aSources.splice(1); } for (let [location, contents] of aSources) { let parsedSource = DebuggerController.Parser.get(contents, location); let sourceResults = parsedSource.getNamedFunctionDefinitions(aToken); for (let scriptResult of sourceResults) { - for (let parseResult of scriptResult.parseResults) { + for (let parseResult of scriptResult) { aStore.push({ sourceUrl: scriptResult.sourceUrl, scriptOffset: scriptResult.scriptOffset, functionName: parseResult.functionName, functionLocation: parseResult.functionLocation, inferredName: parseResult.inferredName, inferredChain: parseResult.inferredChain, inferredLocation: parseResult.inferredLocation
--- a/browser/devtools/shared/Parser.jsm +++ b/browser/devtools/shared/Parser.jsm @@ -129,17 +129,17 @@ function SyntaxTreesPool(aSyntaxTrees) { this._cache = new Map(); } SyntaxTreesPool.prototype = { /** * @see SyntaxTree.prototype.getIdentifierAt */ getIdentifierAt: function({ line, column, scriptIndex }) { - return this._first(this._call("getIdentifierAt", scriptIndex, line, column)); + return this._call("getIdentifierAt", scriptIndex, line, column)[0]; }, /** * @see SyntaxTree.prototype.getNamedFunctionDefinitions */ getNamedFunctionDefinitions: function(aSubstring) { return this._call("getNamedFunctionDefinitions", -1, aSubstring); }, @@ -173,28 +173,16 @@ SyntaxTreesPool.prototype = { } } info.index = -1; return info; }, /** - * Gets the first script results from a source results set. - * If no results are found, null is returned. - * - * @return array - * A collection of parse results for the first script in a source. - */ - _first: function(aSourceResults) { - let scriptResult = aSourceResults.filter(e => !!e.parseResults)[0]; - return scriptResult ? scriptResult.parseResults : null; - }, - - /** * Handles a request for a specific or all known syntax trees. * * @param string aFunction * The function name to call on the SyntaxTree instances. * @param number aSyntaxTreeIndex * The syntax tree for which to handle the request. If the tree at * the specified index isn't found, the accumulated results for all * syntax trees are returned. @@ -211,22 +199,23 @@ SyntaxTreesPool.prototype = { return this._cache.get(requestId); } let requestedTree = this._trees[aSyntaxTreeIndex]; let targettedTrees = requestedTree ? [requestedTree] : this._trees; for (let syntaxTree of targettedTrees) { try { - results.push({ - sourceUrl: syntaxTree.url, - scriptLength: syntaxTree.length, - scriptOffset: syntaxTree.offset, - parseResults: syntaxTree[aFunction].apply(syntaxTree, aParams) - }); + let parseResults = syntaxTree[aFunction].apply(syntaxTree, aParams); + if (parseResults) { + parseResults.sourceUrl = syntaxTree.url; + parseResults.scriptLength = syntaxTree.length; + parseResults.scriptOffset = syntaxTree.offset; + results.push(parseResults); + } } catch (e) { // Can't guarantee that the tree traversal logic is forever perfect :) // Language features may be added, in which case the recursive methods // need to be updated. If an exception is thrown here, file a bug. DevToolsUtils.reportException("syntax tree", e); } } this._cache.set(requestId, results);