diff options
| author | Kristian Monsen <kristianm@google.com> | 2010-07-30 10:46:49 +0100 |
|---|---|---|
| committer | Kristian Monsen <kristianm@google.com> | 2010-08-04 13:01:34 +0100 |
| commit | 0617145a89917ae7735fe1c9538688ab9a577df5 (patch) | |
| tree | 56206078694427c37ed7bdf27eb5221398b833c0 /WebCore/inspector/front-end | |
| parent | ef1adcdfc805d4d13103f6f15cc5b4d96828a60f (diff) | |
| download | external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.zip external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.gz external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.bz2 | |
Merge WebKit at r64264 : Initial merge by git.
Change-Id: Ic42bef02efef8217a0f84c47176a9c617c28d1f1
Diffstat (limited to 'WebCore/inspector/front-end')
| -rw-r--r-- | WebCore/inspector/front-end/ConsoleView.js | 4 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/DOMAgent.js | 1 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/ElementsPanel.js | 2 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/InjectedScript.js | 5 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/InjectedScriptAccess.js | 6 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/InspectorBackendStub.js | 342 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/ResourceView.js | 3 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/ResourcesPanel.js | 165 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/ScriptView.js | 2 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/ScriptsPanel.js | 24 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/Settings.js | 19 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/SourceView.js | 2 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/inspector.css | 16 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/inspector.js | 5 | ||||
| -rw-r--r-- | WebCore/inspector/front-end/utilities.js | 5 |
15 files changed, 263 insertions, 338 deletions
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js index d4119a1..e16c89e 100644 --- a/WebCore/inspector/front-end/ConsoleView.js +++ b/WebCore/inspector/front-end/ConsoleView.js @@ -296,7 +296,7 @@ WebInspector.ConsoleView.prototype = { requestClearMessages: function() { - InspectorBackend.clearConsoleMessages(); + InspectorBackend.clearConsoleMessages(WebInspector.Callback.wrap(this.clearMessages.bind(this))); }, clearMessages: function() @@ -1127,3 +1127,5 @@ WebInspector.ConsoleGroup.prototype = { event.preventDefault(); } } + +WebInspector.didClearConsoleMessages = WebInspector.Callback.processCallback; diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js index 07b16b1..bcbe91e 100644 --- a/WebCore/inspector/front-end/DOMAgent.js +++ b/WebCore/inspector/front-end/DOMAgent.js @@ -698,6 +698,7 @@ WebInspector.didGetEventListenersForNode = WebInspector.Callback.processCallback WebInspector.didGetStyles = WebInspector.Callback.processCallback; WebInspector.didGetAllStyles = WebInspector.Callback.processCallback; WebInspector.didGetStyleSheet = WebInspector.Callback.processCallback; +WebInspector.didGetRuleRanges = WebInspector.Callback.processCallback; WebInspector.didGetInlineStyle = WebInspector.Callback.processCallback; WebInspector.didGetComputedStyle = WebInspector.Callback.processCallback; WebInspector.didApplyStyleText = WebInspector.Callback.processCallback; diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index 48eb4c0..ec9559f 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -222,7 +222,7 @@ WebInspector.ElementsPanel.prototype = { if (this._selectedPathOnReset) { var callId = WebInspector.Callback.wrap(selectLastSelectedNode.bind(this)); - InspectorBackend.pushNodeByPathToFrontend(callId, this._selectedPathOnReset); + InspectorBackend.pushNodeByPathToFrontend(callId, this._selectedPathOnReset.join(",")); } else selectNode.call(this); delete this._selectedPathOnReset; diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index 9e16dad..ce187d2 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -388,7 +388,7 @@ InjectedScript.createProxyObject = function(object, objectId, abbreviate) var type = typeof object; - result.hasChildren = (type === "object" && object !== null && (Object.getOwnPropertyNames(object).length || object.__proto__)) || type === "function"; + result.hasChildren = (type === "object" && object !== null && (Object.getOwnPropertyNames(object).length || !!object.__proto__)) || type === "function"; try { result.description = InjectedScript._describe(object, abbreviate); } catch (e) { @@ -411,6 +411,7 @@ InjectedScript.CallFrameProxy = function(id, callFrame) this.sourceID = callFrame.sourceID; this.line = callFrame.line; this.scopeChain = this._wrapScopeChain(callFrame); + this.injectedScriptId = injectedScriptId; } InjectedScript.CallFrameProxy.prototype = { @@ -544,7 +545,7 @@ InjectedScript._type = function(obj) return "array"; if (obj instanceof inspectedWindow.HTMLCollection) return "array"; - if (inspectedWindow.jQuery && obj instanceof inspectedWindow.jQuery) + if (typeof inspectedWindow.jQuery === "function" && obj instanceof inspectedWindow.jQuery) return "array"; if (obj instanceof inspectedWindow.Error) return "error"; diff --git a/WebCore/inspector/front-end/InjectedScriptAccess.js b/WebCore/inspector/front-end/InjectedScriptAccess.js index 0e4cc2e..5950421 100644 --- a/WebCore/inspector/front-end/InjectedScriptAccess.js +++ b/WebCore/inspector/front-end/InjectedScriptAccess.js @@ -35,7 +35,11 @@ function InjectedScriptAccess(injectedScriptId) { InjectedScriptAccess.get = function(injectedScriptId) { - return new InjectedScriptAccess(injectedScriptId); + if (typeof injectedScriptId === "number") + return new InjectedScriptAccess(injectedScriptId); + + console.error("Access to injected script with no id"); + console.trace(); } InjectedScriptAccess.getDefault = function() diff --git a/WebCore/inspector/front-end/InspectorBackendStub.js b/WebCore/inspector/front-end/InspectorBackendStub.js index 857e026..7cfc8a1 100644 --- a/WebCore/inspector/front-end/InspectorBackendStub.js +++ b/WebCore/inspector/front-end/InspectorBackendStub.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009, 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,270 +28,102 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -if (!window.InspectorBackend) { - WebInspector.InspectorBackendStub = function() { - this._attachedWindowHeight = 0; - this._timelineEnabled = false; + this._registerDelegate("addInspectedNode"); + this._registerDelegate("addScriptToEvaluateOnLoad"); + this._registerDelegate("changeTagName"); + this._registerDelegate("clearConsoleMessages"); + this._registerDelegate("copyNode"); + this._registerDelegate("deleteCookie"); + this._registerDelegate("didEvaluateForTestInFrontend"); + this._registerDelegate("disableMonitoringXHR"); + this._registerDelegate("disableResourceTracking"); + this._registerDelegate("disableSearchingForNode"); + this._registerDelegate("disableTimeline"); + this._registerDelegate("dispatchOnInjectedScript"); + this._registerDelegate("enableMonitoringXHR"); + this._registerDelegate("enableResourceTracking"); + this._registerDelegate("enableSearchingForNode"); + this._registerDelegate("enableTimeline"); + this._registerDelegate("getChildNodes"); + this._registerDelegate("getCookies"); + this._registerDelegate("getDatabaseTableNames"); + this._registerDelegate("getDOMStorageEntries"); + this._registerDelegate("getEventListenersForNode"); + this._registerDelegate("getOuterHTML"); + this._registerDelegate("getProfile"); + this._registerDelegate("getProfileHeaders"); + this._registerDelegate("removeProfile"); + this._registerDelegate("clearProfiles"); + this._registerDelegate("getResourceContent"); + this._registerDelegate("highlightDOMNode"); + this._registerDelegate("hideDOMNodeHighlight"); + this._registerDelegate("performSearch"); + this._registerDelegate("pushNodeByPathToFrontend"); + this._registerDelegate("releaseWrapperObjectGroup"); + this._registerDelegate("removeAllScriptsToEvaluateOnLoad"); + this._registerDelegate("reloadPage"); + this._registerDelegate("removeAttribute"); + this._registerDelegate("removeDOMStorageItem"); + this._registerDelegate("removeNode"); + this._registerDelegate("saveApplicationSettings"); + this._registerDelegate("saveSessionSettings"); + this._registerDelegate("searchCanceled"); + this._registerDelegate("setAttribute"); + this._registerDelegate("setDOMStorageItem"); + this._registerDelegate("setInjectedScriptSource"); + this._registerDelegate("setOuterHTML"); + this._registerDelegate("setTextNodeValue"); + this._registerDelegate("startProfiling"); + this._registerDelegate("startTimelineProfiler"); + this._registerDelegate("stopProfiling"); + this._registerDelegate("stopTimelineProfiler"); + this._registerDelegate("storeLastActivePanel"); + this._registerDelegate("takeHeapSnapshot"); + + this._registerDelegate("getAllStyles"); + this._registerDelegate("getStyles"); + this._registerDelegate("getComputedStyle"); + this._registerDelegate("getInlineStyle"); + this._registerDelegate("getStyleSheet"); + this._registerDelegate("getRuleRanges"); + this._registerDelegate("applyStyleText"); + this._registerDelegate("setStyleText"); + this._registerDelegate("setStyleProperty"); + this._registerDelegate("toggleStyleEnabled"); + this._registerDelegate("setRuleSelector"); + this._registerDelegate("addRule"); + + this._registerDelegate("disableDebugger"); + this._registerDelegate("editScriptSource"); + this._registerDelegate("getScriptSource"); + this._registerDelegate("enableDebugger"); + this._registerDelegate("setBreakpoint"); + this._registerDelegate("removeBreakpoint"); + this._registerDelegate("activateBreakpoints"); + this._registerDelegate("deactivateBreakpoints"); + this._registerDelegate("resume"); + this._registerDelegate("stepIntoStatement"); + this._registerDelegate("stepOutOfFunction"); + this._registerDelegate("stepOverStatement"); + this._registerDelegate("setPauseOnExceptionsState"); } WebInspector.InspectorBackendStub.prototype = { - wrapCallback: function(func) - { - return func; - }, - - closeWindow: function() - { - this._windowVisible = false; - }, - - attach: function() - { - }, - - detach: function() - { - }, - - storeLastActivePanel: function(panel) - { - }, - - clearConsoleMessages: function() - { - }, - - getOuterHTML: function() - { - }, - - setOuterHTML: function() - { - }, - - addInspectedNode: function() - { - }, - - search: function(sourceRow, query) - { - }, - - moveByUnrestricted: function(x, y) - { - }, - - getResourceContent: function(callId, identifier) - { - WebInspector.didGetResourceContent(callId, ""); - }, - - highlightDOMNode: function(node) - { - }, - - hideDOMNodeHighlight: function() - { - }, - - inspectedWindow: function() - { - return window; - }, - - loaded: function() - { - }, - - localizedStringsURL: function() - { - return undefined; - }, - - windowUnloading: function() - { - return false; - }, - - hiddenPanels: function() - { - return ""; - }, - - enableResourceTracking: function() - { - WebInspector.resourceTrackingWasEnabled(); - }, - - disableResourceTracking: function() - { - WebInspector.resourceTrackingWasDisabled(); - }, - - - enableSearchingForNode: function() - { - WebInspector.searchingForNodeWasEnabled(); - }, - - disableSearchingForNode: function() - { - WebInspector.searchingForNodeWasDisabled(); - }, - - enableMonitoringXHR: function() - { - WebInspector.monitoringXHRWasEnabled(); - }, - - disableMonitoringXHR: function() - { - WebInspector.monitoringXHRWasDisabled(); - }, - - reloadPage: function() - { - }, - - enableDebugger: function() - { - WebInspector.debuggerWasEnabled(); - }, - - disableDebugger: function() - { - WebInspector.debuggerWasDisabled(); - }, - - setBreakpoint: function(callId, sourceID, line, enabled, condition) - { - WebInspector.didSetBreakpoint(callId, true, line); - }, - - removeBreakpoint: function(sourceID, line) - { - }, - - activateBreakpoints: function() - { - this._breakpointsActivated = true; - }, - - deactivateBreakpoints: function() - { - this._breakpointsActivated = false; - }, - - pause: function() - { - }, - - setPauseOnExceptionsState: function(value) - { - WebInspector.updatePauseOnExceptionsState(value); - }, - - editScriptSource: function() - { - WebInspector.didEditScriptSource(callId, false); - }, - - getScriptSource: function(callId, sourceID) - { - WebInspector.didGetScriptSource(callId, null); - }, - - resume: function() - { - }, - - enableProfiler: function() - { - WebInspector.profilerWasEnabled(); - }, - - disableProfiler: function() - { - WebInspector.profilerWasDisabled(); - }, - - startProfiling: function() - { - }, - - stopProfiling: function() - { - }, - - getProfileHeaders: function(callId) - { - WebInspector.didGetProfileHeaders(callId, []); - }, - - getProfile: function(callId, uid) - { - }, - - takeHeapSnapshot: function() - { - }, - - databaseTableNames: function(database) - { - return []; - }, - - stepIntoStatement: function() - { - }, - - stepOutOfFunction: function() - { - }, - - stepOverStatement: function() - { - }, - - saveApplicationSettings: function() - { - }, - - saveSessionSettings: function() - { - }, - - dispatchOnInjectedScript: function() + _registerDelegate: function(methodName) { + this[methodName] = this.sendMessageToBackend.bind(this, methodName); }, - releaseWrapperObjectGroup: function() - { - }, - - setInjectedScriptSource: function() - { - }, - - addScriptToEvaluateOnLoad: function() - { - }, - - removeAllScriptsToEvaluateOnLoad: function() - { - }, - - performSearch: function() - { - }, - - searchCanceled: function() + sendMessageToBackend: function() { + var message = JSON.stringify(Array.prototype.slice.call(arguments)); + if (WebInspector._paramsObject && "page" in WebInspector._paramsObject) + WebInspector.socket.send(message); + else + InspectorFrontendHost.sendMessageToBackend(message); } } InspectorBackend = new WebInspector.InspectorBackendStub(); - -} diff --git a/WebCore/inspector/front-end/ResourceView.js b/WebCore/inspector/front-end/ResourceView.js index bfd1576..7ce09b6 100644 --- a/WebCore/inspector/front-end/ResourceView.js +++ b/WebCore/inspector/front-end/ResourceView.js @@ -176,7 +176,8 @@ WebInspector.ResourceView.prototype = { this.tabbedPane.selectTabById("content"); if ("resize" in this) this.resize(); - this.contentTabSelected(); + if (this.hasContentTab()) + this.contentTabSelected(); }, _refreshURL: function() diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js index b02a277..4fda07b 100644 --- a/WebCore/inspector/front-end/ResourcesPanel.js +++ b/WebCore/inspector/front-end/ResourcesPanel.js @@ -82,30 +82,30 @@ WebInspector.ResourcesPanel.prototype = { populateSidebar: function() { - var timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time")); - timeGraphItem.onselect = this._graphSelected.bind(this); + this.timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time")); + this.timeGraphItem.onselect = this._graphSelected.bind(this); var transferTimeCalculator = new WebInspector.ResourceTransferTimeCalculator(); var transferDurationCalculator = new WebInspector.ResourceTransferDurationCalculator(); - timeGraphItem.sortingOptions = [ - { name: WebInspector.UIString("Sort by Start Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime, calculator: transferTimeCalculator }, - { name: WebInspector.UIString("Sort by Response Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime, calculator: transferTimeCalculator }, - { name: WebInspector.UIString("Sort by End Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime, calculator: transferTimeCalculator }, - { name: WebInspector.UIString("Sort by Duration"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration, calculator: transferDurationCalculator }, - { name: WebInspector.UIString("Sort by Latency"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency, calculator: transferDurationCalculator }, + this.timeGraphItem.sortingOptions = [ + { name: WebInspector.UIString("Sort by Start Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime, calculator: transferTimeCalculator, optionName: "startTime" }, + { name: WebInspector.UIString("Sort by Response Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime, calculator: transferTimeCalculator, optionName: "responseTime" }, + { name: WebInspector.UIString("Sort by End Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime, calculator: transferTimeCalculator, optionName: "endTime" }, + { name: WebInspector.UIString("Sort by Duration"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration, calculator: transferDurationCalculator, optionName: "duration" }, + { name: WebInspector.UIString("Sort by Latency"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency, calculator: transferDurationCalculator, optionName: "latency" }, ]; - timeGraphItem.isBarOpaqueAtLeft = false; - timeGraphItem.selectedSortingOptionIndex = 1; + this.timeGraphItem.isBarOpaqueAtLeft = false; + this.timeGraphItem.selectedSortingOptionIndex = 1; this.sizeGraphItem = new WebInspector.SidebarTreeElement("resources-size-graph-sidebar-item", WebInspector.UIString("Size")); this.sizeGraphItem.onselect = this._graphSelected.bind(this); var transferSizeCalculator = new WebInspector.ResourceTransferSizeCalculator(); this.sizeGraphItem.sortingOptions = [ - { name: WebInspector.UIString("Sort by Transfer Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingTransferSize, calculator: transferSizeCalculator }, - { name: WebInspector.UIString("Sort by Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize, calculator: transferSizeCalculator }, + { name: WebInspector.UIString("Sort by Transfer Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingTransferSize, calculator: transferSizeCalculator, optionName: "transferSize" }, + { name: WebInspector.UIString("Sort by Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize, calculator: transferSizeCalculator, optionName: "size" }, ]; this.sizeGraphItem.isBarOpaqueAtLeft = true; @@ -114,7 +114,7 @@ WebInspector.ResourcesPanel.prototype = { this.graphsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("GRAPHS"), {}, true); this.sidebarTree.appendChild(this.graphsTreeElement); - this.graphsTreeElement.appendChild(timeGraphItem); + this.graphsTreeElement.appendChild(this.timeGraphItem); this.graphsTreeElement.appendChild(this.sizeGraphItem); this.graphsTreeElement.expand(); @@ -160,6 +160,32 @@ WebInspector.ResourcesPanel.prototype = { this.largerResourcesButton.toggled = WebInspector.applicationSettings.resourcesLargeRows; if (!WebInspector.applicationSettings.resourcesLargeRows) this._setLargerResources(WebInspector.applicationSettings.resourcesLargeRows); + this._loadSortOptions(); + }, + + _loadSortOptions: function() + { + var newOptions = WebInspector.applicationSettings.resourcesSortOptions; + if (!newOptions) + return; + + this._loadSortOptionForGraph(this.timeGraphItem, newOptions.timeOption || "responseTime"); + this._loadSortOptionForGraph(this.sizeGraphItem, newOptions.sizeOption || "transferSize"); + }, + + _loadSortOptionForGraph: function(graphItem, newOptionName) + { + var sortingOptions = graphItem.sortingOptions; + for (var i = 0; i < sortingOptions.length; ++i) { + if (sortingOptions[i].optionName === newOptionName) { + graphItem.selectedSortingOptionIndex = i; + // Propagate the option change down to the currently selected option. + if (this._lastSelectedGraphTreeElement === graphItem) { + this._lastSelectedGraphTreeElement = null; + this._graphSelected(graphItem); + } + } + } }, get mainResourceLoadTime() @@ -618,11 +644,12 @@ WebInspector.ResourcesPanel.prototype = { option.label = sortingOption.name; option.sortingFunction = sortingOption.sortingFunction; option.calculator = sortingOption.calculator; + option.optionName = sortingOption.optionName; this.sortingSelectElement.appendChild(option); } this.sortingSelectElement.selectedIndex = treeElement.selectedSortingOptionIndex; - this._changeSortingFunction(); + this._doChangeSortingFunction(); this.closeVisibleResource(); this.containerElement.scrollTop = 0; @@ -658,7 +685,21 @@ WebInspector.ResourcesPanel.prototype = { _changeSortingFunction: function() { - var selectedOption = this.sortingSelectElement[this.sortingSelectElement.selectedIndex]; + this._doChangeSortingFunction(); + WebInspector.applicationSettings.resourcesSortOptions = {timeOption: this._selectedOptionNameForGraph(this.timeGraphItem), sizeOption: this._selectedOptionNameForGraph(this.sizeGraphItem)}; + }, + + _selectedOptionNameForGraph: function(graphItem) + { + return graphItem.sortingOptions[graphItem.selectedSortingOptionIndex].optionName; + }, + + _doChangeSortingFunction: function() + { + var selectedIndex = this.sortingSelectElement.selectedIndex; + if (this._lastSelectedGraphTreeElement) + this._lastSelectedGraphTreeElement.selectedSortingOptionIndex = selectedIndex; + var selectedOption = this.sortingSelectElement[selectedIndex]; this.sortingFunction = selectedOption.sortingFunction; this.calculator = this.summaryBar.calculator = selectedOption.calculator; }, @@ -751,61 +792,83 @@ WebInspector.ResourcesPanel.prototype = { { var tableElement = document.createElement("table"); var resource = anchor.parentElement.resource; - var data = []; + var rows = []; - if (resource.timing.proxyDuration !== -1) { - data.push(WebInspector.UIString("Proxy")); - data.push(Number.secondsToString(resource.timing.proxyDuration)); + function addRow(title, start, end, color) + { + var row = {}; + row.title = title; + row.start = start; + row.end = end; + rows.push(row); } - if (resource.timing.dnsDuration !== -1) { - data.push(WebInspector.UIString("DNS Lookup")); - data.push(Number.secondsToString(resource.timing.dnsDuration)); + if (resource.timing.proxyStart !== -1) + addRow(WebInspector.UIString("Proxy"), resource.timing.proxyStart, resource.timing.proxyEnd); + + if (resource.timing.dnsStart !== -1) { + addRow(WebInspector.UIString("DNS Lookup"), resource.timing.dnsStart, resource.timing.dnsEnd); } - if (resource.timing.connectDuration !== -1) { - if (resource.connectionReused) { - data.push(WebInspector.UIString("Blocking")); - data.push(Number.secondsToString(resource.timing.connectDuration)); - } else { - data.push(WebInspector.UIString("Connecting")); + if (resource.timing.connectStart !== -1) { + if (resource.connectionReused) + addRow(WebInspector.UIString("Blocking"), resource.timing.connectStart, resource.timing.connectEnd); + else { + var connectStart = resource.timing.connectStart; // Connection includes DNS, subtract it here. - var connectDuration = resource.timing.connectDuration; - if (resource.timing.dnsDuration !== -1) - connectDuration -= resource.timing.dnsDuration; - data.push(Number.secondsToString(connectDuration)); + if (resource.timing.dnsStart !== -1) + connectStart += resource.timing.dnsEnd - resource.timing.dnsStart; + addRow(WebInspector.UIString("Connecting"), connectStart, resource.timing.connectEnd); } } - if (resource.timing.sslDuration !== -1) { - data.push(WebInspector.UIString("SSL")); - data.push(Number.secondsToString(resource.timing.sslDuration)); - } - - data.push(WebInspector.UIString("Sending")); - data.push(Number.secondsToString(resource.timing.sendDuration)); + if (resource.timing.sslStart !== -1) + addRow(WebInspector.UIString("SSL"), resource.timing.sslStart, resource.timing.sslEnd); - data.push(WebInspector.UIString("Waiting")); - // Waiting includes SSL, subtract it here. - var waitDuration = resource.timing.waitDuration; - if (resource.timing.sslDuration !== -1) - waitDuration -= resource.timing.sslDuration; - data.push(Number.secondsToString(waitDuration)); + var sendStart = resource.timing.sendStart; + if (resource.timing.sslStart !== -1) + sendStart += resource.timing.sslEnd - resource.timing.sslStart; + + addRow(WebInspector.UIString("Sending"), resource.timing.sendStart, resource.timing.sendEnd); + addRow(WebInspector.UIString("Waiting"), resource.timing.sendEnd, resource.timing.receiveHeadersEnd); + addRow(WebInspector.UIString("Receiving"), (resource.responseReceivedTime - resource.timing.requestTime) * 1000, (resource.endTime - resource.timing.requestTime) * 1000); - data.push(WebInspector.UIString("Receiving")); - data.push(Number.secondsToString(resource.endTime - resource.responseReceivedTime)); + const chartWidth = 200; + var total = (resource.endTime - resource.timing.requestTime) * 1000; + var scale = chartWidth / total; - for (var i = 0; i < data.length; i += 2) { + for (var i = 0; i < rows.length; ++i) { var tr = document.createElement("tr"); tableElement.appendChild(tr); var td = document.createElement("td"); - td.textContent = data[i]; + td.textContent = rows[i].title; tr.appendChild(td); td = document.createElement("td"); - td.align = "right"; - td.textContent = data[i + 1]; + td.width = chartWidth + "px"; + + var row = document.createElement("div"); + row.className = "resource-timing-row"; + td.appendChild(row); + + var bar = document.createElement("span"); + bar.className = "resource-timing-bar"; + bar.style.left = scale * rows[i].start + "px"; + bar.style.right = scale * (total - rows[i].end) + "px"; + bar.style.backgroundColor = rows[i].color; + bar.textContent = "\u200B"; // Important for 0-time items to have 0 width. + row.appendChild(bar); + + var title = document.createElement("span"); + title.className = "resource-timing-bar-title"; + if (i >= rows.length - 2) + title.style.right = (scale * (total - rows[i].end) + 3) + "px"; + else + title.style.left = (scale * rows[i].start + 3) + "px"; + title.textContent = Number.millisToString(rows[i].end - rows[i].start); + row.appendChild(title); + tr.appendChild(td); } diff --git a/WebCore/inspector/front-end/ScriptView.js b/WebCore/inspector/front-end/ScriptView.js index c576510..597fd28 100644 --- a/WebCore/inspector/front-end/ScriptView.js +++ b/WebCore/inspector/front-end/ScriptView.js @@ -97,6 +97,8 @@ WebInspector.ScriptView.prototype = { _addBreakpoint: function(line) { WebInspector.breakpointManager.setBreakpoint(this.script.sourceID, this.script.sourceURL, line, true, ""); + if (!WebInspector.panels.scripts.breakpointsActivated) + WebInspector.panels.scripts.toggleBreakpointsClicked(); }, _editLineComplete: function(newBody) diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 7a1a4d5..dff4853 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -104,10 +104,10 @@ WebInspector.ScriptsPanel = function() this.sidebarButtonsElement.appendChild(this.stepOutButton); this.toggleBreakpointsButton = new WebInspector.StatusBarButton("", "toggle-breakpoints"); - this.toggleBreakpointsButton.addEventListener("click", this._toggleBreakpointsClicked.bind(this), false); + this.toggleBreakpointsButton.addEventListener("click", this.toggleBreakpointsClicked.bind(this), false); this.sidebarButtonsElement.appendChild(this.toggleBreakpointsButton.element); // Breakpoints should be activated by default, so emulate a click to toggle on. - this._toggleBreakpointsClicked(); + this.toggleBreakpointsClicked(); this.debuggerStatusElement = document.createElement("div"); this.debuggerStatusElement.id = "scripts-debugger-status"; @@ -164,7 +164,7 @@ WebInspector.ScriptsPanel = function() this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3); this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false); this._pauseOnExceptionButton.state = WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions; - this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions."); + this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions."); this._registerShortcuts(); @@ -219,7 +219,7 @@ WebInspector.ScriptsPanel.prototype = { delete this._attachDebuggerWhenShown; } }, - + hide: function() { if (this.visibleView) @@ -278,7 +278,7 @@ WebInspector.ScriptsPanel.prototype = { // Remove script from the files list. script.filesSelectOption.parentElement.removeChild(script.filesSelectOption); - + // Move breakpoints to the resource's frame. if (script._scriptView) { var sourceFrame = script._scriptView.sourceFrame; @@ -296,9 +296,6 @@ WebInspector.ScriptsPanel.prototype = { { var breakpoint = event.data; - if (!this.breakpointsActivated) - this._toggleBreakpointsClicked(); - var sourceFrame; if (breakpoint.url) { var resource = WebInspector.resourceURLMap[breakpoint.url]; @@ -540,7 +537,7 @@ WebInspector.ScriptsPanel.prototype = { this._showScriptOrResource(scriptOrResource, {line: line, shouldHighlightLine: true}); }, - _scriptOrResourceForURLAndLine: function(url, line) + _scriptOrResourceForURLAndLine: function(url, line) { var scriptWithMatchingUrl = null; for (var sourceID in this._sourceIDMap) { @@ -612,8 +609,7 @@ WebInspector.ScriptsPanel.prototype = { _showScriptOrResource: function(scriptOrResource, options) { // options = {line:, shouldHighlightLine:, fromBackForwardAction:, initialLoad:} - if (!options) - options = {}; + options = options || {}; if (!scriptOrResource) return; @@ -695,7 +691,7 @@ WebInspector.ScriptsPanel.prototype = { return; this._resourceForURLInFilesSelect[script.resource.url] = script.resource; } - + var displayName = script.sourceURL ? WebInspector.displayNameForURL(script.sourceURL) : WebInspector.UIString("(program)"); var select = this.filesSelectElement; @@ -814,7 +810,7 @@ WebInspector.ScriptsPanel.prototype = { this.resize(); }, - + updatePauseOnExceptionsState: function(pauseOnExceptionsState) { if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions) @@ -973,7 +969,7 @@ WebInspector.ScriptsPanel.prototype = { InspectorBackend.stepOutOfFunction(); }, - _toggleBreakpointsClicked: function() + toggleBreakpointsClicked: function() { this.toggleBreakpointsButton.toggled = !this.toggleBreakpointsButton.toggled; if (this.toggleBreakpointsButton.toggled) { diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js index 39c1e1e..22db491 100644 --- a/WebCore/inspector/front-end/Settings.js +++ b/WebCore/inspector/front-end/Settings.js @@ -58,6 +58,7 @@ WebInspector.populateApplicationSettings = function(settingsString) WebInspector.applicationSettings.installSetting("showUserAgentStyles", "show-user-agent-styles", true); WebInspector.applicationSettings.installSetting("resourceViewTab", "resource-view-tab", "content"); WebInspector.applicationSettings.installSetting("consoleHistory", "console-history", []); + WebInspector.applicationSettings.installSetting("resourcesSortOptions", "resources-sort-options", {timeOption: "responseTime", sizeOption: "transferSize"}); WebInspector.applicationSettings.dispatchEventToListeners("loaded"); } @@ -71,38 +72,42 @@ WebInspector.populateSessionSettings = function(settingsString) WebInspector.Settings = function(sessionScope) { this._sessionScope = sessionScope; - this._defaultValues = {}; + this._store = {}; } WebInspector.Settings.prototype = { reset: function() { this._store = {}; + // FIXME: restore default values (bug 42820) this.dispatchEventToListeners("loaded"); }, _load: function(settingsString) { try { - this._store = JSON.parse(settingsString); + var loadedStore = JSON.parse(settingsString); } catch (e) { // May fail; - this._store = {}; + loadedStore = {}; } + if (!loadedStore) + return; + for (var propertyName in loadedStore) + this._store[propertyName] = loadedStore[propertyName]; }, installSetting: function(name, propertyName, defaultValue) { this.__defineGetter__(name, this._get.bind(this, propertyName)); this.__defineSetter__(name, this._set.bind(this, propertyName)); - this._defaultValues[propertyName] = defaultValue; + if (!(propertyName in this._store)) + this._store[propertyName] = defaultValue; }, _get: function(propertyName) { - if (propertyName in this._store) - return this._store[propertyName]; - return this._defaultValues[propertyName]; + return this._store[propertyName]; }, _set: function(propertyName, newValue) diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js index 1bf8194..4d03ecd 100644 --- a/WebCore/inspector/front-end/SourceView.js +++ b/WebCore/inspector/front-end/SourceView.js @@ -128,6 +128,8 @@ WebInspector.SourceView.prototype = { { var sourceID = this._sourceIDForLine(line); WebInspector.breakpointManager.setBreakpoint(sourceID, this.resource.url, line, true, ""); + if (!WebInspector.panels.scripts.breakpointsActivated) + WebInspector.panels.scripts.toggleBreakpointsClicked(); }, _removeBreakpoint: function(breakpoint) diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css index f1ee49f..8c4a2ea 100644 --- a/WebCore/inspector/front-end/inspector.css +++ b/WebCore/inspector/front-end/inspector.css @@ -977,6 +977,22 @@ body.platform-linux .monospace, body.platform-linux .source-code { content: "\A"; } +.resource-timing-row { + position: relative; + height: 12px; +} + +.resource-timing-bar { + position: absolute; + background-color: red; + border-left: 1px solid red; + opacity: 0.4; +} + +.resource-timing-bar-title { + position: absolute; +} + #elements-content { display: block; overflow: auto; diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index 5ec7081..0adf057 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -1129,11 +1129,6 @@ WebInspector.showAuditsPanel = function() this.currentPanel = this.panels.audits; } -WebInspector.clearConsoleMessages = function() -{ - WebInspector.console.clearMessages(); -} - WebInspector.selectDatabase = function(o) { WebInspector.showStoragePanel(); diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js index 6e7c725..d248071 100644 --- a/WebCore/inspector/front-end/utilities.js +++ b/WebCore/inspector/front-end/utilities.js @@ -639,6 +639,11 @@ function parentNode(node) return node.parentNode; } +Number.millisToString = function(ms, formatterFunction, higherResolution) +{ + return Number.secondsToString(ms / 1000, formatterFunction, higherResolution); +} + Number.secondsToString = function(seconds, formatterFunction, higherResolution) { if (!formatterFunction) |
