Index: chrome/tools/test/reference_build/chrome_linux/resources/inspector/devtools.js |
diff --git a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/devtools.js b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/devtools.js |
index 3b2a6e15bad79c2d2d1d61915da6f278a57482c5..2520f0fff3a10d93bc80521c036a5fc38fa8f0b9 100644 |
--- a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/devtools.js |
+++ b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/devtools.js |
@@ -3,25 +3,23 @@ |
// found in the LICENSE file. |
/** |
- * @fileoverview Tools is a main class that wires all components of the |
+ * @fileoverview Tools is a main class that wires all components of the |
* DevTools frontend together. It is also responsible for overriding existing |
* WebInspector functionality while it is getting upstreamed into WebCore. |
*/ |
goog.provide('devtools.Tools'); |
goog.require('devtools.DebuggerAgent'); |
-goog.require('devtools.DomAgent'); |
-goog.require('devtools.NetAgent'); |
/** |
* Dispatches raw message from the host. |
- * @param {Object} msg Message to dispatch. |
+ * @param {string} remoteName |
+ * @prama {string} methodName |
+ * @param {string} param1, param2, param3 Arguments to dispatch. |
*/ |
-devtools.dispatch = function(msg) { |
- var delegate = msg[0]; |
- var methodName = msg[1]; |
- var remoteName = 'Remote' + delegate.substring(0, delegate.length - 8); |
+devtools$$dispatch = function(remoteName, methodName, param1, param2, param3) { |
+ remoteName = 'Remote' + remoteName.substring(0, remoteName.length - 8); |
var agent = window[remoteName]; |
if (!agent) { |
debugPrint('No remote agent "' + remoteName + '" found.'); |
@@ -32,23 +30,18 @@ devtools.dispatch = function(msg) { |
debugPrint('No method "' + remoteName + '.' + methodName + '" found.'); |
return; |
} |
- method.apply(this, msg.slice(2)); |
+ method.call(this, param1, param2, param3); |
}; |
devtools.ToolsAgent = function() { |
- RemoteToolsAgent.DidEvaluateJavaScript = devtools.Callback.processCallback; |
RemoteToolsAgent.DidExecuteUtilityFunction = |
devtools.Callback.processCallback; |
- RemoteToolsAgent.UpdateFocusedNode = |
- goog.bind(this.updateFocusedNode, this); |
RemoteToolsAgent.FrameNavigate = |
- goog.bind(this.frameNavigate, this); |
- RemoteToolsAgent.AddMessageToConsole = |
- goog.bind(this.addMessageToConsole, this); |
+ goog.bind(this.frameNavigate_, this); |
+ RemoteToolsAgent.DispatchOnClient = |
+ goog.bind(this.dispatchOnClient_, this); |
this.debuggerAgent_ = new devtools.DebuggerAgent(); |
- this.domAgent_ = new devtools.DomAgent(); |
- this.netAgent_ = new devtools.NetAgent(); |
}; |
@@ -56,23 +49,20 @@ devtools.ToolsAgent = function() { |
* Resets tools agent to its initial state. |
*/ |
devtools.ToolsAgent.prototype.reset = function() { |
- this.domAgent_.reset(); |
- this.netAgent_.reset(); |
+ DevToolsHost.reset(); |
this.debuggerAgent_.reset(); |
- |
- this.domAgent_.getDocumentElementAsync(); |
}; |
/** |
* @param {string} script Script exression to be evaluated in the context of the |
* inspected page. |
- * @param {function(string):undefined} callback Function to call with the |
- * result. |
+ * @param {function(Object|string, boolean):undefined} opt_callback Function to |
+ * call with the result. |
*/ |
-devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, callback) { |
- var callbackId = devtools.Callback.wrap(callback); |
- RemoteToolsAgent.EvaluateJavaScript(callbackId, script); |
+devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, |
+ opt_callback) { |
+ InspectorController.evaluate(script, opt_callback || function() {}); |
}; |
@@ -83,57 +73,33 @@ devtools.ToolsAgent.prototype.getDebuggerAgent = function() { |
return this.debuggerAgent_; |
}; |
-/** |
- * DomAgent accessor. |
- * @return {devtools.DomAgent} Dom agent instance. |
- */ |
-devtools.ToolsAgent.prototype.getDomAgent = function() { |
- return this.domAgent_; |
-}; |
- |
- |
-/** |
- * NetAgent accessor. |
- * @return {devtools.NetAgent} Net agent instance. |
- */ |
-devtools.ToolsAgent.prototype.getNetAgent = function() { |
- return this.netAgent_; |
-}; |
- |
- |
-/** |
- * @see tools_agent.h |
- */ |
-devtools.ToolsAgent.prototype.updateFocusedNode = function(nodeId) { |
- var node = this.domAgent_.getNodeForId(nodeId); |
- WebInspector.updateFocusedNode(node); |
-}; |
- |
/** |
* @param {string} url Url frame navigated to. |
- * @param {bool} topLevel True iff top level navigation occurred. |
* @see tools_agent.h |
- */ |
-devtools.ToolsAgent.prototype.frameNavigate = function(url, topLevel) { |
- if (topLevel) { |
- this.reset(); |
- WebInspector.reset(); |
+ * @private |
+ */ |
+devtools.ToolsAgent.prototype.frameNavigate_ = function(url) { |
+ this.reset(); |
+ // Do not reset Profiles panel. |
+ var profiles = null; |
+ if ('profiles' in WebInspector.panels) { |
+ profiles = WebInspector.panels['profiles']; |
+ delete WebInspector.panels['profiles']; |
+ } |
+ WebInspector.reset(); |
+ if (profiles != null) { |
+ WebInspector.panels['profiles'] = profiles; |
} |
}; |
/** |
- * @param {Object} message Message object to add. |
- * @see tools_agent.h |
+ * @param {string} message Serialized call to be dispatched on WebInspector. |
+ * @private |
*/ |
-devtools.ToolsAgent.prototype.addMessageToConsole = function(message) { |
- var console = WebInspector.console; |
- if (console) { |
- console.addMessage(new WebInspector.ConsoleMessage( |
- message.source, message.level, message.line, message.sourceId, |
- undefined, 1, message.text)); |
- } |
+devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message) { |
+ WebInspector.dispatch.apply(WebInspector, JSON.parse(message)); |
}; |
@@ -147,6 +113,16 @@ devtools.ToolsAgent.prototype.evaluate = function(expr) { |
/** |
+ * Enables / disables resources panel in the ui. |
+ * @param {boolean} enabled New panel status. |
+ */ |
+WebInspector.setResourcesPanelEnabled = function(enabled) { |
+ InspectorController.resourceTrackingEnabled_ = enabled; |
+ WebInspector.panels.resources.reset(); |
+}; |
+ |
+ |
+/** |
* Prints string to the inspector console or shows alert if the console doesn't |
* exist. |
* @param {string} text |
@@ -155,7 +131,10 @@ function debugPrint(text) { |
var console = WebInspector.console; |
if (console) { |
console.addMessage(new WebInspector.ConsoleMessage( |
- '', undefined, 1, '', undefined, 1, text)); |
+ WebInspector.ConsoleMessage.MessageSource.JS, |
+ WebInspector.ConsoleMessage.MessageType.Log, |
+ WebInspector.ConsoleMessage.MessageLevel.Log, |
+ 1, 'chrome://devtools/<internal>', undefined, -1, text)); |
} else { |
alert(text); |
} |
@@ -171,7 +150,6 @@ devtools.tools = null; |
var context = {}; // Used by WebCore's inspector routines. |
- |
/////////////////////////////////////////////////////////////////////////////// |
// Here and below are overrides to existing WebInspector methods only. |
// TODO(pfeldman): Patch WebCore and upstream changes. |
@@ -183,339 +161,23 @@ WebInspector.loaded = function() { |
Preferences.ignoreWhitespace = false; |
oldLoaded.call(this); |
- DevToolsHost.loaded(); |
-}; |
- |
- |
-var webkitUpdateChildren = |
- WebInspector.ElementsTreeElement.prototype.updateChildren; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.ElementsTreeElement.prototype.updateChildren = function() { |
- var self = this; |
- devtools.tools.getDomAgent().getChildNodesAsync(this.representedObject, |
- function() { |
- webkitUpdateChildren.call(self); |
- }); |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.ElementsPanel.prototype.performSearch = function(query) { |
- this.searchCanceled(); |
- devtools.tools.getDomAgent().performSearch(query, |
- goog.bind(this.performSearchCallback_, this)); |
-}; |
- |
- |
-WebInspector.ElementsPanel.prototype.performSearchCallback_ = function(nodes) { |
- for (var i = 0; i < nodes.length; ++i) { |
- var treeElement = this.treeOutline.findTreeElement(nodes[i]); |
- if (treeElement) |
- treeElement.highlighted = true; |
- } |
- |
- if (nodes.length) { |
- this.currentSearchResultIndex_ = 0; |
- this.focusedDOMNode = nodes[0]; |
- } |
- |
- this.searchResultCount_ = nodes.length; |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.ElementsPanel.prototype.searchCanceled = function() { |
- this.currentSearchResultIndex_ = 0; |
- this.searchResultCount_ = 0; |
- devtools.tools.getDomAgent().searchCanceled( |
- goog.bind(this.searchCanceledCallback_, this)); |
-}; |
- |
- |
-WebInspector.ElementsPanel.prototype.searchCanceledCallback_ = function(nodes) { |
- for (var i = 0; i < nodes.length; i++) { |
- var treeElement = this.treeOutline.findTreeElement(nodes[i]); |
- if (treeElement) |
- treeElement.highlighted = false; |
- } |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.ElementsPanel.prototype.jumpToNextSearchResult = function() { |
- if (!this.searchResultCount_) |
- return; |
- |
- if (++this.currentSearchResultIndex_ >= this.searchResultCount_) |
- this.currentSearchResultIndex_ = 0; |
- |
- this.focusedDOMNode = devtools.tools.getDomAgent(). |
- getSearchResultNode(this.currentSearchResultIndex_); |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.ElementsPanel.prototype.jumpToPreviousSearchResult = function() { |
- if (!this.searchResultCount_) |
- return; |
- |
- if (--this.currentSearchResultIndex_ < 0) |
- this.currentSearchResultIndex_ = this.searchResultCount_ - 1; |
- |
- this.focusedDOMNode = devtools.tools.getDomAgent(). |
- getSearchResultNode(this.currentSearchResultIndex_); |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.Console.prototype._evalInInspectedWindow = function(expr) { |
- return devtools.tools.evaluate(expr); |
-}; |
- |
- |
-/** |
- * Disable autocompletion in the console. |
- * TODO(yurys): change WebKit implementation to allow asynchronous completion. |
- * @override |
- */ |
-WebInspector.Console.prototype.completions = function( |
- wordRange, bestMatchOnly) { |
- return null; |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.ElementsPanel.prototype.updateStyles = function(forceUpdate) { |
- var stylesSidebarPane = this.sidebarPanes.styles; |
- if (!stylesSidebarPane.expanded || !stylesSidebarPane.needsUpdate) { |
- return; |
- } |
- this.invokeWithStyleSet_(function(node) { |
- stylesSidebarPane.needsUpdate = !!node; |
- stylesSidebarPane.update(node, null, forceUpdate); |
- }); |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.ElementsPanel.prototype.updateMetrics = function() { |
- var metricsSidebarPane = this.sidebarPanes.metrics; |
- if (!metricsSidebarPane.expanded || !metricsSidebarPane.needsUpdate) { |
- return; |
- } |
- this.invokeWithStyleSet_(function(node) { |
- metricsSidebarPane.needsUpdate = !!node; |
- metricsSidebarPane.update(node); |
- }); |
-}; |
- |
- |
-/** |
- * Temporarily sets style fetched from the inspectable tab to the currently |
- * focused node, invokes updateUI callback and clears the styles. |
- * @param {function(Node):undefined} updateUI Callback to call while styles are |
- * set. |
- */ |
-WebInspector.ElementsPanel.prototype.invokeWithStyleSet_ = |
- function(updateUI) { |
- var node = this.focusedDOMNode; |
- if (node && node.nodeType === Node.TEXT_NODE && node.parentNode) |
- node = node.parentNode; |
- |
- if (node && node.nodeType == Node.ELEMENT_NODE) { |
- var callback = function(stylesStr) { |
- var styles = JSON.parse(stylesStr); |
- if (!styles.computedStyle) { |
- return; |
- } |
- node.setStyles(styles.computedStyle, styles.inlineStyle, |
- styles.styleAttributes, styles.matchedCSSRules); |
- updateUI(node); |
- node.clearStyles(); |
- }; |
- devtools.tools.getDomAgent().getNodeStylesAsync( |
- node, |
- !Preferences.showUserAgentStyles, |
- callback); |
- } else { |
- updateUI(null); |
- } |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.MetricsSidebarPane.prototype.editingCommitted = |
- function(element, userInput, previousContent, context) { |
- if (userInput === previousContent) { |
- // nothing changed, so cancel |
- return this.editingCancelled(element, context); |
- } |
- |
- if (context.box !== "position" && (!userInput || userInput === "\u2012")) { |
- userInput = "0px"; |
- } else if (context.box === "position" && |
- (!userInput || userInput === "\u2012")) { |
- userInput = "auto"; |
- } |
- |
- // Append a "px" unit if the user input was just a number. |
- if (/^\d+$/.test(userInput)) { |
- userInput += "px"; |
- } |
- devtools.tools.getDomAgent().setStylePropertyAsync( |
- this.node, |
- context.styleProperty, |
- userInput, |
- WebInspector.updateStylesAndMetrics_); |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.PropertiesSidebarPane.prototype.update = function(object) { |
- var body = this.bodyElement; |
- body.removeChildren(); |
- |
- this.sections = []; |
- |
- if (!object) { |
- return; |
- } |
- |
- |
- var self = this; |
- devtools.tools.getDomAgent().getNodePrototypesAsync(object.id_, |
- function(json) { |
- // Get array of prototype user-friendly names. |
- var prototypes = JSON.parse(json); |
- for (var i = 0; i < prototypes.length; ++i) { |
- var prototype = {}; |
- prototype.id_ = object.id_; |
- prototype.protoDepth_ = i; |
- var section = new WebInspector.SidebarObjectPropertiesSection( |
- prototype, |
- prototypes[i]); |
- self.sections.push(section); |
- body.appendChild(section.element); |
- } |
- }); |
-}; |
- |
- |
-/** |
- * Our implementation of ObjectPropertiesSection for Elements tab. |
- * @constructor |
- */ |
-WebInspector.SidebarObjectPropertiesSection = function(object, title) { |
- WebInspector.ObjectPropertiesSection.call(this, object, title, |
- null /* subtitle */, null /* emptyPlaceholder */, |
- null /* ignoreHasOwnProperty */, null /* extraProperties */, |
- WebInspector.SidebarObjectPropertyTreeElement /* treeElementConstructor */ |
- ); |
-}; |
-goog.inherits(WebInspector.SidebarObjectPropertiesSection, |
- WebInspector.ObjectPropertiesSection); |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.SidebarObjectPropertiesSection.prototype.onpopulate = function() { |
- var nodeId = this.object.id_; |
- var protoDepth = this.object.protoDepth_; |
- var path = []; |
- devtools.tools.getDomAgent().getNodePropertiesAsync(nodeId, path, protoDepth, |
- goog.partial(WebInspector.didGetNodePropertiesAsync_, |
- this.propertiesTreeOutline, |
- this.treeElementConstructor, |
- nodeId, |
- path)); |
-}; |
- |
- |
-/** |
- * Our implementation of ObjectPropertyTreeElement for Elements tab. |
- * @constructor |
- */ |
-WebInspector.SidebarObjectPropertyTreeElement = function(parentObject, |
- propertyName) { |
- WebInspector.ObjectPropertyTreeElement.call(this, parentObject, |
- propertyName); |
-}; |
-goog.inherits(WebInspector.SidebarObjectPropertyTreeElement, |
- WebInspector.ObjectPropertyTreeElement); |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.SidebarObjectPropertyTreeElement.prototype.onpopulate = |
- function() { |
- var nodeId = this.parentObject.devtools$$nodeId_; |
- var path = this.parentObject.devtools$$path_.slice(0); |
- path.push(this.propertyName); |
- devtools.tools.getDomAgent().getNodePropertiesAsync(nodeId, path, -1, |
- goog.partial( |
- WebInspector.didGetNodePropertiesAsync_, |
- this, |
- this.treeOutline.section.treeElementConstructor, |
- nodeId, path)); |
-}; |
- |
- |
-/** |
- * This override is necessary for starting highlighting after the resource |
- * was added into the frame. |
- * @override |
- */ |
-WebInspector.SourceView.prototype.setupSourceFrameIfNeeded = function() { |
- if (!this._frameNeedsSetup) { |
- return; |
+ // Hide dock button on Mac OS. |
+ // TODO(pfeldman): remove once Mac OS docking is implemented. |
+ if (InspectorController.platform().indexOf('mac') == 0) { |
+ document.getElementById('dock-status-bar-item').addStyleClass('hidden'); |
} |
- this.attach(); |
- |
- var self = this; |
- var identifier = this.resource.identifier; |
- var element = this.sourceFrame.element; |
- var netAgent = devtools.tools.getNetAgent(); |
- |
- netAgent.getResourceContentAsync(identifier, function(source) { |
- var resource = WebInspector.resources[identifier]; |
- if (InspectorController.addSourceToFrame(resource.mimeType, source, |
- element)) { |
- delete self._frameNeedsSetup; |
- if (resource.type === WebInspector.Resource.Type.Script) { |
- self.sourceFrame.addEventListener('syntax highlighting complete', |
- self._syntaxHighlightingComplete, self); |
- self.sourceFrame.syntaxHighlightJavascript(); |
- } else { |
- self._sourceFrameSetupFinished(); |
- } |
+ // Mute refresh action. |
+ document.addEventListener("keydown", function(event) { |
+ if (event.keyIdentifier == 'F5') { |
+ event.preventDefault(); |
+ } else if (event.keyIdentifier == 'U+0052' /* 'R' */ && |
+ (event.ctrlKey || event.metaKey)) { |
+ event.preventDefault(); |
} |
- }); |
- return true; |
+ }, true); |
+ |
+ DevToolsHost.loaded(); |
}; |
@@ -529,7 +191,7 @@ WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded = function() { |
} |
this.attach(); |
- |
+ |
if (this.script.source) { |
this.didResolveScriptSource_(); |
} else { |
@@ -537,7 +199,8 @@ WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded = function() { |
devtools.tools.getDebuggerAgent().resolveScriptSource( |
this.script.sourceID, |
function(source) { |
- self.script.source = source || '<source is not available>'; |
+ self.script.source = source || |
+ WebInspector.UIString('<source is not available>'); |
self.didResolveScriptSource_(); |
}); |
} |
@@ -562,172 +225,13 @@ WebInspector.ScriptView.prototype.didResolveScriptSource_ = function() { |
/** |
- * Dummy object used during properties inspection. |
- * @see WebInspector.didGetNodePropertiesAsync_ |
- */ |
-WebInspector.dummyObject_ = { 'foo' : 'bar' }; |
- |
- |
-/** |
- * Dummy function used during properties inspection. |
- * @see WebInspector.didGetNodePropertiesAsync_ |
- */ |
-WebInspector.dummyFunction_ = function() {}; |
- |
- |
-/** |
- * Callback function used with the getNodeProperties. |
- */ |
-WebInspector.didGetNodePropertiesAsync_ = function(treeOutline, constructor, |
- nodeId, path, json) { |
- var props = JSON.parse(json); |
- var properties = []; |
- var obj = {}; |
- obj.devtools$$nodeId_ = nodeId; |
- obj.devtools$$path_ = path; |
- for (var i = 0; i < props.length; i += 3) { |
- var type = props[i]; |
- var name = props[i + 1]; |
- var value = props[i + 2]; |
- properties.push(name); |
- if (type == 'object') { |
- // fake object is going to be replaced on expand. |
- obj[name] = WebInspector.dummyObject_; |
- } else if (type == 'function') { |
- // fake function is going to be replaced on expand. |
- obj[name] = WebInspector.dummyFunction_; |
- } else { |
- obj[name] = value; |
- } |
- } |
- properties.sort(); |
- |
- treeOutline.removeChildren(); |
- |
- for (var i = 0; i < properties.length; ++i) { |
- var propertyName = properties[i]; |
- treeOutline.appendChild(new constructor(obj, propertyName)); |
- } |
-}; |
- |
- |
-/** |
- * Replace WebKit method with our own implementation to use our call stack |
- * representation. Original method uses Object.prototype.toString.call to |
- * learn if scope object is a JSActivation which doesn't work in Chrome. |
- */ |
-WebInspector.ScopeChainSidebarPane.prototype.update = function(callFrame) { |
- this.bodyElement.removeChildren(); |
- |
- this.sections = []; |
- this.callFrame = callFrame; |
- |
- if (!callFrame) { |
- var infoElement = document.createElement('div'); |
- infoElement.className = 'info'; |
- infoElement.textContent = WebInspector.UIString('Not Paused'); |
- this.bodyElement.appendChild(infoElement); |
- return; |
- } |
- |
- if (!callFrame._expandedProperties) { |
- callFrame._expandedProperties = {}; |
- } |
- |
- var scopeObject = callFrame.localScope; |
- var title = WebInspector.UIString('Local'); |
- var subtitle = Object.describe(scopeObject, true); |
- var emptyPlaceholder = null; |
- var extraProperties = null; |
- |
- var section = new WebInspector.ObjectPropertiesSection(scopeObject, title, |
- subtitle, emptyPlaceholder, true, extraProperties, |
- WebInspector.ScopeChainSidebarPane.TreeElement); |
- section.editInSelectedCallFrameWhenPaused = true; |
- section.pane = this; |
- |
- section.expanded = true; |
- |
- this.sections.push(section); |
- this.bodyElement.appendChild(section.element); |
-}; |
- |
- |
-/** |
- * Custom implementation of TreeElement that asynchronously resolves children |
- * using the debugger agent. |
+ * @param {string} type Type of the the property value('object' or 'function'). |
+ * @param {string} className Class name of the property value. |
* @constructor |
*/ |
-WebInspector.ScopeChainSidebarPane.TreeElement = function(parentObject, |
- propertyName) { |
- WebInspector.ScopeVariableTreeElement.call(this, parentObject, propertyName); |
-} |
-WebInspector.ScopeChainSidebarPane.TreeElement.inherits( |
- WebInspector.ScopeVariableTreeElement); |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.ScopeChainSidebarPane.TreeElement.prototype.onpopulate = |
- function() { |
- var obj = this.parentObject[this.propertyName]; |
- devtools.tools.getDebuggerAgent().resolveChildren(obj, |
- goog.bind(this.didResolveChildren_, this)); |
-}; |
- |
- |
-/** |
- * Callback function used with the resolveChildren. |
- */ |
-WebInspector.ScopeChainSidebarPane.TreeElement.prototype.didResolveChildren_ = |
- function(object) { |
- this.removeChildren(); |
- var constructor = this.treeOutline.section.treeElementConstructor; |
- object = object.resolvedValue; |
- for (var name in object) { |
- this.appendChild(new constructor(object, name)); |
- } |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.StylePropertyTreeElement.prototype.toggleEnabled = |
- function(event) { |
- var enabled = event.target.checked; |
- devtools.tools.getDomAgent().toggleNodeStyleAsync( |
- this.style, |
- enabled, |
- this.name, |
- WebInspector.updateStylesAndMetrics_); |
-}; |
- |
- |
-/** |
- * @override |
- */ |
-WebInspector.StylePropertyTreeElement.prototype.applyStyleText = function( |
- styleText, updateInterface) { |
- devtools.tools.getDomAgent().applyStyleTextAsync(this.style, this.name, |
- styleText, |
- function() { |
- if (updateInterface) { |
- WebInspector.updateStylesAndMetrics_(); |
- } |
- }); |
-}; |
- |
- |
-/** |
- * Forces update of styles and metrics sidebar panes. |
- */ |
-WebInspector.updateStylesAndMetrics_ = function() { |
- WebInspector.panels.elements.sidebarPanes.metrics.needsUpdate = true; |
- WebInspector.panels.elements.updateMetrics(); |
- WebInspector.panels.elements.sidebarPanes.styles.needsUpdate = true; |
- WebInspector.panels.elements.updateStyles(true); |
+WebInspector.UnresolvedPropertyValue = function(type, className) { |
+ this.type = type; |
+ this.className = className; |
}; |
@@ -762,149 +266,143 @@ WebInspector.ScriptsPanel.prototype.__defineGetter__( |
WebInspector.searchableViews_); |
-/** |
- * @override |
- */ |
-WebInspector.Console.prototype._evalInInspectedWindow = function(expression) { |
- if (WebInspector.panels.scripts.paused) |
- return WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression); |
- |
- var console = this; |
- devtools.tools.evaluateJavaScript(expression, function(response) { |
- // TODO(yurys): send exception information along with the response |
- var exception = false; |
- console.addMessage(new WebInspector.ConsoleCommandResult( |
- response, exception, null /* commandMessage */)); |
- }); |
- // TODO(yurys): refactor WebInspector.Console so that the result is added into |
- // the command log message. |
- return 'evaluating...'; |
-}; |
- |
- |
(function() { |
var oldShow = WebInspector.ScriptsPanel.prototype.show; |
WebInspector.ScriptsPanel.prototype.show = function() { |
- devtools.tools.getDebuggerAgent().initializeScriptsCache(); |
+ devtools.tools.getDebuggerAgent().initUI(); |
+ this.enableToggleButton.visible = false; |
oldShow.call(this); |
}; |
})(); |
-/** |
- * We don't use WebKit's BottomUpProfileDataGridTree, instead using |
- * our own (because BottomUpProfileDataGridTree's functionality is |
- * implemented in profile_view.js for V8's Tick Processor). |
- * |
- * @param {WebInspector.ProfileView} profileView Profile view. |
- * @param {devtools.profiler.ProfileView} profile Profile. |
- */ |
-WebInspector.BottomUpProfileDataGridTree = function(profileView, profile) { |
- return WebInspector.buildProfileDataGridTree_( |
- profileView, profile.heavyProfile); |
-}; |
+// As columns in data grid can't be changed after initialization, |
+// we need to intercept the constructor and modify columns upon creation. |
+(function InterceptDataGridForProfiler() { |
+ var originalDataGrid = WebInspector.DataGrid; |
+ WebInspector.DataGrid = function(columns) { |
+ if (('average' in columns) && ('calls' in columns)) { |
+ delete columns['average']; |
+ delete columns['calls']; |
+ } |
+ return new originalDataGrid(columns); |
+ }; |
+})(); |
-/** |
- * We don't use WebKit's TopDownProfileDataGridTree, instead using |
- * our own (because TopDownProfileDataGridTree's functionality is |
- * implemented in profile_view.js for V8's Tick Processor). |
- * |
- * @param {WebInspector.ProfileView} profileView Profile view. |
- * @param {devtools.profiler.ProfileView} profile Profile. |
- */ |
-WebInspector.TopDownProfileDataGridTree = function(profileView, profile) { |
- return WebInspector.buildProfileDataGridTree_( |
- profileView, profile.treeProfile); |
+// WebKit's profiler displays milliseconds with high resolution (shows |
+// three digits after the decimal point). We never have such resolution, |
+// as our minimal sampling rate is 1 ms. So we are disabling high resolution |
+// to avoid visual clutter caused by meaningless ".000" parts. |
+(function InterceptTimeDisplayInProfiler() { |
+ var originalDataGetter = |
+ WebInspector.ProfileDataGridNode.prototype.__lookupGetter__('data'); |
+ WebInspector.ProfileDataGridNode.prototype.__defineGetter__('data', |
+ function() { |
+ var oldNumberSecondsToString = Number.secondsToString; |
+ Number.secondsToString = function(seconds, formatterFunction) { |
+ return oldNumberSecondsToString(seconds, formatterFunction, false); |
+ }; |
+ var data = originalDataGetter.call(this); |
+ Number.secondsToString = oldNumberSecondsToString; |
+ return data; |
+ }); |
+})(); |
+ |
+ |
+(function InterceptProfilesPanelEvents() { |
+ var oldShow = WebInspector.ProfilesPanel.prototype.show; |
+ WebInspector.ProfilesPanel.prototype.show = function() { |
+ devtools.tools.getDebuggerAgent().initializeProfiling(); |
+ this.enableToggleButton.visible = false; |
+ oldShow.call(this); |
+ // Show is called on every show event of a panel, so |
+ // we only need to intercept it once. |
+ WebInspector.ProfilesPanel.prototype.show = oldShow; |
+ }; |
+})(); |
+ |
+ |
+/* |
+ * @override |
+ * TODO(mnaganov): Restore l10n when it will be agreed that it is needed. |
+ */ |
+WebInspector.UIString = function(string) { |
+ return String.vsprintf(string, Array.prototype.slice.call(arguments, 1)); |
}; |
-/** |
- * A helper function, checks whether a profile node has visible children. |
- * |
- * @param {devtools.profiler.ProfileView.Node} profileNode Profile node. |
- * @return {boolean} Whether a profile node has visible children. |
- */ |
-WebInspector.nodeHasChildren_ = function(profileNode) { |
- var children = profileNode.children; |
- for (var i = 0, n = children.length; i < n; ++i) { |
- if (children[i].visible) { |
- return true; |
+// There is no clear way of setting frame title yet. So sniffing main resource |
+// load. |
+(function OverrideUpdateResource() { |
+ var originalUpdateResource = WebInspector.updateResource; |
+ WebInspector.updateResource = function(identifier, payload) { |
+ originalUpdateResource.call(this, identifier, payload); |
+ var resource = this.resources[identifier]; |
+ if (resource && resource.mainResource && resource.finished) { |
+ document.title = |
+ WebInspector.UIString('Developer Tools - %s', resource.url); |
} |
- } |
- return false; |
-}; |
+ }; |
+})(); |
-/** |
- * Common code for populating a profiler grid node or a tree with |
- * given profile nodes. |
- * |
- * @param {WebInspector.ProfileDataGridNode| |
- * WebInspector.ProfileDataGridTree} viewNode Grid node or a tree. |
- * @param {WebInspector.ProfileView} profileView Profile view. |
- * @param {Array<devtools.profiler.ProfileView.Node>} children Profile nodes. |
- * @param {WebInspector.ProfileDataGridTree} owningTree Grid tree. |
- */ |
-WebInspector.populateNode_ = function( |
- viewNode, profileView, children, owningTree) { |
- for (var i = 0, n = children.length; i < n; ++i) { |
- var child = children[i]; |
- if (child.visible) { |
- viewNode.appendChild( |
- new WebInspector.ProfileDataGridNode( |
- profileView, child, owningTree, |
- WebInspector.nodeHasChildren_(child))); |
+// Highlight extension content scripts in the scripts list. |
+(function () { |
+ var original = WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu; |
+ WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu = function(script) { |
+ var result = original.apply(this, arguments); |
+ var debuggerAgent = devtools.tools.getDebuggerAgent(); |
+ var type = debuggerAgent.getScriptContextType(script.sourceID); |
+ var option = script.filesSelectOption; |
+ if (type == 'injected' && option) { |
+ option.addStyleClass('injected'); |
} |
- } |
-}; |
+ return result; |
+ }; |
+})(); |
-/** |
- * A helper function for building a profile grid tree. |
- * |
- * @param {WebInspector.ProfileView} profileview Profile view. |
- * @param {devtools.profiler.ProfileView} profile Profile. |
- * @return {WebInspector.ProfileDataGridTree} Profile grid tree. |
- */ |
-WebInspector.buildProfileDataGridTree_ = function(profileView, profile) { |
- var children = profile.head.children; |
- var dataGridTree = new WebInspector.ProfileDataGridTree( |
- profileView, profile.head); |
- WebInspector.populateNode_(dataGridTree, profileView, children, dataGridTree); |
- return dataGridTree; |
-}; |
+/** Pending WebKit upstream by apavlov). Fixes iframe vs drag problem. */ |
+(function() { |
+ var originalDragStart = WebInspector.elementDragStart; |
+ WebInspector.elementDragStart = function(element) { |
+ var glassPane = document.createElement("div"); |
+ glassPane.style.cssText = |
+ 'position:absolute;width:100%;height:100%;opacity:0;z-index:1'; |
+ glassPane.id = 'glass-pane-for-drag'; |
+ element.parentElement.appendChild(glassPane); |
+ |
+ originalDragStart.apply(this, arguments); |
+ }; |
+ var originalDragEnd = WebInspector.elementDragEnd; |
+ WebInspector.elementDragEnd = function() { |
+ originalDragEnd.apply(this, arguments); |
-/** |
- * @override |
- */ |
-WebInspector.ProfileDataGridNode.prototype._populate = function(event) { |
- var children = this.profileNode.children; |
- WebInspector.populateNode_(this, this.profileView, children, this.tree); |
- this.removeEventListener("populate", this._populate, this); |
-}; |
+ var glassPane = document.getElementById('glass-pane-for-drag'); |
+ glassPane.parentElement.removeChild(glassPane); |
+ }; |
+})(); |
-// As columns in data grid can't be changed after initialization, |
-// we need to intercept the constructor and modify columns upon creation. |
-(function InterceptDataGridForProfiler() { |
- var originalDataGrid = WebInspector.DataGrid; |
- WebInspector.DataGrid = function(columns) { |
- if (('average' in columns) && ('calls' in columns)) { |
- delete columns['average']; |
- delete columns['calls']; |
- } |
- return new originalDataGrid(columns); |
- }; |
+(function() { |
+ var originalCreatePanels = WebInspector._createPanels; |
+ WebInspector._createPanels = function() { |
+ originalCreatePanels.apply(this, arguments); |
+ this.panels.heap = new WebInspector.HeapProfilerPanel(); |
+ }; |
})(); |
-/** |
- * @override |
- * TODO(pfeldman): Add l10n. |
- */ |
-WebInspector.UIString = function(string) |
+WebInspector.resourceTrackingWasEnabled = function() |
+{ |
+ InspectorController.resourceTrackingEnabled_ = true; |
+ this.panels.resources.resourceTrackingWasEnabled(); |
+} |
+ |
+WebInspector.resourceTrackingWasDisabled = function() |
{ |
- return String.vsprintf(string, Array.prototype.slice.call(arguments, 1)); |
+ InspectorController.resourceTrackingEnabled_ = false; |
+ this.panels.resources.resourceTrackingWasDisabled(); |
} |