Browse files

v2 will be compatible with remote devtools protocol

  • Loading branch information...
1 parent 1cedfd4 commit dcd344fbc5f624e263852011a748858f80e23943 @dannycoates dannycoates committed Oct 24, 2010
Showing with 9,531 additions and 3,657 deletions.
  1. +0 −524 front-end/AbstractTimelinePanel.js
  2. +28 −17 front-end/ApplicationCacheItemsView.js
  3. +92 −0 front-end/AuditFormatters.js
  4. +44 −35 front-end/AuditLauncherView.js
  5. +10 −3 front-end/AuditResultView.js
  6. +6 −6 front-end/AuditRules.js
  7. +19 −6 front-end/AuditsPanel.js
  8. +409 −37 front-end/BreakpointManager.js
  9. +266 −70 front-end/BreakpointsSidebarPane.js
  10. +10 −24 front-end/CSSCompletions.js
  11. +7 −7 front-end/CSSStyleModel.js
  12. +11 −1 front-end/CallStackSidebarPane.js
  13. +8 −3 front-end/Callback.js
  14. +80 −65 front-end/ConsoleView.js
  15. +10 −3 front-end/ContextMenu.js
  16. +53 −50 front-end/DOMAgent.js
  17. +3 −9 front-end/DOMStorage.js
  18. +198 −38 front-end/DataGrid.js
  19. +27 −9 front-end/Database.js
  20. +3 −3 front-end/DatabaseQueryView.js
  21. +3 −3 front-end/DatabaseTableView.js
  22. +73 −42 front-end/ElementsPanel.js
  23. +54 −65 front-end/ElementsTreeOutline.js
  24. +15 −11 front-end/EventListenersSidebarPane.js
  25. +469 −0 front-end/ExtensionAPI.js
  26. +111 −0 front-end/ExtensionAuditCategory.js
  27. +46 −0 front-end/ExtensionCommon.js
  28. +82 −0 front-end/ExtensionPanel.js
  29. +8 −33 front-end/{ObjectProxy.js → ExtensionRegistryStub.js}
  30. +454 −0 front-end/ExtensionServer.js
  31. +127 −0 front-end/GoToLineDialog.js
  32. +99 −12 front-end/HAREntry.js
  33. +1,008 −0 front-end/HeapSnapshotView.js
  34. BIN front-end/Images/networkIcon.png
  35. BIN front-end/Images/paneAddButtons.png
  36. +477 −522 front-end/InjectedScript.js
  37. +24 −15 front-end/InjectedScriptAccess.js
  38. +0 −297 front-end/InspectorBackendStub.js
  39. +6 −0 front-end/InspectorBackendStub.qrc
  40. +13 −0 front-end/InspectorFrontendHostStub.js
  41. +3 −3 front-end/MetricsSidebarPane.js
  42. +1,733 −0 front-end/NetworkPanel.js
  43. +9 −7 front-end/ObjectPropertiesSection.js
  44. +12 −16 front-end/Panel.js
  45. +3 −12 front-end/ProfileDataGridTree.js
  46. +2 −3 front-end/ProfileView.js
  47. +39 −29 front-end/ProfilesPanel.js
  48. +1 −1 front-end/PropertiesSection.js
  49. +6 −5 front-end/PropertiesSidebarPane.js
  50. +138 −0 front-end/RemoteObject.js
  51. +26 −10 front-end/Resource.js
  52. +8 −3 front-end/ResourceCategory.js
  53. +20 −4 front-end/ResourceView.js
  54. +610 −74 front-end/ResourcesPanel.js
  55. +2 −2 front-end/ScopeChainSidebarPane.js
  56. +3 −0 front-end/Script.js
  57. +5 −7 front-end/ScriptView.js
  58. +114 −68 front-end/ScriptsPanel.js
  59. +10 −13 front-end/Section.js
  60. +47 −29 front-end/Settings.js
  61. +2 −54 front-end/SourceCSSTokenizer.js
  62. +4 −54 front-end/SourceCSSTokenizer.re2js
  63. +32 −19 front-end/SourceFrame.js
  64. +9 −7 front-end/SourceView.js
  65. +17 −25 front-end/StoragePanel.js
  66. +183 −102 front-end/StylesSidebarPane.js
  67. +1 −1 front-end/TabbedPane.js
  68. +10 −4 front-end/TextViewer.js
  69. +14 −2 front-end/TimelineGrid.js
  70. +2 −2 front-end/TimelineOverviewPane.js
  71. +35 −15 front-end/TimelinePanel.js
  72. +3 −17 front-end/WatchExpressionsSidebarPane.js
  73. +17 −3 front-end/WebKit.qrc
  74. +39 −0 front-end/goToLineDialog.css
  75. +136 −0 front-end/heapProfiler.css
  76. +15 −3 front-end/index.html
  77. +182 −65 front-end/inspector.css
  78. +16 −6 front-end/inspector.html
  79. +270 −193 front-end/inspector.js
  80. +596 −0 front-end/networkPanel.css
  81. +120 −389 front-end/node/InspectorBackendStub.js
  82. +91 −365 front-end/node/InspectorFrontendHostStub.js
  83. +12 −0 front-end/node/Overrides.js
  84. +21 −7 front-end/treeoutline.js
  85. +23 −27 front-end/utilities.js
  86. +26 −0 lib/callback.js
  87. +6 −17 lib/debug-server.js
  88. +505 −84 lib/session.js
