[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
podivilov at chromium.org
podivilov at chromium.org
Wed Dec 22 15:22:39 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit a6d1ca34bb95ef5ab91f1a7ec17094e10574f51d
Author: podivilov at chromium.org <podivilov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 2 10:43:42 2010 +0000
2010-11-02 Pavel Podivilov <podivilov at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: persist native breakpoints in localStorage
https://bugs.webkit.org/show_bug.cgi?id=48711
* inspector/InspectorController.cpp:
(WebCore::InspectorController::disconnectFrontend):
(WebCore::InspectorController::didCommitLoad):
(WebCore::InspectorController::clearNativeBreakpoints):
* inspector/InspectorController.h:
* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager):
(WebInspector.DOMBreakpoint):
(WebInspector.EventListenerBreakpoint):
(WebInspector.EventListenerBreakpoint.eventNameForUI):
(WebInspector.EventListenerBreakpoint.prototype._uiEventName):
(WebInspector.XHRBreakpoint):
(WebInspector.XHRBreakpoint.prototype.populateStatusMessageElement):
* inspector/front-end/BreakpointsSidebarPane.js:
(WebInspector.BreakpointsSidebarPane.prototype.addBreakpoint):
(WebInspector.BreakpointsSidebarPane.prototype._breakpointHit):
(WebInspector.BreakpointItem.prototype._hitStateChanged):
(WebInspector.EventListenerBreakpointsSidebarPane):
* inspector/front-end/ConsoleView.js:
* inspector/front-end/EventListenersSidebarPane.js:
* inspector/front-end/NetworkPanel.js:
* inspector/front-end/Panel.js:
* inspector/front-end/ResourceView.js:
* inspector/front-end/ScriptsPanel.js:
* inspector/front-end/Settings.js:
(WebInspector.Settings):
(WebInspector.Settings.prototype.inspectedURLChanged):
(WebInspector.Settings.prototype._formatProjectKey):
* inspector/front-end/StoragePanel.js:
* inspector/front-end/StylesSidebarPane.js:
* inspector/front-end/WatchExpressionsSidebarPane.js:
* inspector/front-end/inspector.css:
(.pane .breakpoint-hit):
* inspector/front-end/inspector.js:
(WebInspector.set currentPanel):
(WebInspector.doLoadedDone.onPopulateScriptObjects):
(WebInspector.doLoadedDone):
(WebInspector.reset):
(WebInspector.inspectedURLChanged):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71109 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index baeea4b..fdc75b7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,50 @@
+2010-11-02 Pavel Podivilov <podivilov at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: persist native breakpoints in localStorage
+ https://bugs.webkit.org/show_bug.cgi?id=48711
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::disconnectFrontend):
+ (WebCore::InspectorController::didCommitLoad):
+ (WebCore::InspectorController::clearNativeBreakpoints):
+ * inspector/InspectorController.h:
+ * inspector/front-end/BreakpointManager.js:
+ (WebInspector.BreakpointManager):
+ (WebInspector.DOMBreakpoint):
+ (WebInspector.EventListenerBreakpoint):
+ (WebInspector.EventListenerBreakpoint.eventNameForUI):
+ (WebInspector.EventListenerBreakpoint.prototype._uiEventName):
+ (WebInspector.XHRBreakpoint):
+ (WebInspector.XHRBreakpoint.prototype.populateStatusMessageElement):
+ * inspector/front-end/BreakpointsSidebarPane.js:
+ (WebInspector.BreakpointsSidebarPane.prototype.addBreakpoint):
+ (WebInspector.BreakpointsSidebarPane.prototype._breakpointHit):
+ (WebInspector.BreakpointItem.prototype._hitStateChanged):
+ (WebInspector.EventListenerBreakpointsSidebarPane):
+ * inspector/front-end/ConsoleView.js:
+ * inspector/front-end/EventListenersSidebarPane.js:
+ * inspector/front-end/NetworkPanel.js:
+ * inspector/front-end/Panel.js:
+ * inspector/front-end/ResourceView.js:
+ * inspector/front-end/ScriptsPanel.js:
+ * inspector/front-end/Settings.js:
+ (WebInspector.Settings):
+ (WebInspector.Settings.prototype.inspectedURLChanged):
+ (WebInspector.Settings.prototype._formatProjectKey):
+ * inspector/front-end/StoragePanel.js:
+ * inspector/front-end/StylesSidebarPane.js:
+ * inspector/front-end/WatchExpressionsSidebarPane.js:
+ * inspector/front-end/inspector.css:
+ (.pane .breakpoint-hit):
+ * inspector/front-end/inspector.js:
+ (WebInspector.set currentPanel):
+ (WebInspector.doLoadedDone.onPopulateScriptObjects):
+ (WebInspector.doLoadedDone):
+ (WebInspector.reset):
+ (WebInspector.inspectedURLChanged):
+
2010-11-01 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Joseph Pecoraro.
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index e3dbf7e..5a4abc0 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -569,6 +569,7 @@ void InspectorController::disconnectFrontend()
bool debuggerWasEnabled = debuggerEnabled();
disableDebugger();
m_attachDebuggerWhenShown = debuggerWasEnabled;
+ clearNativeBreakpoints();
#endif
setSearchingForNode(false);
unbindAllResources();
@@ -728,10 +729,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
if (m_debuggerAgent)
m_debuggerAgent->clearForPageNavigation();
- m_nativeBreakpoints.clear();
- m_eventListenerBreakpoints.clear();
- m_XHRBreakpoints.clear();
- m_lastBreakpointId = 0;
+ clearNativeBreakpoints();
#endif
#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
@@ -1463,6 +1461,14 @@ String InspectorController::findXHRBreakpoint(const String& url)
}
return "";
}
+
+void InspectorController::clearNativeBreakpoints()
+{
+ m_nativeBreakpoints.clear();
+ m_eventListenerBreakpoints.clear();
+ m_XHRBreakpoints.clear();
+ m_lastBreakpointId = 0;
+}
#endif
void InspectorController::evaluateForTestInFrontend(long callId, const String& script)
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 465cd02..ab728a1 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -299,6 +299,7 @@ private:
String findEventListenerBreakpoint(const String& eventName);
String findXHRBreakpoint(const String& url);
+ void clearNativeBreakpoints();
#endif
#if ENABLE(DATABASE)
void selectDatabase(Database* database);
diff --git a/WebCore/inspector/front-end/BreakpointManager.js b/WebCore/inspector/front-end/BreakpointManager.js
index 77ba89d..d4df652 100644
--- a/WebCore/inspector/front-end/BreakpointManager.js
+++ b/WebCore/inspector/front-end/BreakpointManager.js
@@ -28,7 +28,6 @@ WebInspector.BreakpointManager = function()
{
this._breakpoints = {};
this._nativeBreakpoints = {};
- this._domBreakpoints = {};
}
WebInspector.BreakpointManager.prototype = {
@@ -137,13 +136,12 @@ WebInspector.BreakpointManager.prototype = {
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)
+ createEventListenerBreakpoint: function(eventName)
{
var frontendId = eventName;
if (frontendId in this._nativeBreakpoints)
@@ -151,7 +149,8 @@ WebInspector.BreakpointManager.prototype = {
var breakpoint = new WebInspector.EventListenerBreakpoint(this, frontendId, eventName);
this._nativeBreakpoints[frontendId] = breakpoint;
- breakpoint.enabled = !disabled;
+ this.dispatchEventToListeners("event-listener-breakpoint-added", { breakpoint: breakpoint, eventName: eventName });
+ breakpoint.enabled = true;
return breakpoint;
},
@@ -175,8 +174,7 @@ WebInspector.BreakpointManager.prototype = {
if (breakpoint.enabled)
this._removeNativeBreakpointFromBackend(breakpoint);
delete this._nativeBreakpoints[breakpoint._frontendId];
- if (breakpoint._type === "DOM")
- delete this._domBreakpoints[breakpoint._frontendId];
+ this._updateNativeBreakpointsInSettings();
breakpoint.dispatchEventToListeners("removed");
},
@@ -195,7 +193,7 @@ WebInspector.BreakpointManager.prototype = {
_setNativeBreakpointOnBackend: function(breakpoint)
{
breakpoint._beingSetOnBackend = true;
- var data = { type: breakpoint._type, condition: breakpoint._condition() };
+ var data = { type: breakpoint._type, condition: breakpoint._condition };
InspectorBackend.setNativeBreakpoint(data, didSetNativeBreakpoint.bind(this));
function didSetNativeBreakpoint(backendBreakpointId)
@@ -206,6 +204,7 @@ WebInspector.BreakpointManager.prototype = {
this._breakpoints[backendBreakpointId] = breakpoint;
}
breakpoint.dispatchEventToListeners("enable-changed");
+ this._updateNativeBreakpointsInSettings();
}
},
@@ -215,6 +214,18 @@ WebInspector.BreakpointManager.prototype = {
delete this._breakpoints[breakpoint._backendId]
delete breakpoint._backendId;
breakpoint.dispatchEventToListeners("enable-changed");
+ this._updateNativeBreakpointsInSettings();
+ },
+
+ _updateNativeBreakpointsInSettings: function()
+ {
+ var persistentBreakpoints = [];
+ for (var id in this._nativeBreakpoints) {
+ var breakpoint = this._nativeBreakpoints[id];
+ if (breakpoint._persistentCondition)
+ persistentBreakpoints.push({ type: breakpoint._type, enabled: breakpoint.enabled, condition: breakpoint._persistentCondition });
+ }
+ WebInspector.settings.nativeBreakpoints = persistentBreakpoints;
},
debuggerPaused: function(details)
@@ -242,31 +253,60 @@ WebInspector.BreakpointManager.prototype = {
delete this._lastHitBreakpoint;
},
+ restoreBreakpoints: function()
+ {
+ var breakpoints = this._persistentBreakpoints();
+ for (var i = 0; i < breakpoints.length; ++i) {
+ if (breakpoints[i].type === "EventListener")
+ this.createEventListenerBreakpoint(breakpoints[i].condition.eventName);
+ else if (breakpoints[i].type === "XHR")
+ this.createXHRBreakpoint(breakpoints[i].condition.url, !breakpoints[i].enabled);
+ }
+ },
+
restoreDOMBreakpoints: function()
{
- var domBreakpoints = this._domBreakpoints;
- this._domBreakpoints = {};
+ function didPushNodeByPathToFrontend(path, nodeId)
+ {
+ pathToNodeId[path] = nodeId;
+ pendingCalls -= 1;
+ if (pendingCalls)
+ return;
+ for (var i = 0; i < breakpoints.length; ++i) {
+ var breakpoint = breakpoints[i];
+ var nodeId = pathToNodeId[breakpoint.condition.path];
+ if (nodeId)
+ this.createDOMBreakpoint(nodeId, breakpoint.condition.type, !breakpoint.enabled);
+ }
+ }
- var breakpointsToRestore = {};
- for (var frontendId in domBreakpoints) {
- var breakpoint = domBreakpoints[frontendId];
- var path = breakpoint._path;
- if (!path)
+ var breakpoints = this._persistentBreakpoints();
+ var pathToNodeId = {};
+ var pendingCalls = 0;
+ for (var i = 0; i < breakpoints.length; ++i) {
+ if (breakpoints[i].type !== "DOM")
continue;
- if (!breakpointsToRestore[path]) {
- breakpointsToRestore[path] = [];
- InspectorBackend.pushNodeByPathToFrontend(path, restoreBreakpointsForNode.bind(this, breakpointsToRestore[path]));
- }
- breakpointsToRestore[path].push(breakpoint);
+ var path = breakpoints[i].condition.path;
+ if (path in pathToNodeId)
+ continue;
+ pathToNodeId[path] = 0;
+ pendingCalls += 1;
+ InspectorBackend.pushNodeByPathToFrontend(path, didPushNodeByPathToFrontend.bind(this, path));
}
+ },
- function restoreBreakpointsForNode(breakpoints, nodeId)
- {
- if (!nodeId)
- return;
- for (var i = 0; i < breakpoints.length; ++i)
- this.createDOMBreakpoint(nodeId, breakpoints[i]._domEventType, !breakpoints[i].enabled);
+ _persistentBreakpoints: function()
+ {
+ var result = [];
+ var breakpoints = WebInspector.settings.nativeBreakpoints;
+ if (breakpoints instanceof Array) {
+ for (var i = 0; i < breakpoints.length; ++i) {
+ var breakpoint = breakpoints[i];
+ if ("type" in breakpoint && "condition" in breakpoint)
+ result.push(breakpoint)
+ }
}
+ return result;
}
}
@@ -405,11 +445,12 @@ WebInspector.DOMBreakpoint = function(manager, frontendId, nodeId, domEventType)
WebInspector.NativeBreakpoint.call(this, manager, frontendId, "DOM");
this._nodeId = nodeId;
this._domEventType = domEventType;
+ this._condition = { nodeId: this._nodeId, type: this._domEventType };
var node = WebInspector.domAgent.nodeForId(this._nodeId);
if (node) {
node.breakpoints[this._domEventType] = this;
- this._path = node.path();
+ this._persistentCondition = { path: node.path(), type: this._domEventType };
}
}
@@ -459,11 +500,6 @@ WebInspector.DOMBreakpoint.prototype = {
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);
@@ -478,6 +514,20 @@ WebInspector.EventListenerBreakpoint = function(manager, frontendId, eventName)
{
WebInspector.NativeBreakpoint.call(this, manager, frontendId, "EventListener");
this._eventName = eventName;
+ this._condition = { eventName: this._eventName };
+ this._persistentCondition = this._condition;
+}
+
+WebInspector.EventListenerBreakpoint.eventNameForUI = function(eventName)
+{
+ if (!WebInspector.EventListenerBreakpoint._eventNamesForUI) {
+ WebInspector.EventListenerBreakpoint._eventNamesForUI = {
+ "instrumentation:setTimer": WebInspector.UIString("Set Timer"),
+ "instrumentation:clearTimer": WebInspector.UIString("Clear Timer"),
+ "instrumentation:timerFired": WebInspector.UIString("Timer Fired")
+ };
+ }
+ return WebInspector.EventListenerBreakpoint._eventNamesForUI[eventName] || eventName.substring(eventName.indexOf(":") + 1);
}
WebInspector.EventListenerBreakpoint.prototype = {
@@ -497,21 +547,9 @@ WebInspector.EventListenerBreakpoint.prototype = {
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);
+ return WebInspector.EventListenerBreakpoint.eventNameForUI(this._eventName);
}
}
@@ -521,6 +559,8 @@ WebInspector.XHRBreakpoint = function(manager, frontendId, url)
{
WebInspector.NativeBreakpoint.call(this, manager, frontendId, "XHR");
this._url = url;
+ this._condition = { url: this._url };
+ this._persistentCondition = this._condition;
}
WebInspector.XHRBreakpoint.prototype = {
@@ -543,11 +583,6 @@ WebInspector.XHRBreakpoint.prototype = {
{
var status = WebInspector.UIString("Paused on a XMLHttpRequest.");
element.appendChild(document.createTextNode(status));
- },
-
- _condition: function()
- {
- return { url: this._url };
}
}
diff --git a/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
index 2151137..72542ea 100644
--- a/WebCore/inspector/front-end/BreakpointsSidebarPane.js
+++ b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
@@ -49,6 +49,7 @@ WebInspector.BreakpointsSidebarPane.prototype = {
addBreakpoint: function(breakpointItem)
{
+ breakpointItem.addEventListener("breakpoint-hit", this._breakpointHit, this);
breakpointItem.addEventListener("removed", this._breakpointRemoved, this);
var element = breakpointItem.element();
@@ -73,6 +74,11 @@ WebInspector.BreakpointsSidebarPane.prototype = {
}
},
+ _breakpointHit: function(event)
+ {
+ this.expanded = true;
+ },
+
_breakpointRemoved: function(event)
{
this.listElement.removeChild(event.target.element());
@@ -191,9 +197,10 @@ WebInspector.BreakpointItem.prototype = {
_hitStateChanged: function(event)
{
- if (event.target.hit)
+ if (event.target.hit) {
this._element.addStyleClass("breakpoint-hit");
- else
+ this.dispatchEventToListeners("breakpoint-hit");
+ } else
this._element.removeStyleClass("breakpoint-hit");
}
}
@@ -240,97 +247,116 @@ WebInspector.EventListenerBreakpointsSidebarPane = function()
this.categoriesElement.addStyleClass("properties-tree event-listener-breakpoints");
this.categoriesTreeOutline = new TreeOutline(this.categoriesElement);
this.bodyElement.appendChild(this.categoriesElement);
+
+ WebInspector.breakpointManager.addEventListener("event-listener-breakpoint-added", this._breakpointAdded, this);
+
+ this._breakpointItems = {};
+ this._createCategory("Mouse", "listener", ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
+ this._createCategory("Keyboard", "listener", ["keydown", "keypress", "keyup"]);
+ this._createCategory("HTML frame/object", "listener", ["load", "error", "resize", "scroll"]);
+ this._createCategory("Timer", "instrumentation", ["setTimer", "clearTimer", "timerFired"]);
}
WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
- _populate: function()
+ _createCategory: function(name, type, eventNames)
{
- 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;
- }
+ var categoryItem = {};
+ categoryItem.element = new TreeElement(WebInspector.UIString(name));
+ this.categoriesTreeOutline.appendChild(categoryItem.element);
+ categoryItem.element.listItemElement.addStyleClass("event-category");
+ categoryItem.element.selectable = true;
+
+ categoryItem.checkbox = this._createCheckbox(categoryItem.element);
+ categoryItem.checkbox.addEventListener("click", this._categoryCheckboxClicked.bind(this, categoryItem), true);
+
+ categoryItem.children = {};
+ for (var i = 0; i < eventNames.length; ++i) {
+ var eventName = type + ":" + eventNames[i];
+
+ var breakpointItem = {};
+ var title = WebInspector.EventListenerBreakpoint.eventNameForUI(eventName);
+ breakpointItem.element = new TreeElement(title);
+ categoryItem.element.appendChild(breakpointItem.element);
+ breakpointItem.element.listItemElement.addStyleClass("source-code");
+ breakpointItem.element.selectable = true;
+
+ breakpointItem.checkbox = this._createCheckbox(breakpointItem.element);
+ breakpointItem.checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(this, breakpointItem), true);
+ breakpointItem.parent = categoryItem;
+ breakpointItem.eventName = eventName;
+
+ this._breakpointItems[eventName] = breakpointItem;
+ categoryItem.children[eventName] = breakpointItem;
}
},
- _createCheckbox: function(treeElement, checkboxClickedDelegate)
+ _createCheckbox: function(treeElement)
{
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;
},
_categoryCheckboxClicked: function(categoryItem)
{
- var checkbox = categoryItem.checkbox;
- checkbox.indeterminate = false;
+ var checked = categoryItem.checkbox.checked;
for (var eventName in categoryItem.children) {
- var eventNameItem = categoryItem.children[eventName];
- eventNameItem.checkbox.checked = checkbox.checked;
- eventNameItem.breakpoint.enabled = checkbox.checked;
+ var breakpointItem = categoryItem.children[eventName];
+ if (breakpointItem.checkbox.checked !== checked) {
+ breakpointItem.checkbox.checked = checked;
+ this._breakpointCheckboxClicked(breakpointItem);
+ }
}
},
- _eventNameCheckboxClicked: function(categoryItem, eventNameItem)
+ _breakpointCheckboxClicked: function(breakpointItem)
{
- this._updateCategoryCheckbox(categoryItem);
- eventNameItem.breakpoint.enabled = eventNameItem.checkbox.checked;
+ if (breakpointItem.checkbox.checked)
+ WebInspector.breakpointManager.createEventListenerBreakpoint(breakpointItem.eventName);
+ else
+ breakpointItem.breakpoint.remove();
},
- _breakpointEnableChanged: function(categoryItem, eventNameItem)
+ _breakpointAdded: function(event)
{
- if (eventNameItem.checkbox.checked === eventNameItem.breakpoint.enabled)
- return;
+ var breakpoint = event.data.breakpoint;
+ var eventName = event.data.eventName;
+
+ var breakpointItem = this._breakpointItems[eventName];
+ breakpointItem.breakpoint = breakpoint;
+ breakpoint.addEventListener("hit-state-changed", this._breakpointHitStateChanged.bind(this, breakpointItem));
+ breakpoint.addEventListener("removed", this._breakpointRemoved.bind(this, breakpointItem));
+ breakpointItem.checkbox.checked = true;
+ this._updateCategoryCheckbox(breakpointItem);
+ },
+
+ _breakpointHitStateChanged: function(breakpointItem, event)
+ {
+ if (event.target.hit) {
+ this.expanded = true;
+ var categoryItem = breakpointItem.parent;
+ categoryItem.element.expand();
+ breakpointItem.element.listItemElement.addStyleClass("breakpoint-hit");
+ } else
+ breakpointItem.element.listItemElement.removeStyleClass("breakpoint-hit");
+ },
- eventNameItem.checkbox.checked = eventNameItem.breakpoint.enabled;
- this._updateCategoryCheckbox(categoryItem);
+ _breakpointRemoved: function(breakpointItem)
+ {
+ breakpointItem.breakpoint = null;
+ breakpointItem.checkbox.checked = false;
+ this._updateCategoryCheckbox(breakpointItem);
},
- _updateCategoryCheckbox: function(categoryItem)
+ _updateCategoryCheckbox: function(breakpointItem)
{
+ var categoryItem = breakpointItem.parent;
var hasEnabled = false, hasDisabled = false;
for (var eventName in categoryItem.children) {
- var eventNameItem = categoryItem.children[eventName];
- if (eventNameItem.checkbox.checked)
+ var breakpointItem = categoryItem.children[eventName];
+ if (breakpointItem.checkbox.checked)
hasEnabled = true;
else
hasDisabled = true;
@@ -341,8 +367,12 @@ WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
reset: function()
{
- this.categoriesTreeOutline.removeChildren();
- this._populate();
+ for (var eventName in this._breakpointItems) {
+ var breakpointItem = this._breakpointItems[eventName];
+ breakpointItem.breakpoint = null;
+ breakpointItem.checkbox.checked = false;
+ this._updateCategoryCheckbox(breakpointItem);
+ }
}
}
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index eeaff2e..093c40a 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -48,7 +48,7 @@ WebInspector.ConsoleView = function(drawer)
this.promptElement.className = "source-code";
this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true);
this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), ExpressionStopCharacters + ".");
- this.prompt.history = WebInspector.applicationSettings.consoleHistory;
+ this.prompt.history = WebInspector.settings.consoleHistory;
this.topGroup = new WebInspector.ConsoleGroup(null, 0);
this.messagesElement.insertBefore(this.topGroup.element, this.promptElement);
@@ -530,7 +530,7 @@ WebInspector.ConsoleView.prototype = {
self.prompt.historyOffset = 0;
self.prompt.text = "";
- WebInspector.applicationSettings.consoleHistory = self.prompt.history.slice(-30);
+ WebInspector.settings.consoleHistory = self.prompt.history.slice(-30);
self.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));
}
diff --git a/WebCore/inspector/front-end/EventListenersSidebarPane.js b/WebCore/inspector/front-end/EventListenersSidebarPane.js
index 3354191..e526b45 100644
--- a/WebCore/inspector/front-end/EventListenersSidebarPane.js
+++ b/WebCore/inspector/front-end/EventListenersSidebarPane.js
@@ -46,7 +46,7 @@ WebInspector.EventListenersSidebarPane = function()
option.label = WebInspector.UIString("Selected Node Only");
this.settingsSelectElement.appendChild(option);
- var filter = WebInspector.applicationSettings.eventListenersFilter;
+ var filter = WebInspector.settings.eventListenersFilter;
if (filter === "all")
this.settingsSelectElement[0].selected = true;
else if (filter === "selected")
@@ -107,7 +107,7 @@ WebInspector.EventListenersSidebarPane.prototype = {
_changeSetting: function(event)
{
var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex];
- WebInspector.applicationSettings.eventListenersFilter = selectedOption.value;
+ WebInspector.settings.eventListenersFilter = selectedOption.value;
for (var i = 0; i < this.sections.length; ++i)
this.sections[i].update();
@@ -137,7 +137,7 @@ WebInspector.EventListenersSection.prototype = {
{
// A Filtered Array simplifies when to create connectors
var filteredEventListeners = this.eventListeners;
- if (WebInspector.applicationSettings.eventListenersFilter === "selected") {
+ if (WebInspector.settings.eventListenersFilter === "selected") {
filteredEventListeners = [];
for (var i = 0; i < this.eventListeners.length; ++i) {
var eventListener = this.eventListeners[i];
diff --git a/WebCore/inspector/front-end/NetworkPanel.js b/WebCore/inspector/front-end/NetworkPanel.js
index a717c34..6fd61a9 100644
--- a/WebCore/inspector/front-end/NetworkPanel.js
+++ b/WebCore/inspector/front-end/NetworkPanel.js
@@ -67,8 +67,8 @@ WebInspector.NetworkPanel = function()
this._createFilterStatusBarItems();
this._createSummaryBar();
- if (!WebInspector.applicationSettings.resourcesLargeRows)
- this._setLargerResources(WebInspector.applicationSettings.resourcesLargeRows);
+ if (!WebInspector.settings.resourcesLargeRows)
+ this._setLargerResources(WebInspector.settings.resourcesLargeRows);
this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this), true);
@@ -615,7 +615,7 @@ WebInspector.NetworkPanel.prototype = {
this._clearButton.addEventListener("click", this._reset.bind(this), false);
this._largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "network-larger-resources-status-bar-item");
- this._largerResourcesButton.toggled = WebInspector.applicationSettings.resourcesLargeRows;
+ this._largerResourcesButton.toggled = WebInspector.settings.resourcesLargeRows;
this._largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false);
},
@@ -884,8 +884,8 @@ WebInspector.NetworkPanel.prototype = {
_toggleLargerResources: function()
{
- WebInspector.applicationSettings.resourcesLargeRows = !WebInspector.applicationSettings.resourcesLargeRows;
- this._setLargerResources(WebInspector.applicationSettings.resourcesLargeRows);
+ WebInspector.settings.resourcesLargeRows = !WebInspector.settings.resourcesLargeRows;
+ this._setLargerResources(WebInspector.settings.resourcesLargeRows);
},
_setLargerResources: function(enabled)
diff --git a/WebCore/inspector/front-end/Panel.js b/WebCore/inspector/front-end/Panel.js
index ec9250c..4c42a60 100644
--- a/WebCore/inspector/front-end/Panel.js
+++ b/WebCore/inspector/front-end/Panel.js
@@ -34,7 +34,7 @@ WebInspector.Panel = function(name)
this.element.addStyleClass(name);
this._panelName = name;
- WebInspector.applicationSettings.installApplicationSetting(this._sidebarWidthSettingName(), undefined);
+ WebInspector.settings.installApplicationSetting(this._sidebarWidthSettingName(), undefined);
}
// Should by in sync with style declarations.
@@ -377,7 +377,7 @@ WebInspector.Panel.prototype = {
restoreSidebarWidth: function()
{
- var sidebarWidth = WebInspector.applicationSettings[this._sidebarWidthSettingName()];
+ var sidebarWidth = WebInspector.settings[this._sidebarWidthSettingName()];
this.updateSidebarWidth(sidebarWidth);
},
@@ -385,7 +385,7 @@ WebInspector.Panel.prototype = {
{
if (!this.sidebarElement)
return;
- WebInspector.applicationSettings[this._sidebarWidthSettingName()] = this.sidebarElement.offsetWidth;
+ WebInspector.settings[this._sidebarWidthSettingName()] = this.sidebarElement.offsetWidth;
},
updateMainViewWidth: function(width)
diff --git a/WebCore/inspector/front-end/ResourceView.js b/WebCore/inspector/front-end/ResourceView.js
index ffb229d..3ca7fcc 100644
--- a/WebCore/inspector/front-end/ResourceView.js
+++ b/WebCore/inspector/front-end/ResourceView.js
@@ -147,7 +147,7 @@ WebInspector.ResourceView.prototype = {
_selectTab: function()
{
- var preferredTab = WebInspector.applicationSettings.resourceViewTab;
+ var preferredTab = WebInspector.settings.resourceViewTab;
if (this._headersVisible && this._cookiesView && preferredTab === "cookies")
this._selectCookiesTab();
else if (this._headersVisible && (!this.hasContentTab() || preferredTab === "headers"))
@@ -159,14 +159,14 @@ WebInspector.ResourceView.prototype = {
_selectHeadersTab: function(updatePrefs)
{
if (updatePrefs)
- WebInspector.applicationSettings.resourceViewTab = "headers";
+ WebInspector.settings.resourceViewTab = "headers";
this.tabbedPane.selectTabById("headers");
},
selectContentTab: function(updatePrefs)
{
if (updatePrefs)
- WebInspector.applicationSettings.resourceViewTab = "content";
+ WebInspector.settings.resourceViewTab = "content";
this._innerSelectContentTab();
},
@@ -179,7 +179,7 @@ WebInspector.ResourceView.prototype = {
_selectCookiesTab: function(updatePrefs)
{
if (updatePrefs)
- WebInspector.applicationSettings.resourceViewTab = "cookies";
+ WebInspector.settings.resourceViewTab = "cookies";
this.tabbedPane.selectTabById("cookies");
this._cookiesView.resize();
},
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js
index 8125c1e..469d39a 100644
--- a/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/WebCore/inspector/front-end/ScriptsPanel.js
@@ -608,7 +608,7 @@ WebInspector.ScriptsPanel.prototype = {
var url = scriptOrResource.url || scriptOrResource.sourceURL;
if (url && !options.initialLoad)
- WebInspector.applicationSettings.lastViewedScriptFile = url;
+ WebInspector.settings.lastViewedScriptFile = url;
if (!options.fromBackForwardAction) {
var oldIndex = this._currentBackForwardIndex;
@@ -709,7 +709,7 @@ WebInspector.ScriptsPanel.prototype = {
else {
// if not first item, check to see if this was the last viewed
var url = option.representedObject.url || option.representedObject.sourceURL;
- var lastURL = WebInspector.applicationSettings.lastViewedScriptFile;
+ var lastURL = WebInspector.settings.lastViewedScriptFile;
if (url && url === lastURL)
this._showScriptOrResource(option.representedObject, {initialLoad: true});
}
diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js
index 22fa153..4fd0c83 100644
--- a/WebCore/inspector/front-end/Settings.js
+++ b/WebCore/inspector/front-end/Settings.js
@@ -64,6 +64,7 @@ WebInspector.Settings = function()
this.installApplicationSetting("lastActivePanel", "elements");
this.installProjectSetting("breakpoints", {});
+ this.installProjectSetting("nativeBreakpoints", []);
}
WebInspector.Settings.prototype = {
@@ -82,6 +83,14 @@ WebInspector.Settings.prototype = {
this.__defineSetter__(key, this._setProjectSetting.bind(this, key));
},
+ inspectedURLChanged: function(url)
+ {
+ var fragmentIndex = url.indexOf("#");
+ if (fragmentIndex !== -1)
+ url = url.substring(0, fragmentIndex);
+ this._inspectedURL = url;
+ },
+
_get: function(key, defaultValue)
{
if (key in window.localStorage) {
@@ -111,11 +120,7 @@ WebInspector.Settings.prototype = {
_formatProjectKey: function(key)
{
- var url = this._mainResourceURL;
- var fragmentIndex = url.indexOf("#");
- if (fragmentIndex !== -1)
- url = url.substring(0, fragmentIndex);
- return key + "." + url;
+ return key + ":" + this._inspectedURL;
}
}
diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js
index 944fecb..f3d4e6e 100644
--- a/WebCore/inspector/front-end/StoragePanel.js
+++ b/WebCore/inspector/front-end/StoragePanel.js
@@ -31,7 +31,7 @@ WebInspector.StoragePanel = function(database)
{
WebInspector.Panel.call(this, "storage");
- WebInspector.applicationSettings.installApplicationSetting("resourcesLastSelectedItem", {});
+ WebInspector.settings.installApplicationSetting("resourcesLastSelectedItem", {});
this.createSidebar();
this.sidebarElement.addStyleClass("outline-disclosure filter-all children small");
@@ -109,7 +109,7 @@ WebInspector.StoragePanel.prototype = {
return;
this._initializedDefaultSelection = true;
- var itemURL = WebInspector.applicationSettings.resourcesLastSelectedItem;
+ var itemURL = WebInspector.settings.resourcesLastSelectedItem;
if (itemURL) {
for (var treeElement = this.sidebarTree.children[0]; treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.sidebarTree, true)) {
if (treeElement.itemURL === itemURL) {
@@ -781,7 +781,7 @@ WebInspector.BaseStorageTreeElement.prototype = {
{
var itemURL = this.itemURL;
if (itemURL)
- WebInspector.applicationSettings.resourcesLastSelectedItem = itemURL;
+ WebInspector.settings.resourcesLastSelectedItem = itemURL;
},
onreveal: function()
@@ -813,7 +813,7 @@ WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, s
{
WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryName, iconClass, true);
this._expandedSettingKey = "resources" + settingsKey + "Expanded";
- WebInspector.applicationSettings.installApplicationSetting(this._expandedSettingKey, settingsKey === "Frames");
+ WebInspector.settings.installApplicationSetting(this._expandedSettingKey, settingsKey === "Frames");
this._categoryName = categoryName;
}
@@ -832,18 +832,18 @@ WebInspector.StorageCategoryTreeElement.prototype = {
onattach: function()
{
WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
- if (WebInspector.applicationSettings[this._expandedSettingKey])
+ if (WebInspector.settings[this._expandedSettingKey])
this.expand();
},
onexpand: function()
{
- WebInspector.applicationSettings[this._expandedSettingKey] = true;
+ WebInspector.settings[this._expandedSettingKey] = true;
},
oncollapse: function()
{
- WebInspector.applicationSettings[this._expandedSettingKey] = false;
+ WebInspector.settings[this._expandedSettingKey] = false;
}
}
WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js
index cc97520..05dcee6 100644
--- a/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -60,7 +60,7 @@ WebInspector.StylesSidebarPane = function(computedStylePane)
this.settingsSelectElement.addEventListener("click", function(event) { event.stopPropagation() }, false);
this.settingsSelectElement.addEventListener("change", this._changeSetting.bind(this), false);
- var format = WebInspector.applicationSettings.colorFormat;
+ var format = WebInspector.settings.colorFormat;
if (format === "hex")
this.settingsSelectElement[0].selected = true;
else if (format === "rgb")
@@ -465,7 +465,7 @@ WebInspector.StylesSidebarPane.prototype = {
// Select the correct color format setting again, since it needs to be selected.
var selectedIndex = 0;
for (var i = 0; i < options.length; ++i) {
- if (options[i].value === WebInspector.applicationSettings.colorFormat) {
+ if (options[i].value === WebInspector.settings.colorFormat) {
selectedIndex = i;
break;
}
@@ -477,7 +477,7 @@ WebInspector.StylesSidebarPane.prototype = {
_changeColorFormat: function(event)
{
var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex];
- WebInspector.applicationSettings.colorFormat = selectedOption.value;
+ WebInspector.settings.colorFormat = selectedOption.value;
for (var pseudoId in this.sections) {
var sections = this.sections[pseudoId];
@@ -562,15 +562,15 @@ WebInspector.ComputedStyleSidebarPane = function()
var showInheritedCheckbox = new WebInspector.Checkbox(WebInspector.UIString("Show inherited"), "sidebar-pane-subtitle");
this.titleElement.appendChild(showInheritedCheckbox.element);
- if (WebInspector.applicationSettings.showInheritedComputedStyleProperties) {
+ if (WebInspector.settings.showInheritedComputedStyleProperties) {
this.bodyElement.addStyleClass("show-inherited");
showInheritedCheckbox.checked = true;
}
function showInheritedToggleFunction(event)
{
- WebInspector.applicationSettings.showInheritedComputedStyleProperties = showInheritedCheckbox.checked;
- if (WebInspector.applicationSettings.showInheritedComputedStyleProperties)
+ WebInspector.settings.showInheritedComputedStyleProperties = showInheritedCheckbox.checked;
+ if (WebInspector.settings.showInheritedComputedStyleProperties)
this.bodyElement.addStyleClass("show-inherited");
else
this.bodyElement.removeStyleClass("show-inherited");
@@ -1200,9 +1200,9 @@ WebInspector.StylePropertyTreeElement.prototype = {
var format;
if (Preferences.showColorNicknames && color.nickname)
format = "nickname";
- else if (WebInspector.applicationSettings.colorFormat === "rgb")
+ else if (WebInspector.settings.colorFormat === "rgb")
format = (color.simple ? "rgb" : "rgba");
- else if (WebInspector.applicationSettings.colorFormat === "hsl")
+ else if (WebInspector.settings.colorFormat === "hsl")
format = (color.simple ? "hsl" : "hsla");
else if (color.simple)
format = (color.hasShortHex() ? "shorthex" : "hex");
diff --git a/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js b/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
index 11b0e03..44063a3 100644
--- a/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
+++ b/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
@@ -39,7 +39,7 @@ WebInspector.WatchExpressionsSidebarPane.prototype = {
{
this.bodyElement.removeChildren();
- this.expanded = WebInspector.applicationSettings.watchExpressions.length > 0;
+ this.expanded = WebInspector.settings.watchExpressions.length > 0;
this.section = new WebInspector.WatchExpressionsSection();
this.bodyElement.appendChild(this.section.element);
@@ -77,7 +77,7 @@ WebInspector.WatchExpressionsSection = function()
WebInspector.ObjectPropertiesSection.call(this);
- this.watchExpressions = WebInspector.applicationSettings.watchExpressions;
+ this.watchExpressions = WebInspector.settings.watchExpressions;
this.headerElement.className = "hidden";
this.editable = true;
@@ -181,7 +181,7 @@ WebInspector.WatchExpressionsSection.prototype = {
if (this.watchExpressions[i])
toSave.push(this.watchExpressions[i]);
- WebInspector.applicationSettings.watchExpressions = toSave;
+ WebInspector.settings.watchExpressions = toSave;
return toSave.length;
}
}
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index 3153842..55f427e 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -1463,6 +1463,7 @@ body.inactive .placard.selected {
}
.event-listener-breakpoints .checkbox-elem {
+ font-size: 10px;
float: left;
margin-top: 1px;
margin-left: 0px;
@@ -4129,7 +4130,7 @@ ol.breakpoint-list {
margin: 2px 0 0px 20px;
}
-.breakpoint-list .breakpoint-hit {
+.pane .breakpoint-hit {
background-color: yellow;
}
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index e178371..0ad12f5 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -179,7 +179,7 @@ var WebInspector = {
for (var panelName in WebInspector.panels) {
if (WebInspector.panels[panelName] === x) {
- WebInspector.applicationSettings.lastActivePanel = panelName;
+ WebInspector.settings.lastActivePanel = panelName;
this._panelHistory.setPanel(panelName);
}
}
@@ -504,7 +504,7 @@ WebInspector.doLoadedDone = function()
document.body.addStyleClass("port-" + port);
InspectorFrontendHost.loaded();
- WebInspector.applicationSettings = new WebInspector.Settings();
+ WebInspector.settings = new WebInspector.Settings();
this._registerShortcuts();
@@ -608,7 +608,7 @@ WebInspector.doLoadedDone = function()
function onPopulateScriptObjects()
{
if (!WebInspector.currentPanel)
- WebInspector.showPanel(WebInspector.applicationSettings.lastActivePanel);
+ WebInspector.showPanel(WebInspector.settings.lastActivePanel);
}
InspectorBackend.populateScriptObjects(onPopulateScriptObjects);
@@ -1373,6 +1373,8 @@ WebInspector.reset = function()
this.console.clearMessages();
this.extensionServer.notifyInspectorReset();
+
+ this.breakpointManager.restoreBreakpoints();
}
WebInspector.resetProfilesPanel = function()
@@ -1389,7 +1391,12 @@ WebInspector.bringToFront = function()
WebInspector.inspectedURLChanged = function(url)
{
InspectorFrontendHost.inspectedURLChanged(url);
+ this.settings.inspectedURLChanged(url);
this.extensionServer.notifyInspectedURLChanged();
+ if (!this._breakpointsRestored) {
+ this.breakpointManager.restoreBreakpoints();
+ this._breakpointsRestored = true;
+ }
}
WebInspector.didCommitLoad = function()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list