diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/inspector/front-end')
10 files changed, 121 insertions, 115 deletions
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Console.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Console.js index 65cc7d0..bce1784 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/Console.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Console.js @@ -241,7 +241,7 @@ WebInspector.Console.prototype = { delete this.previousMessage; }, - completions: function(wordRange, bestMatchOnly) + completions: function(wordRange, bestMatchOnly, completionsReadyCallback) { // Pass less stop characters to rangeOfWord so the range will be a more complete expression. const expressionStopCharacters = " =:{;"; @@ -259,22 +259,20 @@ WebInspector.Console.prototype = { if (!expressionString && !prefix) return; - var result; + var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix); if (expressionString) { - try { - result = this._evalInInspectedWindow(expressionString); - } catch(e) { - // Do nothing, the prefix will be considered a window property. - } + this._evalInInspectedWindow(expressionString, reportCompletions); } else { // There is no expressionString, so the completion should happen against global properties. // Or if the debugger is paused, against properties in scope of the selected call frame. if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) - result = WebInspector.panels.scripts.variablesInScopeForSelectedCallFrame(); + reportCompletions(WebInspector.panels.scripts.variablesInScopeForSelectedCallFrame()); else - result = InspectorController.inspectedWindow(); + reportCompletions(InspectorController.inspectedWindow()); } - + }, + + _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result) { if (bracketNotation) { if (prefix.length && prefix[0] === "'") var quoteUsed = "'"; @@ -305,8 +303,7 @@ WebInspector.Console.prototype = { if (bestMatchOnly) break; } - - return results; + setTimeout(completionsReadyCallback, 0, results); }, _toggleButtonClicked: function() @@ -394,12 +391,18 @@ WebInspector.Console.prototype = { event.stopPropagation(); }, - _evalInInspectedWindow: function(expression) + _evalInInspectedWindow: function(expression, callback) { - if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) - return WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression); + if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { + WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, callback); + return; + } - var inspectedWindow = InspectorController.inspectedWindow(); + this.doEvalInWindow(expression, callback); + }, + + _ensureCommandLineAPIInstalled: function(inspectedWindow) + { if (!inspectedWindow._inspectorCommandLineAPI) { inspectedWindow.eval("window._inspectorCommandLineAPI = { \ $: function() { return document.getElementById.apply(document, arguments) }, \ @@ -424,12 +427,26 @@ WebInspector.Console.prototype = { inspectedWindow._inspectorCommandLineAPI.clear = InspectorController.wrapCallback(this.clearMessages.bind(this)); } - + }, + + doEvalInWindow: function(expression, callback) + { // Surround the expression in with statements to inject our command line API so that // the window object properties still take more precedent than our API functions. expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; - return inspectedWindow.eval(expression); + var self = this; + function delayedEvaluation() + { + var inspectedWindow = InspectorController.inspectedWindow(); + self._ensureCommandLineAPIInstalled(inspectedWindow); + try { + callback(inspectedWindow.eval(expression)); + } catch (e) { + callback(e, true); + } + } + setTimeout(delayedEvaluation, 0); }, _enterKeyPressed: function(event) @@ -449,20 +466,15 @@ WebInspector.Console.prototype = { var commandMessage = new WebInspector.ConsoleCommand(str); this.addMessage(commandMessage); - var result; - var exception = false; - try { - result = this._evalInInspectedWindow(str); - } catch(e) { - result = e; - exception = true; + var self = this; + function printResult(result, exception) + { + self.prompt.history.push(str); + self.prompt.historyOffset = 0; + self.prompt.text = ""; + self.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage)); } - - this.prompt.history.push(str); - this.prompt.historyOffset = 0; - this.prompt.text = ""; - - this.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage)); + this._evalInInspectedWindow(str, printResult); }, _format: function(output, forceObjectFormat) diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js index 122707f..429c2c3 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js @@ -58,7 +58,7 @@ WebInspector.DatabaseQueryView.prototype = { setTimeout(moveBackIfOutside.bind(this), 0); }, - completions: function(wordRange, bestMatchOnly) + completions: function(wordRange, bestMatchOnly, completionsReadyCallback) { var prefix = wordRange.toString().toLowerCase(); if (!prefix.length) @@ -85,7 +85,7 @@ WebInspector.DatabaseQueryView.prototype = { accumulateMatches(this.database.tableNames.map(function(name) { return name + " " })); accumulateMatches(["SELECT ", "FROM ", "WHERE ", "LIMIT ", "DELETE FROM ", "CREATE ", "DROP ", "TABLE ", "INDEX ", "UPDATE ", "INSERT INTO ", "VALUES ("]); - return results; + completionsReadyCallback(results); }, _promptKeyDown: function(event) @@ -157,7 +157,7 @@ WebInspector.DatabaseQueryView.prototype = { else if (error.code == 2) var message = WebInspector.UIString("Database no longer has expected version."); else - var message = WebInspector.UIString("An unexpected error %s occured.", error.code); + var message = WebInspector.UIString("An unexpected error %s occurred.", error.code); this._appendQueryResult(query, message, "error"); }, diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourcesSilhouette.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourcesSilhouette.png Binary files differnew file mode 100644 index 0000000..9c8bb53 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourcesSilhouette.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ObjectPropertiesSection.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ObjectPropertiesSection.js index ab6ac55..59e7374 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ObjectPropertiesSection.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ObjectPropertiesSection.js @@ -214,13 +214,18 @@ WebInspector.ObjectPropertyTreeElement.prototype = { this.editingEnded(context); }, - evaluateExpression: function(expression) + evaluateExpression: function(expression, callback) { // Evaluate in the currently selected call frame if the debugger is paused. // Otherwise evaluate in against the inspected window. if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused && this.treeOutline.section.editInSelectedCallFrameWhenPaused) - return WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false); - return InspectorController.inspectedWindow().eval(expression); + return WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, callback); + try { + var result = InspectorController.inspectedWindow().eval(expression); + callback(result); + } catch (e) { + callback(e, true); + } }, applyExpression: function(expression, updateInterface) diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileView.js index d00733c..bc78fc8 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileView.js @@ -166,8 +166,8 @@ WebInspector.ProfileView.prototype = { for (var index = 0; index < count; ++index) this.dataGrid.appendChild(children[index]); - if (selectedProfileNode && selectedProfileNode._dataGridNode) - selectedProfileNode._dataGridNode.selected = true; + if (selectedProfileNode) + selectedProfileNode.selected = true; }, refreshVisibleData: function() @@ -196,8 +196,7 @@ WebInspector.ProfileView.prototype = { delete profileNode._searchMatchedCallsColumn; delete profileNode._searchMatchedFunctionColumn; - if (profileNode._dataGridNode) - profileNode._dataGridNode.refresh(); + profileNode.refresh(); } } @@ -313,7 +312,7 @@ WebInspector.ProfileView.prototype = { profileDataGridNode._searchMatchedTotalColumn || profileDataGridNode._searchMatchedAverageColumn || profileDataGridNode._searchMatchedCallsColumn || - profileDataGridNode._searchMatchedFunctionColumn); + profileDataGridNode._searchMatchedFunctionColumn) { profileDataGridNode.refresh(); return true; @@ -322,48 +321,14 @@ WebInspector.ProfileView.prototype = { return false; } - var current = this.dataGrid; - var ancestors = []; - var nextIndexes = []; - var startIndex = 0; + var current = this.profileDataGridTree.children[0]; while (current) { - var children = current.children; - var childrenLength = children.length; - - if (startIndex >= childrenLength) { - current = ancestors.pop(); - startIndex = nextIndexes.pop(); - continue; + if (matchesQuery(current)) { + this._searchResults.push({ profileNode: current }); } - for (var i = startIndex; i < childrenLength; ++i) { - var child = children[i]; - - if (matchesQuery(child)) { - if (child._dataGridNode) { - // The child has a data grid node already, no need to remember the ancestors. - this._searchResults.push({ profileNode: child }); - } else { - var ancestorsCopy = [].concat(ancestors); - ancestorsCopy.push(current); - this._searchResults.push({ profileNode: child, ancestors: ancestorsCopy }); - } - } - - if (child.children.length) { - ancestors.push(current); - nextIndexes.push(i + 1); - current = child; - startIndex = 0; - break; - } - - if (i === (childrenLength - 1)) { - current = ancestors.pop(); - startIndex = nextIndexes.pop(); - } - } + current = current.traverseNextNode(false, null, false); } finishedCallback(this, this._searchResults.length); @@ -419,26 +384,9 @@ WebInspector.ProfileView.prototype = { if (!searchResult) return; - var profileNode = this._searchResults[index].profileNode; - if (!profileNode._dataGridNode && searchResult.ancestors) { - var ancestors = searchResult.ancestors; - for (var i = 0; i < ancestors.length; ++i) { - var ancestorProfileNode = ancestors[i]; - var gridNode = ancestorProfileNode._dataGridNode; - if (gridNode) - gridNode.expand(); - } - - // No need to keep the ancestors around. - delete searchResult.ancestors; - } - - gridNode = profileNode._dataGridNode; - if (!gridNode) - return; - - gridNode.reveal(); - gridNode.select(); + var profileNode = searchResult.profileNode; + profileNode.reveal(); + profileNode.select(); }, _changeView: function(event) diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfilesPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfilesPanel.js index aafc306..3808025 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfilesPanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfilesPanel.js @@ -266,8 +266,10 @@ WebInspector.ProfilesPanel.prototype = { groupNumber = ++this._profileGroupsForLinks[title]; - if (groupNumber >= 2) - title += " " + WebInspector.UIString("Run %d", groupNumber); + if (groupNumber > 2) + // The title is used in the console message announcing that a profile has started so it gets + // incremented twice as often as it's displayed + title += " " + WebInspector.UIString("Run %d", groupNumber / 2); } return title; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Script.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Script.js index 46502a6..e6413a9 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/Script.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Script.js @@ -31,6 +31,19 @@ WebInspector.Script = function(sourceID, sourceURL, source, startingLine, errorL this.startingLine = startingLine; this.errorLine = errorLine; this.errorMessage = errorMessage; + + // if no URL, look for "//@ sourceURL=" decorator + // note that this sourceURL comment decorator is behavior that FireBug added + // in it's 1.1 release as noted in the release notes: + // http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt + if (!sourceURL) { + // use of [ \t] rather than \s is to prevent \n from matching + var pattern = /^\s*\/\/[ \t]*@[ \t]*sourceURL[ \t]*=[ \t]*(\S+).*$/m; + var match = pattern.exec(source); + + if (match) + this.sourceURL = WebInspector.UIString("(program): %s", match[1]); + } } WebInspector.Script.prototype = { diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js index 7af9292..d30c002 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js @@ -316,17 +316,36 @@ WebInspector.ScriptsPanel.prototype = { sourceFrame.removeBreakpoint(breakpoint); }, - evaluateInSelectedCallFrame: function(code, updateInterface) + evaluateInSelectedCallFrame: function(code, updateInterface, callback) { var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame; if (!this._paused || !selectedCallFrame) return; + if (typeof updateInterface === "undefined") updateInterface = true; - var result = selectedCallFrame.evaluate(code); - if (updateInterface) - this.sidebarPanes.scopechain.update(selectedCallFrame); - return result; + + var self = this; + function updatingCallbackWrapper(result) + { + callback(result); + if (updateInterface) + self.sidebarPanes.scopechain.update(selectedCallFrame); + } + this.doEvalInCallFrame(selectedCallFrame, code, updatingCallbackWrapper); + }, + + doEvalInCallFrame: function(callFrame, code, callback) + { + function delayedEvaluation() + { + try { + callback(callFrame.evaluate(code)); + } catch (e) { + callback(e, true); + } + } + setTimeout(delayedEvaluation, 0); }, variablesInScopeForSelectedCallFrame: function() diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js b/src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js index 61e1b52..30772f7 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js @@ -140,7 +140,6 @@ WebInspector.TextPrompt.prototype = { complete: function(auto) { this.clearAutoComplete(true); - var selection = window.getSelection(); if (!selection.rangeCount) return; @@ -150,17 +149,25 @@ WebInspector.TextPrompt.prototype = { return; if (auto && !this.isCaretAtEndOfPrompt()) return; - var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, this.completionStopCharacters, this.element, "backward"); - var completions = this.completions(wordPrefixRange, auto); + this.completions(wordPrefixRange, auto, this._completionsReady.bind(this, selection, auto, wordPrefixRange)); + }, + _completionsReady: function(selection, auto, originalWordPrefixRange, completions) + { if (!completions || !completions.length) return; + var selectionRange = selection.getRangeAt(0); + var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, this.completionStopCharacters, this.element, "backward"); + var fullWordRange = document.createRange(); fullWordRange.setStart(wordPrefixRange.startContainer, wordPrefixRange.startOffset); fullWordRange.setEnd(selectionRange.endContainer, selectionRange.endOffset); + if (originalWordPrefixRange.toString() + selectionRange.toString() != fullWordRange.toString()) + return; + if (completions.length === 1 || selection.isCollapsed || auto) { var completionText = completions[0]; } else { diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css index 2653781..c162531 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css @@ -444,8 +444,8 @@ body.console-visible #console { left: 0; right: 0; bottom: 23px; - font-size: 10px; - font-family: Monaco, Lucida Console, monospace; + font-size: initial; + font-family: monospace; padding: 2px 0; overflow-y: overlay; -webkit-user-select: text; @@ -1811,8 +1811,8 @@ body.inactive .data-grid th.sort-ascending, body.inactive .data-grid th.sort-des } .storage-view.query { - font-size: 10px; - font-family: Monaco, Lucida Console, monospace; + font-size: initial; + font-family: monospace; padding: 2px 0; overflow-y: overlay; overflow-x: hidden; @@ -2006,7 +2006,7 @@ body.inactive .panel-enabler-view button, .panel-enabler-view button:disabled { } .panel-enabler-view.resources img { - content: url(Images/scriptsSilhouette.png); + content: url(Images/resourcesSilhouette.png); } .panel-enabler-view.scripts img { |