View
524 front-end/AbstractTimelinePanel.js
@@ -1,524 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
- * Copyright (C) 2009 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 met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.AbstractTimelinePanel = function(name)
-{
- WebInspector.Panel.call(this, name);
- this._items = [];
- this._staleItems = [];
-}
-
-WebInspector.AbstractTimelinePanel.prototype = {
- get categories()
- {
- // Should be implemented by the concrete subclasses.
- return {};
- },
-
- populateSidebar: function()
- {
- // Should be implemented by the concrete subclasses.
- },
-
- createItemTreeElement: function(item)
- {
- // Should be implemented by the concrete subclasses.
- },
-
- createItemGraph: function(item)
- {
- // Should be implemented by the concrete subclasses.
- },
-
- get items()
- {
- return this._items;
- },
-
- createInterface: function()
- {
- this.containerElement = document.createElement("div");
- this.containerElement.id = "resources-container";
- this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false);
- this.element.appendChild(this.containerElement);
-
- this.createSidebar(this.containerElement, this.element);
- this.sidebarElement.id = "resources-sidebar";
- this.populateSidebar();
-
- this._containerContentElement = document.createElement("div");
- this._containerContentElement.id = "resources-container-content";
- this.containerElement.appendChild(this._containerContentElement);
-
- this.summaryBar = new WebInspector.SummaryBar(this.categories);
- this.summaryBar.element.id = "resources-summary";
- this._containerContentElement.appendChild(this.summaryBar.element);
-
- this._timelineGrid = new WebInspector.TimelineGrid();
- this._containerContentElement.appendChild(this._timelineGrid.element);
- this.itemsGraphsElement = this._timelineGrid.itemsGraphsElement;
- },
-
- createFilterPanel: function()
- {
- this.filterBarElement = document.createElement("div");
- this.filterBarElement.id = "resources-filter";
- this.filterBarElement.className = "scope-bar";
- this.element.appendChild(this.filterBarElement);
-
- function createFilterElement(category)
- {
- if (category === "all")
- var label = WebInspector.UIString("All");
- else if (this.categories[category])
- var label = this.categories[category].title;
-
- var categoryElement = document.createElement("li");
- categoryElement.category = category;
- categoryElement.addStyleClass(category);
- categoryElement.appendChild(document.createTextNode(label));
- categoryElement.addEventListener("click", this._updateFilter.bind(this), false);
- this.filterBarElement.appendChild(categoryElement);
-
- return categoryElement;
- }
-
- this.filterAllElement = createFilterElement.call(this, "all");
-
- // Add a divider
- var dividerElement = document.createElement("div");
- dividerElement.addStyleClass("divider");
- this.filterBarElement.appendChild(dividerElement);
-
- for (var category in this.categories)
- createFilterElement.call(this, category);
- },
-
- showCategory: function(category)
- {
- var filterClass = "filter-" + category.toLowerCase();
- this.itemsGraphsElement.addStyleClass(filterClass);
- this.itemsTreeElement.childrenListElement.addStyleClass(filterClass);
- },
-
- hideCategory: function(category)
- {
- var filterClass = "filter-" + category.toLowerCase();
- this.itemsGraphsElement.removeStyleClass(filterClass);
- this.itemsTreeElement.childrenListElement.removeStyleClass(filterClass);
- },
-
- filter: function(target, selectMultiple)
- {
- function unselectAll()
- {
- for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) {
- var child = this.filterBarElement.childNodes[i];
- if (!child.category)
- continue;
-
- child.removeStyleClass("selected");
- this.hideCategory(child.category);
- }
- }
-
- if (target === this.filterAllElement) {
- if (target.hasStyleClass("selected")) {
- // We can't unselect All, so we break early here
- return;
- }
-
- // If All wasn't selected, and now is, unselect everything else.
- unselectAll.call(this);
- } else {
- // Something other than All is being selected, so we want to unselect All.
- if (this.filterAllElement.hasStyleClass("selected")) {
- this.filterAllElement.removeStyleClass("selected");
- this.hideCategory("all");
- }
- }
-
- if (!selectMultiple) {
- // If multiple selection is off, we want to unselect everything else
- // and just select ourselves.
- unselectAll.call(this);
-
- target.addStyleClass("selected");
- this.showCategory(target.category);
- return;
- }
-
- if (target.hasStyleClass("selected")) {
- // If selectMultiple is turned on, and we were selected, we just
- // want to unselect ourselves.
- target.removeStyleClass("selected");
- this.hideCategory(target.category);
- } else {
- // If selectMultiple is turned on, and we weren't selected, we just
- // want to select ourselves.
- target.addStyleClass("selected");
- this.showCategory(target.category);
- }
- },
-
- _updateFilter: function(e)
- {
- var isMac = WebInspector.isMac();
- var selectMultiple = false;
- if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey)
- selectMultiple = true;
- if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey)
- selectMultiple = true;
-
- this.filter(e.target, selectMultiple);
-
- // When we are updating our filtering, scroll to the top so we don't end up
- // in blank graph under all the resources.
- this.containerElement.scrollTop = 0;
- },
-
- updateGraphDividersIfNeeded: function(force)
- {
- if (!this.visible) {
- this.needsRefresh = true;
- return false;
- }
- return this._timelineGrid.updateDividers(force, this.calculator);
- },
-
- _updateDividersLabelBarPosition: function()
- {
- const scrollTop = this.containerElement.scrollTop;
- const offsetHeight = this.summaryBar.element.offsetHeight;
- const dividersTop = (scrollTop < offsetHeight ? offsetHeight : scrollTop);
- this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop);
- },
-
- get needsRefresh()
- {
- return this._needsRefresh;
- },
-
- set needsRefresh(x)
- {
- if (this._needsRefresh === x)
- return;
-
- this._needsRefresh = x;
-
- if (x) {
- if (this.visible && !("_refreshTimeout" in this))
- this._refreshTimeout = setTimeout(this.refresh.bind(this), 500);
- } else {
- if ("_refreshTimeout" in this) {
- clearTimeout(this._refreshTimeout);
- delete this._refreshTimeout;
- }
- }
- },
-
- refreshIfNeeded: function()
- {
- if (this.needsRefresh)
- this.refresh();
- },
-
- show: function()
- {
- WebInspector.Panel.prototype.show.call(this);
-
- this._updateDividersLabelBarPosition();
- this.refreshIfNeeded();
- },
-
- resize: function()
- {
- WebInspector.Panel.prototype.resize.call(this);
-
- this.updateGraphDividersIfNeeded();
- },
-
- updateMainViewWidth: function(width)
- {
- this._containerContentElement.style.left = width + "px";
- this.resize();
- },
-
- invalidateAllItems: function()
- {
- this._staleItems = this._items.slice();
- },
-
- refresh: function()
- {
- this.needsRefresh = false;
-
- var staleItemsLength = this._staleItems.length;
-
- var boundariesChanged = false;
-
- for (var i = 0; i < staleItemsLength; ++i) {
- var item = this._staleItems[i];
- if (!item._itemsTreeElement) {
- // Create the timeline tree element and graph.
- item._itemsTreeElement = this.createItemTreeElement(item);
- item._itemsTreeElement._itemGraph = this.createItemGraph(item);
-
- this.itemsTreeElement.appendChild(item._itemsTreeElement);
- this.itemsGraphsElement.appendChild(item._itemsTreeElement._itemGraph.graphElement);
- }
-
- if (item._itemsTreeElement.refresh)
- item._itemsTreeElement.refresh();
-
- if (this.calculator.updateBoundaries(item))
- boundariesChanged = true;
- }
-
- if (boundariesChanged) {
- // The boundaries changed, so all item graphs are stale.
- this._staleItems = this._items.slice();
- staleItemsLength = this._staleItems.length;
- }
-
-
- const isBarOpaqueAtLeft = this.sidebarTree.selectedTreeElement && this.sidebarTree.selectedTreeElement.isBarOpaqueAtLeft;
- for (var i = 0; i < staleItemsLength; ++i)
- this._staleItems[i]._itemsTreeElement._itemGraph.refresh(this.calculator, isBarOpaqueAtLeft);
-
- this._staleItems = [];
-
- this.updateGraphDividersIfNeeded();
- },
-
- reset: function()
- {
- this.containerElement.scrollTop = 0;
-
- if (this._calculator)
- this._calculator.reset();
-
- if (this._items) {
- var itemsLength = this._items.length;
- for (var i = 0; i < itemsLength; ++i) {
- var item = this._items[i];
- delete item._itemsTreeElement;
- }
- }
-
- this._items = [];
- this._staleItems = [];
-
- this.itemsTreeElement.removeChildren();
- this.itemsGraphsElement.removeChildren();
-
- this.updateGraphDividersIfNeeded(true);
- },
-
- get calculator()
- {
- return this._calculator;
- },
-
- set calculator(x)
- {
- if (!x || this._calculator === x)
- return;
-
- this._calculator = x;
- this._calculator.reset();
-
- this._staleItems = this._items.slice();
- this.refresh();
- },
-
- addItem: function(item)
- {
- this._items.push(item);
- this.refreshItem(item);
- },
-
- removeItem: function(item)
- {
- this._items.remove(item, true);
-
- if (item._itemsTreeElement) {
- this.itemsTreeElement.removeChild(item._itemsTreeElement);
- this.itemsGraphsElement.removeChild(item._itemsTreeElement._itemGraph.graphElement);
- }
-
- delete item._itemsTreeElement;
- this.adjustScrollPosition();
- },
-
- refreshItem: function(item)
- {
- this._staleItems.push(item);
- this.needsRefresh = true;
- },
-
- revealAndSelectItem: function(item)
- {
- if (item._itemsTreeElement) {
- item._itemsTreeElement.reveal();
- item._itemsTreeElement.select(true);
- }
- },
-
- sortItems: function(sortingFunction)
- {
- var sortedElements = [].concat(this.itemsTreeElement.children);
- sortedElements.sort(sortingFunction);
-
- var sortedElementsLength = sortedElements.length;
- for (var i = 0; i < sortedElementsLength; ++i) {
- var treeElement = sortedElements[i];
- if (treeElement === this.itemsTreeElement.children[i])
- continue;
-
- var wasSelected = treeElement.selected;
- this.itemsTreeElement.removeChild(treeElement);
- this.itemsTreeElement.insertChild(treeElement, i);
- if (wasSelected)
- treeElement.select(true);
-
- var graphElement = treeElement._itemGraph.graphElement;
- this.itemsGraphsElement.insertBefore(graphElement, this.itemsGraphsElement.children[i]);
- }
- },
-
- adjustScrollPosition: function()
- {
- // Prevent the container from being scrolled off the end.
- if ((this.containerElement.scrollTop + this.containerElement.offsetHeight) > this.sidebarElement.offsetHeight)
- this.containerElement.scrollTop = (this.sidebarElement.offsetHeight - this.containerElement.offsetHeight);
- },
-
- addEventDivider: function(divider)
- {
- this._timelineGrid.addEventDivider(divider);
- },
-
- hideEventDividers: function()
- {
- this._timelineGrid.hideEventDividers();
- },
-
- showEventDividers: function()
- {
- this._timelineGrid.showEventDividers();
- }
-}
-
-WebInspector.AbstractTimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype;
-
-WebInspector.AbstractTimelineCalculator = function()
-{
-}
-
-WebInspector.AbstractTimelineCalculator.prototype = {
- computeSummaryValues: function(items)
- {
- var total = 0;
- var categoryValues = {};
-
- var itemsLength = items.length;
- for (var i = 0; i < itemsLength; ++i) {
- var item = items[i];
- var value = this._value(item);
- if (typeof value === "undefined")
- continue;
- if (!(item.category.name in categoryValues))
- categoryValues[item.category.name] = 0;
- categoryValues[item.category.name] += value;
- total += value;
- }
-
- return {categoryValues: categoryValues, total: total};
- },
-
- computeBarGraphPercentages: function(item)
- {
- return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100};
- },
-
- computeBarGraphLabels: function(item)
- {
- const label = this.formatValue(this._value(item));
- return {left: label, right: label, tooltip: label};
- },
-
- get boundarySpan()
- {
- return this.maximumBoundary - this.minimumBoundary;
- },
-
- updateBoundaries: function(item)
- {
- this.minimumBoundary = 0;
-
- var value = this._value(item);
- if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) {
- this.maximumBoundary = value;
- return true;
- }
- return false;
- },
-
- reset: function()
- {
- delete this.minimumBoundary;
- delete this.maximumBoundary;
- },
-
- _value: function(item)
- {
- return 0;
- },
-
- formatValue: function(value)
- {
- return value.toString();
- }
-}
-
-WebInspector.AbstractTimelineCategory = function(name, title, color)
-{
- this.name = name;
- this.title = title;
- this.color = color;
-}
-
-WebInspector.AbstractTimelineCategory.prototype = {
- toString: function()
- {
- return this.title;
- }
-}
View
45 front-end/ApplicationCacheItemsView.js
@@ -41,12 +41,14 @@ WebInspector.ApplicationCacheItemsView = function(treeElement, appcacheDomain)
this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
- this.connectivityIcon = document.createElement("img");
- this.connectivityIcon.className = "storage-application-cache-connectivity-icon";
- this.connectivityIcon.src = "";
- this.connectivityMessage = document.createElement("span");
- this.connectivityMessage.className = "storage-application-cache-connectivity";
- this.connectivityMessage.textContent = "";
+ if (Preferences.onlineDetectionEnabled) {
+ this.connectivityIcon = document.createElement("img");
+ this.connectivityIcon.className = "storage-application-cache-connectivity-icon";
+ this.connectivityIcon.src = "";
+ this.connectivityMessage = document.createElement("span");
+ this.connectivityMessage.className = "storage-application-cache-connectivity";
+ this.connectivityMessage.textContent = "";
+ }
this.divider = document.createElement("span");
this.divider.className = "status-bar-item status-bar-divider";
@@ -72,11 +74,18 @@ WebInspector.ApplicationCacheItemsView = function(treeElement, appcacheDomain)
WebInspector.ApplicationCacheItemsView.prototype = {
get statusBarItems()
{
- return [
- this.refreshButton.element, this.deleteButton.element,
- this.connectivityIcon, this.connectivityMessage, this.divider,
- this.statusIcon, this.statusMessage
- ];
+ if (Preferences.onlineDetectionEnabled) {
+ return [
+ this.refreshButton.element, this.deleteButton.element,
+ this.connectivityIcon, this.connectivityMessage, this.divider,
+ this.statusIcon, this.statusMessage
+ ];
+ } else {
+ return [
+ this.refreshButton.element, this.deleteButton.element, this.divider,
+ this.statusIcon, this.statusMessage
+ ];
+ }
},
show: function(parentElement)
@@ -114,12 +123,14 @@ WebInspector.ApplicationCacheItemsView.prototype = {
updateNetworkState: function(isNowOnline)
{
- if (isNowOnline) {
- this.connectivityIcon.src = "Images/successGreenDot.png";
- this.connectivityMessage.textContent = WebInspector.UIString("Online");
- } else {
- this.connectivityIcon.src = "Images/errorRedDot.png";
- this.connectivityMessage.textContent = WebInspector.UIString("Offline");
+ if (Preferences.onlineDetectionEnabled) {
+ if (isNowOnline) {
+ this.connectivityIcon.src = "Images/successGreenDot.png";
+ this.connectivityMessage.textContent = WebInspector.UIString("Online");
+ } else {
+ this.connectivityIcon.src = "Images/errorRedDot.png";
+ this.connectivityMessage.textContent = WebInspector.UIString("Offline");
+ }
}
},
View
92 front-end/AuditFormatters.js
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 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
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.applyFormatters = function(value)
+{
+ var formatter;
+ var type = typeof value;
+ var args;
+
+ switch (type) {
+ case "string":
+ case "boolean":
+ case "number":
+ formatter = WebInspector.AuditFormatters.text;
+ args = [ value.toString() ];
+ break;
+
+ case "object":
+ if (value instanceof Array) {
+ formatter = WebInspector.AuditFormatters.concat;
+ args = value;
+ } else if (value.type && value.arguments) {
+ formatter = WebInspector.AuditFormatters[value.type];
+ args = value.arguments;
+ }
+ }
+ if (!formatter)
+ throw "Invalid value or formatter: " + type + JSON.stringify(value);
+
+ return formatter.apply(null, args);
+}
+
+WebInspector.AuditFormatters = {
+ text: function(text)
+ {
+ return document.createTextNode(text);
+ },
+
+ snippet: function(snippetText)
+ {
+ var div = document.createElement("div");
+ div.innerText = snippetText;
+ div.className = "source-code";
+ return div;
+ },
+
+ concat: function()
+ {
+ var parent = document.createElement("span");
+ for (var arg = 0; arg < arguments.length; ++arg)
+ parent.appendChild(WebInspector.applyFormatters(arguments[arg]));
+ return parent;
+ },
+
+ url: function(url, displayText, allowExternalNavigation)
+ {
+ var a = document.createElement("a");
+ a.href = url;
+ a.title = url;
+ a.textContent = displayText || url;
+ if (allowExternalNavigation)
+ a.target = "_blank";
+ return a;
+ }
+};
View
79 front-end/AuditLauncherView.js
@@ -28,10 +28,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.AuditLauncherView = function(categoriesById, runnerCallback)
+WebInspector.AuditLauncherView = function(runnerCallback)
{
WebInspector.View.call(this);
- this._categoriesById = categoriesById;
this._runnerCallback = runnerCallback;
this._categoryIdPrefix = "audit-category-item-";
this._auditRunning = false;
@@ -41,27 +40,16 @@ WebInspector.AuditLauncherView = function(categoriesById, runnerCallback)
this._contentElement = document.createElement("div");
this._contentElement.className = "audit-launcher-view-content";
this.element.appendChild(this._contentElement);
+ this._boundCategoryClickListener = this._categoryClicked.bind(this);
this._resetResourceCount();
- function categorySortFunction(a, b)
- {
- var aTitle = a.displayName || "";
- var bTitle = b.displayName || "";
- return aTitle.localeCompare(bTitle);
- }
- var sortedCategories = [];
- for (var id in this._categoriesById)
- sortedCategories.push(this._categoriesById[id]);
- sortedCategories.sort(categorySortFunction);
+ this._sortedCategories = [];
- if (!sortedCategories.length) {
- this._headerElement = document.createElement("h1");
- this._headerElement.className = "no-audits";
- this._headerElement.textContent = WebInspector.UIString("No audits to run");
- this._contentElement.appendChild(this._headerElement);
- } else
- this._createLauncherUI(sortedCategories);
+ this._headerElement = document.createElement("h1");
+ this._headerElement.className = "no-audits";
+ this._headerElement.textContent = WebInspector.UIString("No audits to run");
+ this._contentElement.appendChild(this._headerElement);
}
WebInspector.AuditLauncherView.prototype = {
@@ -133,6 +121,30 @@ WebInspector.AuditLauncherView.prototype = {
this._resetResourceCount();
},
+ addCategory: function(category)
+ {
+ if (!this._sortedCategories.length)
+ this._createLauncherUI();
+
+ var categoryElement = this._createCategoryElement(category.displayName, category.id);
+ category._checkboxElement = categoryElement.firstChild;
+ if (this._selectAllCheckboxElement.checked) {
+ category._checkboxElement.checked = true;
+ ++this._currentCategoriesCount;
+ }
+
+ function compareCategories(a, b)
+ {
+ var aTitle = a.displayName || "";
+ var bTitle = b.displayName || "";
+ return aTitle.localeCompare(bTitle);
+ }
+ var insertBefore = insertionIndexForObjectInListSortedByFunction(category, this._sortedCategories, compareCategories);
+ this._categoriesElement.insertBefore(categoryElement, this._categoriesElement.children[insertBefore]);
+ this._sortedCategories.splice(insertBefore, 0, category);
+ this._updateButton();
+ },
+
_setAuditRunning: function(auditRunning)
{
if (this._auditRunning === auditRunning)
@@ -146,10 +158,11 @@ WebInspector.AuditLauncherView.prototype = {
{
var catIds = [];
var childNodes = this._categoriesElement.childNodes;
- for (var id in this._categoriesById) {
- if (this._categoriesById[id]._checkboxElement.checked)
- catIds.push(id);
+ for (var category = 0; category < this._sortedCategories.length; ++category) {
+ if (this._sortedCategories[category]._checkboxElement.checked)
+ catIds.push(this._sortedCategories[category].id);
}
+
this._setAuditRunning(true);
this._runnerCallback(catIds, this._auditPresentStateElement.checked, this._setAuditRunning.bind(this, false));
},
@@ -159,14 +172,14 @@ WebInspector.AuditLauncherView.prototype = {
var childNodes = this._categoriesElement.childNodes;
for (var i = 0, length = childNodes.length; i < length; ++i)
childNodes[i].firstChild.checked = checkCategories;
- this._currentCategoriesCount = checkCategories ? this._totalCategoriesCount : 0;
+ this._currentCategoriesCount = checkCategories ? this._sortedCategories.length : 0;
this._updateButton();
},
_categoryClicked: function(event)
{
this._currentCategoriesCount += event.target.checked ? 1 : -1;
- this._selectAllCheckboxElement.checked = this._currentCategoriesCount === this._totalCategoriesCount;
+ this._selectAllCheckboxElement.checked = this._currentCategoriesCount === this._sortedCategories.length;
this._updateButton();
},
@@ -177,16 +190,22 @@ WebInspector.AuditLauncherView.prototype = {
var element = document.createElement("input");
element.type = "checkbox";
+ if (id !== "")
+ element.addEventListener("click", this._boundCategoryClickListener, false);
labelElement.appendChild(element);
labelElement.appendChild(document.createTextNode(title));
return labelElement;
},
- _createLauncherUI: function(sortedCategories)
+ _createLauncherUI: function()
{
this._headerElement = document.createElement("h1");
this._headerElement.textContent = WebInspector.UIString("Select audits to run");
+
+ for (var child = 0; child < this._contentElement.children.length; ++child)
+ this._contentElement.removeChild(this._contentElement.children[child]);
+
this._contentElement.appendChild(this._headerElement);
function handleSelectAllClick(event)
@@ -204,16 +223,6 @@ WebInspector.AuditLauncherView.prototype = {
this._categoriesElement.className = "audit-categories-container";
this._contentElement.appendChild(this._categoriesElement);
- var boundCategoryClickListener = this._categoryClicked.bind(this);
-
- for (var i = 0; i < sortedCategories.length; ++i) {
- categoryElement = this._createCategoryElement(sortedCategories[i].displayName, sortedCategories[i].id);
- categoryElement.firstChild.addEventListener("click", boundCategoryClickListener, false);
- sortedCategories[i]._checkboxElement = categoryElement.firstChild;
- this._categoriesElement.appendChild(categoryElement);
- }
-
- this._totalCategoriesCount = this._categoriesElement.childNodes.length;
this._currentCategoriesCount = 0;
var flexibleSpaceElement = document.createElement("div");
View
13 front-end/AuditResultView.js
@@ -81,15 +81,22 @@ WebInspector.AuditCategoryResultPane = function(categoryResult)
WebInspector.AuditCategoryResultPane.prototype = {
_appendResult: function(parentTreeElement, result)
{
- var title = result.value;
- if (result.violationCount)
- title = String.sprintf("%s (%d)", title, result.violationCount);
+ var title = "";
+
+ if (typeof result.value === "string") {
+ title = result.value;
+ if (result.violationCount)
+ title = String.sprintf("%s (%d)", title, result.violationCount);
+ }
var treeElement = new TreeElement(title, null, !!result.children);
parentTreeElement.appendChild(treeElement);
if (result.className)
treeElement.listItemElement.addStyleClass(result.className);
+ if (typeof result.value !== "string")
+ treeElement.listItemElement.appendChild(WebInspector.applyFormatters(result.value));
+
if (result.children) {
for (var i = 0; i < result.children.length; ++i)
this._appendResult(treeElement, result.children[i]);
View
12 front-end/AuditRules.js
@@ -371,7 +371,7 @@ WebInspector.AuditRules.UnusedCssRule.prototype = {
return routineResult;
}
- InspectorBackend.getAllStyles(WebInspector.Callback.wrap(evalCallback));
+ InspectorBackend.getAllStyles(evalCallback);
}
}
@@ -693,7 +693,7 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = {
return callback(null);
var context = {imagesLeft: imageIds.length, urlToNoDimensionCount: {}};
for (var i = imageIds.length - 1; i >= 0; --i)
- InspectorBackend.getStyles(WebInspector.Callback.wrap(imageStylesReady.bind(this, imageIds[i], context)), imageIds[i], true);
+ InspectorBackend.getStyles(imageIds[i], true, imageStylesReady.bind(this, imageIds[i], context));
}
function pushImageNodes()
@@ -724,9 +724,9 @@ WebInspector.AuditRules.CssInHeadRule = function()
WebInspector.AuditRules.CssInHeadRule.prototype = {
doRun: function(resources, result, callback)
{
- function evalCallback(evalResult, isException)
+ function evalCallback(evalResult)
{
- if (isException || !evalResult)
+ if (!evalResult)
return callback(null);
var summary = result.addChild("");
@@ -800,9 +800,9 @@ WebInspector.AuditRules.StylesScriptsOrderRule = function()
WebInspector.AuditRules.StylesScriptsOrderRule.prototype = {
doRun: function(resources, result, callback)
{
- function evalCallback(resultValue, isException)
+ function evalCallback(resultValue)
{
- if (isException || !resultValue)
+ if (!resultValue)
return callback(null);
var lateCssUrls = resultValue[0];
View
25 front-end/AuditsPanel.js
@@ -32,8 +32,6 @@ WebInspector.AuditsPanel = function()
{
WebInspector.Panel.call(this, "audits");
- this._constructCategories();
-
this.createSidebar();
this.auditsTreeElement = new WebInspector.SidebarSectionTreeElement("", {}, true);
this.sidebarTree.appendChild(this.auditsTreeElement);
@@ -54,7 +52,11 @@ WebInspector.AuditsPanel = function()
this.viewsContainerElement.id = "audit-views";
this.element.appendChild(this.viewsContainerElement);
- this._launcherView = new WebInspector.AuditLauncherView(this.categoriesById, this.initiateAudit.bind(this));
+ this._constructCategories();
+
+ this._launcherView = new WebInspector.AuditLauncherView(this.initiateAudit.bind(this));
+ for (id in this.categoriesById)
+ this._launcherView.addCategory(this.categoriesById[id]);
}
WebInspector.AuditsPanel.prototype = {
@@ -104,6 +106,17 @@ WebInspector.AuditsPanel.prototype = {
this._launcherView.resourceFinished(resource);
},
+ addCategory: function(category)
+ {
+ this.categoriesById[category.id] = category;
+ this._launcherView.addCategory(category);
+ },
+
+ getCategory: function(id)
+ {
+ return this.categoriesById[id];
+ },
+
_constructCategories: function()
{
this._auditCategoriesById = {};
@@ -147,7 +160,7 @@ WebInspector.AuditsPanel.prototype = {
var category = categories[i];
var result = new WebInspector.AuditCategoryResult(category);
results.push(result);
- category.runRules(resources, ruleResultReadyCallback.bind(null, result));
+ category.run(resources, ruleResultReadyCallback.bind(null, result));
}
},
@@ -220,7 +233,7 @@ WebInspector.AuditsPanel.prototype = {
{
this.visibleView = this._launcherView;
},
-
+
get visibleView()
{
return this._visibleView;
@@ -311,7 +324,7 @@ WebInspector.AuditCategory.prototype = {
this._rules.push(rule);
},
- runRules: function(resources, callback)
+ run: function(resources, callback)
{
this._ensureInitialized();
for (var i = 0; i < this._rules.length; ++i)
View
446 front-end/BreakpointManager.js
@@ -27,6 +27,8 @@
WebInspector.BreakpointManager = function()
{
this._breakpoints = {};
+ this._nativeBreakpoints = {};
+ this._domBreakpoints = {};
}
WebInspector.BreakpointManager.prototype = {
@@ -50,22 +52,16 @@ WebInspector.BreakpointManager.prototype = {
}
},
- setBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
+ setBreakpoint: function(sourceID, url, line, enabled, condition)
{
- var breakpoint = this._setBreakpoint(sourceID, sourceURL, line, enabled, condition);
+ var breakpoint = this._setBreakpoint(sourceID, url, line, enabled, condition);
if (breakpoint)
this._setBreakpointOnBackend(breakpoint);
},
- restoredBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
+ restoredBreakpoint: function(sourceID, url, line, enabled, condition)
{
- this._setBreakpoint(sourceID, sourceURL, line, enabled, condition);
- },
-
- removeBreakpoint: function(breakpoint)
- {
- if (this._removeBreakpoint(breakpoint))
- InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line);
+ this._setBreakpoint(sourceID, url, line, enabled, condition);
},
breakpointsForSourceID: function(sourceID)
@@ -92,29 +88,25 @@ WebInspector.BreakpointManager.prototype = {
{
this._breakpoints = {};
delete this._oneTimeBreakpoint;
+ this._nativeBreakpoints = {};
},
- _setBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
+ _setBreakpoint: function(sourceID, url, line, enabled, condition)
{
- var breakpoint = new WebInspector.Breakpoint(this, sourceID, sourceURL, line, enabled, condition);
+ var breakpoint = new WebInspector.Breakpoint(this, sourceID, url, line, enabled, condition);
if (this._breakpoints[breakpoint.id])
return;
if (this._oneTimeBreakpoint && (this._oneTimeBreakpoint.id == breakpoint.id))
delete this._oneTimeBreakpoint;
this._breakpoints[breakpoint.id] = breakpoint;
+ breakpoint.addEventListener("removed", this._breakpointRemoved, this);
this.dispatchEventToListeners("breakpoint-added", breakpoint);
return breakpoint;
},
- _removeBreakpoint: function(breakpoint)
+ _breakpointRemoved: function(event)
{
- if (!(breakpoint.id in this._breakpoints))
- return false;
- breakpoint.removeAllListeners();
- delete breakpoint._breakpointManager;
- delete this._breakpoints[breakpoint.id];
- this.dispatchEventToListeners("breakpoint-removed", breakpoint);
- return true;
+ delete this._breakpoints[event.target.id];
},
_setBreakpointOnBackend: function(breakpoint, isOneTime)
@@ -129,21 +121,160 @@ WebInspector.BreakpointManager.prototype = {
else
delete this._oneTimeBreakpoint;
} else {
- this._removeBreakpoint(breakpoint);
+ breakpoint.remove();
if (success)
- this._setBreakpoint(breakpoint.sourceID, breakpoint.sourceURL, line, breakpoint.enabled, breakpoint.condition);
+ this._setBreakpoint(breakpoint.sourceID, breakpoint.url, line, breakpoint.enabled, breakpoint.condition);
}
}
- var callbackId = WebInspector.Callback.wrap(didSetBreakpoint.bind(this));
- InspectorBackend.setBreakpoint(callbackId, breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition);
+ InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition, didSetBreakpoint.bind(this));
+ },
+
+ createDOMBreakpoint: function(nodeId, domEventType, disabled)
+ {
+ var frontendId = "dom:" + nodeId + ":" + domEventType;
+ if (frontendId in this._nativeBreakpoints)
+ return;
+
+ var breakpoint = new WebInspector.DOMBreakpoint(this, frontendId, nodeId, domEventType);
+ this._nativeBreakpoints[frontendId] = breakpoint;
+ this._domBreakpoints[frontendId] = breakpoint;
+ this.dispatchEventToListeners("dom-breakpoint-added", breakpoint);
+ breakpoint.enabled = !disabled;
+ return breakpoint;
+ },
+
+ createEventListenerBreakpoint: function(eventName, disabled)
+ {
+ var frontendId = eventName;
+ if (frontendId in this._nativeBreakpoints)
+ return;
+
+ var breakpoint = new WebInspector.EventListenerBreakpoint(this, frontendId, eventName);
+ this._nativeBreakpoints[frontendId] = breakpoint;
+ breakpoint.enabled = !disabled;
+ return breakpoint;
+ },
+
+ createXHRBreakpoint: function(url, disabled)
+ {
+ var frontendId = url;
+ if (frontendId in this._nativeBreakpoints)
+ return;
+
+ var breakpoint = new WebInspector.XHRBreakpoint(this, frontendId, url);
+ this._nativeBreakpoints[frontendId] = breakpoint;
+ this.dispatchEventToListeners("xhr-breakpoint-added", breakpoint);
+ breakpoint.enabled = !disabled
+ return breakpoint;
+ },
+
+ _removeNativeBreakpoint: function(breakpoint)
+ {
+ if (breakpoint._beingSetOnBackend)
+ return;
+ if (breakpoint.enabled)
+ this._removeNativeBreakpointFromBackend(breakpoint);
+ delete this._nativeBreakpoints[breakpoint._frontendId];
+ if (breakpoint._type === "DOM")
+ delete this._domBreakpoints[breakpoint._frontendId];
+ breakpoint.dispatchEventToListeners("removed");
+ },
+
+ _setNativeBreakpointEnabled: function(breakpoint, enabled)
+ {
+ if (breakpoint._beingSetOnBackend)
+ return;
+ if (breakpoint.enabled === enabled)
+ return;
+ if (enabled)
+ this._setNativeBreakpointOnBackend(breakpoint);
+ else
+ this._removeNativeBreakpointFromBackend(breakpoint);
+ },
+
+ _setNativeBreakpointOnBackend: function(breakpoint)
+ {
+ breakpoint._beingSetOnBackend = true;
+ var data = { type: breakpoint._type, condition: breakpoint._condition() };
+ InspectorBackend.setNativeBreakpoint(data, didSetNativeBreakpoint.bind(this));
+
+ function didSetNativeBreakpoint(backendBreakpointId)
+ {
+ breakpoint._beingSetOnBackend = false;
+ if (backendBreakpointId !== "") {
+ breakpoint._backendId = backendBreakpointId;
+ this._breakpoints[backendBreakpointId] = breakpoint;
+ }
+ breakpoint.dispatchEventToListeners("enable-changed");
+ }
+ },
+
+ _removeNativeBreakpointFromBackend: function(breakpoint)
+ {
+ InspectorBackend.removeNativeBreakpoint(breakpoint._backendId);
+ delete this._breakpoints[breakpoint._backendId]
+ delete breakpoint._backendId;
+ breakpoint.dispatchEventToListeners("enable-changed");
+ },
+
+ debuggerPaused: function(details)
+ {
+ if (details.eventType !== WebInspector.DebuggerEventTypes.NativeBreakpoint)
+ return;
+
+ var breakpoint = this._breakpoints[details.eventData.breakpointId];
+ if (!breakpoint)
+ return;
+
+ breakpoint.hit = true;
+ breakpoint.dispatchEventToListeners("hit-state-changed");
+ this._lastHitBreakpoint = breakpoint;
+
+ this.dispatchEventToListeners("breakpoint-hit", { breakpoint: breakpoint, eventData: details.eventData });
+ },
+
+ debuggerResumed: function()
+ {
+ if (!this._lastHitBreakpoint)
+ return;
+ this._lastHitBreakpoint.hit = false;
+ this._lastHitBreakpoint.dispatchEventToListeners("hit-state-changed");
+ delete this._lastHitBreakpoint;
+ },
+
+ restoreDOMBreakpoints: function()
+ {
+ var domBreakpoints = this._domBreakpoints;
+ this._domBreakpoints = {};
+
+ var breakpointsToRestore = {};
+ for (var frontendId in domBreakpoints) {
+ var breakpoint = domBreakpoints[frontendId];
+ var path = breakpoint._path;
+ if (!path)
+ continue;
+ if (!breakpointsToRestore[path]) {
+ breakpointsToRestore[path] = [];
+ InspectorBackend.pushNodeByPathToFrontend(path, restoreBreakpointsForNode.bind(this, breakpointsToRestore[path]));
+ }
+ breakpointsToRestore[path].push(breakpoint);
+ }
+
+ function restoreBreakpointsForNode(breakpoints, nodeId)
+ {
+ if (!nodeId)
+ return;
+ for (var i = 0; i < breakpoints.length; ++i)
+ this.createDOMBreakpoint(nodeId, breakpoints[i]._domEventType, !breakpoints[i].enabled);
+ }
}
}
WebInspector.BreakpointManager.prototype.__proto__ = WebInspector.Object.prototype;
-WebInspector.Breakpoint = function(breakpointManager, sourceID, sourceURL, line, enabled, condition)
+WebInspector.Breakpoint = function(breakpointManager, sourceID, url, line, enabled, condition)
{
- this.url = sourceURL;
+ this.url = url;
this.line = line;
this.sourceID = sourceID;
this._enabled = enabled;
@@ -165,10 +296,7 @@ WebInspector.Breakpoint.prototype = {
this._enabled = x;
this._breakpointManager._setBreakpointOnBackend(this);
- if (this._enabled)
- this.dispatchEventToListeners("enabled");
- else
- this.dispatchEventToListeners("disabled");
+ this.dispatchEventToListeners("enable-changed");
},
get sourceText()
@@ -182,12 +310,6 @@ WebInspector.Breakpoint.prototype = {
this.dispatchEventToListeners("text-changed");
},
- get label()
- {
- var displayName = (this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)"));
- return displayName + ":" + this.line;
- },
-
get id()
{
return this.sourceID + ":" + this.line;
@@ -208,9 +330,259 @@ WebInspector.Breakpoint.prototype = {
if (this.enabled)
this._breakpointManager._setBreakpointOnBackend(this);
this.dispatchEventToListeners("condition-changed");
+ },
+
+ compareTo: function(other)
+ {
+ if (this.url != other.url)
+ return this.url < other.url ? -1 : 1;
+ if (this.line != other.line)
+ return this.line < other.line ? -1 : 1;
+ return 0;
+ },
+
+ remove: function()
+ {
+ InspectorBackend.removeBreakpoint(this.sourceID, this.line);
+ this.dispatchEventToListeners("removed");
+ this.removeAllListeners();
+ delete this._breakpointManager;
}
}
WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype;
-WebInspector.didSetBreakpoint = WebInspector.Callback.processCallback;
+WebInspector.NativeBreakpoint = function(manager, frontendId, type)
+{
+ this._manager = manager;
+ this.__frontendId = frontendId;
+ this.__type = type;
+}
+
+WebInspector.NativeBreakpoint.prototype = {
+ get enabled()
+ {
+ return "_backendId" in this;
+ },
+
+ set enabled(enabled)
+ {
+ this._manager._setNativeBreakpointEnabled(this, enabled);
+ },
+
+ remove: function()
+ {
+ this._manager._removeNativeBreakpoint(this);
+ this._onRemove();
+ },
+
+ get _frontendId()
+ {
+ return this.__frontendId;
+ },
+
+ get _type()
+ {
+ return this.__type;
+ },
+
+ _compare: function(x, y)
+ {
+ if (x !== y)
+ return x < y ? -1 : 1;
+ return 0;
+ },
+
+ _onRemove: function()
+ {
+ }
+}
+
+WebInspector.NativeBreakpoint.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.DOMBreakpoint = function(manager, frontendId, nodeId, domEventType)
+{
+ WebInspector.NativeBreakpoint.call(this, manager, frontendId, "DOM");
+ this._nodeId = nodeId;
+ this._domEventType = domEventType;
+
+ var node = WebInspector.domAgent.nodeForId(this._nodeId);
+ if (node) {
+ node.breakpoints[this._domEventType] = this;
+ this._path = node.path();
+ }
+}
+
+WebInspector.DOMBreakpoint.prototype = {
+ click: function()
+ {
+ WebInspector.updateFocusedNode(this._nodeId);
+ },
+
+ compareTo: function(other)
+ {
+ return this._compare(this._domEventType, other._domEventType);
+ },
+
+ populateLabelElement: function(element)
+ {
+ element.appendChild(WebInspector.panels.elements.linkifyNodeById(this._nodeId));
+ element.appendChild(document.createTextNode(" - "));
+ element.appendChild(document.createTextNode(WebInspector.domBreakpointTypeLabel(this._domEventType)));
+ },
+
+ populateStatusMessageElement: function(element, eventData)
+ {
+ var substitutions = [WebInspector.domBreakpointTypeLabel(this._domEventType), WebInspector.panels.elements.linkifyNodeById(this._nodeId)];
+ var formatters = {
+ s: function(substitution)
+ {
+ return substitution;
+ }
+ };
+ function append(a, b)
+ {
+ if (typeof b === "string")
+ b = document.createTextNode(b);
+ element.appendChild(b);
+ }
+ if (this._domEventType === WebInspector.DOMBreakpointTypes.SubtreeModified) {
+ var targetNode = WebInspector.panels.elements.linkifyNodeById(eventData.targetNodeId);
+ if (eventData.insertion) {
+ if (eventData.targetNodeId !== this._nodeId)
+ WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s.", substitutions.concat(targetNode), formatters, "", append);
+ else
+ WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node.", substitutions, formatters, "", append);
+ } else
+ WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed.", substitutions.concat(targetNode), formatters, "", append);
+ } else
+ WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s.", substitutions, formatters, "", append);
+ },
+
+ _condition: function()
+ {
+ return { nodeId: this._nodeId, type: this._domEventType };
+ },
+
+ _onRemove: function()
+ {
+ var node = WebInspector.domAgent.nodeForId(this._nodeId);
+ if (node)
+ delete node.breakpoints[this._domEventType];
+ }
+}
+
+WebInspector.DOMBreakpoint.prototype.__proto__ = WebInspector.NativeBreakpoint.prototype;
+
+WebInspector.EventListenerBreakpoint = function(manager, frontendId, eventName)
+{
+ WebInspector.NativeBreakpoint.call(this, manager, frontendId, "EventListener");
+ this._eventName = eventName;
+}
+
+WebInspector.EventListenerBreakpoint.prototype = {
+ compareTo: function(other)
+ {
+ return this._compare(this._eventName, other._eventName);
+ },
+
+ populateLabelElement: function(element)
+ {
+ element.appendChild(document.createTextNode(this._uiEventName()));
+ },
+
+ populateStatusMessageElement: function(element, eventData)
+ {
+ var status = WebInspector.UIString("Paused on a \"%s\" Event Listener.", this._uiEventName());
+ element.appendChild(document.createTextNode(status));
+ },
+
+ _condition: function()
+ {
+ return { eventName: this._eventName };
+ },
+
+ _uiEventName: function()
+ {
+ if (!WebInspector.EventListenerBreakpoint._uiEventNames) {
+ WebInspector.EventListenerBreakpoint._uiEventNames = {
+ "instrumentation:setTimer": WebInspector.UIString("Set Timer"),
+ "instrumentation:clearTimer": WebInspector.UIString("Clear Timer"),
+ "instrumentation:timerFired": WebInspector.UIString("Timer Fired")
+ };
+ }
+ return WebInspector.EventListenerBreakpoint._uiEventNames[this._eventName] || this._eventName.substring(this._eventName.indexOf(":") + 1);
+ }
+}
+
+WebInspector.EventListenerBreakpoint.prototype.__proto__ = WebInspector.NativeBreakpoint.prototype;
+
+WebInspector.XHRBreakpoint = function(manager, frontendId, url)
+{
+ WebInspector.NativeBreakpoint.call(this, manager, frontendId, "XHR");
+ this._url = url;
+}
+
+WebInspector.XHRBreakpoint.prototype = {
+ compareTo: function(other)
+ {
+ return this._compare(this._url, other._url);
+ },
+
+ populateLabelElement: function(element)
+ {
+ var label;
+ if (!this._url.length)
+ label = WebInspector.UIString("Any XHR");
+ else
+ label = WebInspector.UIString("URL contains \"%s\"", this._url);
+ element.appendChild(document.createTextNode(label));
+ },
+
+ populateStatusMessageElement: function(element)
+ {
+ var status = WebInspector.UIString("Paused on a XMLHttpRequest.");
+ element.appendChild(document.createTextNode(status));
+ },
+
+ _condition: function()
+ {
+ return { url: this._url };
+ }
+}
+
+WebInspector.XHRBreakpoint.prototype.__proto__ = WebInspector.NativeBreakpoint.prototype;
+
+WebInspector.DebuggerEventTypes = {
+ JavaScriptPause: 0,
+ JavaScriptBreakpoint: 1,
+ NativeBreakpoint: 2
+};
+
+WebInspector.DOMBreakpointTypes = {
+ SubtreeModified: 0,
+ AttributeModified: 1,
+ NodeRemoved: 2
+};
+
+WebInspector.domBreakpointTypeLabel = function(type)
+{
+ if (!WebInspector._DOMBreakpointTypeLabels) {
+ WebInspector._DOMBreakpointTypeLabels = {};
+ WebInspector._DOMBreakpointTypeLabels[WebInspector.DOMBreakpointTypes.SubtreeModified] = WebInspector.UIString("Subtree Modified");
+ WebInspector._DOMBreakpointTypeLabels[WebInspector.DOMBreakpointTypes.AttributeModified] = WebInspector.UIString("Attribute Modified");
+ WebInspector._DOMBreakpointTypeLabels[WebInspector.DOMBreakpointTypes.NodeRemoved] = WebInspector.UIString("Node Removed");
+ }
+ return WebInspector._DOMBreakpointTypeLabels[type];
+}
+
+WebInspector.domBreakpointTypeContextMenuLabel = function(type)
+{
+ if (!WebInspector._DOMBreakpointTypeContextMenuLabels) {
+ WebInspector._DOMBreakpointTypeContextMenuLabels = {};
+ WebInspector._DOMBreakpointTypeContextMenuLabels[WebInspector.DOMBreakpointTypes.SubtreeModified] = WebInspector.UIString("Break on Subtree Modifications");
+ WebInspector._DOMBreakpointTypeContextMenuLabels[WebInspector.DOMBreakpointTypes.AttributeModified] = WebInspector.UIString("Break on Attributes Modifications");
+ WebInspector._DOMBreakpointTypeContextMenuLabels[WebInspector.DOMBreakpointTypes.NodeRemoved] = WebInspector.UIString("Break on Node Removal");
+ }
+ return WebInspector._DOMBreakpointTypeContextMenuLabels[type];
+}
View
336 front-end/BreakpointsSidebarPane.js
@@ -23,9 +23,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.BreakpointsSidebarPane = function()
+WebInspector.BreakpointsSidebarPane = function(title)
{
- WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints"));
+ WebInspector.SidebarPane.call(this, title);
this.listElement = document.createElement("ol");
this.listElement.className = "breakpoint-list";
@@ -35,9 +35,6 @@ WebInspector.BreakpointsSidebarPane = function()
this.emptyElement.textContent = WebInspector.UIString("No Breakpoints");
this.bodyElement.appendChild(this.emptyElement);
-
- WebInspector.breakpointManager.addEventListener("breakpoint-added", this._breakpointAdded, this);
- WebInspector.breakpointManager.addEventListener("breakpoint-removed", this._breakpointRemoved, this);
}
WebInspector.BreakpointsSidebarPane.prototype = {
@@ -50,104 +47,303 @@ WebInspector.BreakpointsSidebarPane.prototype = {
}
},
- _breakpointAdded: function(event)
+ addBreakpoint: function(breakpointItem)
{
- var breakpoint = event.data;
+ breakpointItem.addEventListener("removed", this._breakpointRemoved, this);
+
+ var element = breakpointItem.element();
+ element._breakpointItem = breakpointItem;
- breakpoint.addEventListener("enabled", this._breakpointEnableChanged, this);
- breakpoint.addEventListener("disabled", this._breakpointEnableChanged, this);
- breakpoint.addEventListener("text-changed", this._breakpointTextChanged, this);
+ var currentElement = this.listElement.firstChild;
+ while (currentElement) {
+ if (currentElement._breakpointItem.compareTo(element._breakpointItem) > 0) {
+ this.listElement.insertBefore(element, currentElement);
+ break;
+ }
+ currentElement = currentElement.nextSibling;
+ }
+ if (!currentElement)
+ this.listElement.appendChild(element);
- this._appendBreakpointElement(breakpoint);
+ element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this, breakpointItem), true);
if (this.emptyElement.parentElement) {
this.bodyElement.removeChild(this.emptyElement);
this.bodyElement.appendChild(this.listElement);
}
},
- _appendBreakpointElement: function(breakpoint)
+ _breakpointRemoved: function(event)
{
- function checkboxClicked(event)
- {
- breakpoint.enabled = !breakpoint.enabled;
-
- // without this, we'd switch to the source of the clicked breakpoint
- event.stopPropagation();
+ this.listElement.removeChild(event.target.element());
+ if (!this.listElement.firstChild) {
+ this.bodyElement.removeChild(this.listElement);
+ this.bodyElement.appendChild(this.emptyElement);
}
+ },
- function breakpointClicked()
- {
- WebInspector.panels.scripts.showSourceLine(breakpoint.url, breakpoint.line);
- }
+ _contextMenuEventFired: function(breakpointItem, event)
+ {
+ var contextMenu = new WebInspector.ContextMenu();
+ contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), breakpointItem.remove.bind(breakpointItem));
+ contextMenu.show(event);
+ }
+}
- var breakpointElement = document.createElement("li");
- breakpoint._breakpointListElement = breakpointElement;
- breakpointElement._breakpointObject = breakpoint;
- breakpointElement.addEventListener("click", breakpointClicked, false);
+WebInspector.BreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
- var checkboxElement = document.createElement("input");
- checkboxElement.className = "checkbox-elem";
- checkboxElement.type = "checkbox";
- checkboxElement.checked = breakpoint.enabled;
- checkboxElement.addEventListener("click", checkboxClicked, false);
- breakpointElement.appendChild(checkboxElement);
+WebInspector.XHRBreakpointsSidebarPane = function()
+{
+ WebInspector.BreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints"));
- var labelElement = document.createTextNode(breakpoint.label);
- breakpointElement.appendChild(labelElement);
+ var addButton = document.createElement("button");
+ addButton.className = "add";
+ addButton.addEventListener("click", this._showEditBreakpointDialog.bind(this), false);
+ this.titleElement.appendChild(addButton);
- var sourceTextElement = document.createElement("div");
- sourceTextElement.textContent = breakpoint.sourceText;
- sourceTextElement.className = "source-text monospace";
- breakpointElement.appendChild(sourceTextElement);
+ this.urlInputElement = document.createElement("span");
+ this.urlInputElement.className = "breakpoint-condition editing";
+}
- var currentElement = this.listElement.firstChild;
- while (currentElement) {
- var currentBreak = currentElement._breakpointObject;
- if (currentBreak.url > breakpoint.url) {
- this.listElement.insertBefore(breakpointElement, currentElement);
- return;
- } else if (currentBreak.url == breakpoint.url && currentBreak.line > breakpoint.line) {
- this.listElement.insertBefore(breakpointElement, currentElement);
- return;
- }
- currentElement = currentElement.nextSibling;
- }
- this.listElement.appendChild(breakpointElement);
+WebInspector.XHRBreakpointsSidebarPane.prototype = {
+ _showEditBreakpointDialog: function(event)
+ {
+ event.stopPropagation();
+
+ if (this.urlInputElement.parentElement)
+ return;
+
+ if (!this.expanded)
+ this.expanded = true;
+
+ this.urlInputElement.textContent = "";
+ this.bodyElement.insertBefore(this.urlInputElement, this.bodyElement.firstChild);
+ WebInspector.startEditing(this.urlInputElement, this._hideEditBreakpointDialog.bind(this, false), this._hideEditBreakpointDialog.bind(this, true));
},
- _breakpointRemoved: function(event)
+ _hideEditBreakpointDialog: function(discard)
{
- var breakpoint = event.data;
+ if (!discard)
+ WebInspector.breakpointManager.createXHRBreakpoint(this.urlInputElement.textContent.toLowerCase());
+ this.bodyElement.removeChild(this.urlInputElement);
+ }
+}
- breakpoint.removeEventListener("enabled", null, this);
- breakpoint.removeEventListener("disabled", null, this);
- breakpoint.removeEventListener("text-changed", null, this);
+WebInspector.XHRBreakpointsSidebarPane.prototype.__proto__ = WebInspector.BreakpointsSidebarPane.prototype;
- var element = breakpoint._breakpointListElement;
- element.parentElement.removeChild(element);
+WebInspector.BreakpointItem = function(breakpoint)
+{
+ this._breakpoint = breakpoint;
- if (!this.listElement.firstChild) {
- this.bodyElement.removeChild(this.listElement);
- this.bodyElement.appendChild(this.emptyElement);
+ this._element = document.createElement("li");
+ this._element.addEventListener("click", this._breakpointClicked.bind(this), false);
+
+ var checkboxElement = document.createElement("input");
+ checkboxElement.className = "checkbox-elem";
+ checkboxElement.type = "checkbox";
+ checkboxElement.checked = this._breakpoint.enabled;
+ checkboxElement.addEventListener("click", this._checkboxClicked.bind(this), false);
+ this._element.appendChild(checkboxElement);
+
+ if ("populateLabelElement" in this._breakpoint)
+ this._breakpoint.populateLabelElement(this._element);
+
+ this._breakpoint.addEventListener("enable-changed", this._enableChanged, this);
+ this._breakpoint.addEventListener("hit-state-changed", this._hitStateChanged, this);
+ this._breakpoint.addEventListener("removed", this.dispatchEventToListeners.bind(this, "removed"));
+}
+
+WebInspector.BreakpointItem.prototype = {
+ element: function()
+ {
+ return this._element;
+ },
+
+ compareTo: function(other)
+ {
+ return this._breakpoint.compareTo(other._breakpoint);
+ },
+
+ remove: function()
+ {
+ this._breakpoint.remove();
+ },
+
+ _breakpointClicked: function(event)
+ {
+ if ("click" in this._breakpoint)
+ this._breakpoint.click();
+ },
+
+ _checkboxClicked: function(event)
+ {
+ this._breakpoint.enabled = !this._breakpoint.enabled;
+
+ // Breakpoint element may have it's own click handler.
+ event.stopPropagation();
+ },
+
+ _enableChanged: function(event)
+ {
+ var checkbox = this._element.firstChild;
+ checkbox.checked = this._breakpoint.enabled;
+ },
+
+ _hitStateChanged: function(event)
+ {
+ if (event.target.hit)
+ this._element.addStyleClass("breakpoint-hit");
+ else
+ this._element.removeStyleClass("breakpoint-hit");
+ }
+}
+
+WebInspector.BreakpointItem.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.JSBreakpointItem = function(breakpoint)
+{
+ WebInspector.BreakpointItem.call(this, breakpoint);
+
+ var displayName = this._breakpoint.url ? WebInspector.displayNameForURL(this._breakpoint.url) : WebInspector.UIString("(program)");
+ var labelElement = document.createTextNode(displayName + ":" + this._breakpoint.line);
+ this._element.appendChild(labelElement);
+
+ var sourceTextElement = document.createElement("div");
+ sourceTextElement.textContent = this._breakpoint.sourceText;
+ sourceTextElement.className = "source-text monospace";
+ this._element.appendChild(sourceTextElement);
+
+ this._breakpoint.addEventListener("text-changed", this._textChanged, this);
+}
+
+WebInspector.JSBreakpointItem.prototype = {
+ _breakpointClicked: function()
+ {
+ WebInspector.panels.scripts.showSourceLine(this._breakpoint.url, this._breakpoint.line);
+ },
+
+ _textChanged: function()
+ {
+ var sourceTextElement = this._element.firstChild.nextSibling.nextSibling;
+ sourceTextElement.textContent = this._breakpoint.sourceText;
+ }
+}
+
+WebInspector.JSBreakpointItem.prototype.__proto__ = WebInspector.BreakpointItem.prototype;
+
+WebInspector.EventListenerBreakpointsSidebarPane = function()
+{
+ WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listener Breakpoints"));
+
+ this.categoriesElement = document.createElement("ol");
+ this.categoriesElement.tabIndex = 0;
+ this.categoriesElement.addStyleClass("properties-tree event-listener-breakpoints");
+ this.categoriesTreeOutline = new TreeOutline(this.categoriesElement);
+ this.bodyElement.appendChild(this.categoriesElement);
+}
+
+WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
+ _populate: function()
+ {
+ var categories = {
+ "Mouse": { type: "listener", eventNames: ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"] },
+ "Keyboard": { type: "listener", eventNames: ["keydown", "keypress", "keyup"] },
+ "HTML frame/object": { type: "listener", eventNames: ["load", "error", "resize", "scroll"] },
+ "Timer": { type: "instrumentation", eventNames: ["setTimer", "clearTimer", "timerFired"] }
+ };
+
+ for (var category in categories) {
+ var categoryTreeElement = new TreeElement(WebInspector.UIString(category));
+ this.categoriesTreeOutline.appendChild(categoryTreeElement);
+ categoryTreeElement.listItemElement.addStyleClass("event-category");
+ categoryTreeElement.selectable = true;
+
+ var categoryItem = {};
+ categoryItem.checkbox = this._createCheckbox(categoryTreeElement, this._categoryCheckboxClicked.bind(this, categoryItem));
+ categoryItem.children = {};
+
+ var categoryType = categories[category].type;
+ var eventNames = categories[category].eventNames;
+ for (var i = 0; i < eventNames.length; ++i) {
+ var eventName = categoryType + ":" + eventNames[i];
+
+ var breakpoint = WebInspector.breakpointManager.createEventListenerBreakpoint(eventName, true);
+ if (!breakpoint)
+ continue;
+
+ var labelElement = document.createElement("div");
+ breakpoint.populateLabelElement(labelElement);
+ var eventNameTreeElement = new TreeElement(labelElement);
+ categoryTreeElement.appendChild(eventNameTreeElement);
+ eventNameTreeElement.listItemElement.addStyleClass("source-code");
+ eventNameTreeElement.selectable = true;
+
+ var eventNameItem = {};
+ eventNameItem.checkbox = this._createCheckbox(eventNameTreeElement, this._eventNameCheckboxClicked.bind(this, categoryItem, eventNameItem));
+ eventNameItem.breakpoint = breakpoint;
+
+ breakpoint.addEventListener("enable-changed", this._breakpointEnableChanged.bind(this, categoryItem, eventNameItem), true);
+
+ categoryItem.children[eventName] = eventNameItem;
+ }
}
},
- _breakpointEnableChanged: function(event)
+ _createCheckbox: function(treeElement, checkboxClickedDelegate)
{
- var breakpoint = event.target;
+ var checkbox = document.createElement("input");
+ checkbox.className = "checkbox-elem";
+ checkbox.type = "checkbox";
+ checkbox.addEventListener("click", checkboxClickedDelegate, true);
+ treeElement.listItemElement.insertBefore(checkbox, treeElement.listItemElement.firstChild);
+ return checkbox;
+ },
- var checkbox = breakpoint._breakpointListElement.firstChild;
- checkbox.checked = breakpoint.enabled;
+ _categoryCheckboxClicked: function(categoryItem)
+ {
+ var checkbox = categoryItem.checkbox;
+ checkbox.indeterminate = false;
+ for (var eventName in categoryItem.children) {
+ var eventNameItem = categoryItem.children[eventName];
+ eventNameItem.checkbox.checked = checkbox.checked;
+ eventNameItem.breakpoint.enabled = checkbox.checked;
+ }
+ },
+
+ _eventNameCheckboxClicked: function(categoryItem, eventNameItem)
+ {
+ this._updateCategoryCheckbox(categoryItem);
+ eventNameItem.breakpoint.enabled = eventNameItem.checkbox.checked;
},
- _breakpointTextChanged: function(event)
+ _breakpointEnableChanged: function(categoryItem, eventNameItem)
{
- var breakpoint = event.target;
+ if (eventNameItem.checkbox.checked === eventNameItem.breakpoint.enabled)
+ return;
- var sourceTextElement = breakpoint._breakpointListElement.firstChild.nextSibling.nextSibling;
- sourceTextElement.textContent = breakpoint.sourceText;
+ eventNameItem.checkbox.checked = eventNameItem.breakpoint.enabled;
+ this._updateCategoryCheckbox(categoryItem);
+ },
+
+ _updateCategoryCheckbox: function(categoryItem)
+ {
+ var hasEnabled = false, hasDisabled = false;
+ for (var eventName in categoryItem.children) {
+ var eventNameItem = categoryItem.children[eventName];
+ if (eventNameItem.checkbox.checked)
+ hasEnabled = true;
+ else
+ hasDisabled = true;
+ }
+ categoryItem.checkbox.checked = hasEnabled;
+ categoryItem.checkbox.indeterminate = hasEnabled && hasDisabled;
+ },
+
+ reset: function()
+ {
+ this.categoriesTreeOutline.removeChildren();
+ this._populate();
}
}
-WebInspector.BreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
+WebInspector.EventListenerBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
View
34 front-end/CSSCompletions.js
@@ -1,27 +1,4 @@
-WebInspector.CSSCompletions = (function() {
- var used = {};
- var properties = [];
- var style = document.documentElement.style;
- var list = document.defaultView.getComputedStyle(document.documentElement, "");
- var length = list.length;
- for (var i = 0; i < length; ++i)
- used[properties[i] = list[i]] = true;
-
- for (var i = 0, end = length; i < length; ++i) {
- var propertyWords = properties[i].split("-");
- var j = propertyWords.length;
- while (--j) {
- propertyWords.pop();
- var shorthand = propertyWords.join("-");
- if (!(shorthand in used) && style[shorthand] !== undefined) {
- used[shorthand] = true;
- properties[end++] = shorthand;
- }
- }
- }
-
- return properties.sort();
-})();
+WebInspector.CSSCompletions = [];
WebInspector.CSSCompletions.startsWith = function(prefix)
{
@@ -45,6 +22,8 @@ WebInspector.CSSCompletions._firstIndexOfPrefix = function(prefix)
{
if (!prefix)
return -1;
+ if (!this.length)
+ return -1;
var maxIndex = this.length - 1;
var minIndex = 0;
@@ -100,3 +79,10 @@ WebInspector.CSSCompletions._closest = function(str, prefix, shift)
j = (j + propertiesWithPrefix.length + shift) % propertiesWithPrefix.length;
return propertiesWithPrefix[j];
}
+
+WebInspector.CSSCompletions._load = function(properties)
+{
+ for (var i = 0; i < properties.length; ++i)
+ WebInspector.CSSCompletions.push(properties[i]);
+ WebInspector.CSSCompletions.sort();
+}
View
14 front-end/CSSStyleModel.js
@@ -35,12 +35,12 @@ WebInspector.CSSStyleModel = function()
WebInspector.CSSStyleModel.prototype = {
getStylesAsync: function(nodeId, authOnly, userCallback)
{
- InspectorBackend.getStyles(WebInspector.Callback.wrap(userCallback), nodeId, authOnly);
+ InspectorBackend.getStyles(nodeId, authOnly, userCallback);
},
getComputedStyleAsync: function(nodeId, userCallback)
{
- InspectorBackend.getComputedStyle(WebInspector.Callback.wrap(userCallback), nodeId);
+ InspectorBackend.getComputedStyle(nodeId, userCallback);
},
setRuleSelector: function(ruleId, newContent, nodeId, successCallback, failureCallback)
@@ -53,7 +53,7 @@ WebInspector.CSSStyleModel.prototype = {
successCallback(WebInspector.CSSStyleDeclaration.parseRule(newRulePayload), doesAffectSelectedNode);
}
- InspectorBackend.setRuleSelector(WebInspector.Callback.wrap(callback), ruleId, newContent, nodeId);
+ InspectorBackend.setRuleSelector(ruleId, newContent, nodeId, callback);
},
addRule: function(nodeId, newContent, successCallback, failureCallback)
@@ -70,7 +70,7 @@ WebInspector.CSSStyleModel.prototype = {