[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 14:22:42 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 7ba637cc29ab01a7d461a556319dc0998cdc7841
Author: podivilov at chromium.org <podivilov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 7 12:42:52 2010 +0000
2010-10-07 Pavel Podivilov <podivilov at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: highlight XHR breakpoint when hit.
https://bugs.webkit.org/show_bug.cgi?id=47253
* inspector/InspectorController.cpp:
(WebCore::InspectorController::didCommitLoad):
(WebCore::InspectorController::setNativeBreakpoint):
(WebCore::InspectorController::removeNativeBreakpoint):
(WebCore::InspectorController::findEventListenerBreakpoint):
(WebCore::InspectorController::findXHRBreakpoint):
* inspector/InspectorController.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::instrumentWillDispatchEventImpl):
(WebCore::InspectorInstrumentation::instrumentWillSendXMLHttpRequestImpl):
* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager.prototype.createEventListenerBreakpoint):
(WebInspector.BreakpointManager.prototype.createXHRBreakpoint):
(WebInspector.BreakpointManager.prototype._xhrBreakpointRemoved):
(WebInspector.BreakpointManager.prototype._removeNativeBreakpoint):
(WebInspector.BreakpointManager.prototype._setNativeBreakpointEnabled):
(WebInspector.BreakpointManager.prototype._setNativeBreakpointOnBackend.didSetNativeBreakpoint):
(WebInspector.BreakpointManager.prototype._setNativeBreakpointOnBackend):
(WebInspector.BreakpointManager.prototype._removeNativeBreakpointFromBackend):
(WebInspector.BreakpointManager.prototype.debuggerPaused):
(WebInspector.BreakpointManager.prototype.debuggerResumed):
(WebInspector.NativeBreakpoint):
(WebInspector.NativeBreakpoint.prototype.get enabled):
(WebInspector.NativeBreakpoint.prototype.set enabled):
(WebInspector.NativeBreakpoint.prototype.remove):
* inspector/front-end/BreakpointsSidebarPane.js:
(WebInspector.BreakpointItem):
(WebInspector.BreakpointItem.prototype._breakpointClicked):
(WebInspector.BreakpointItem.prototype._hitStateChanged):
* inspector/front-end/CallStackSidebarPane.js:
(WebInspector.CallStackSidebarPane.prototype.updateStatus):
* inspector/front-end/inspector.css:
(.breakpoint-list .breakpoint-hit):
* inspector/front-end/inspector.js:
(WebInspector.pausedScript):
(WebInspector.resumedScript):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8bf55aa..5c09d92 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,47 @@
+2010-10-07 Pavel Podivilov <podivilov at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: highlight XHR breakpoint when hit.
+ https://bugs.webkit.org/show_bug.cgi?id=47253
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::didCommitLoad):
+ (WebCore::InspectorController::setNativeBreakpoint):
+ (WebCore::InspectorController::removeNativeBreakpoint):
+ (WebCore::InspectorController::findEventListenerBreakpoint):
+ (WebCore::InspectorController::findXHRBreakpoint):
+ * inspector/InspectorController.h:
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::instrumentWillDispatchEventImpl):
+ (WebCore::InspectorInstrumentation::instrumentWillSendXMLHttpRequestImpl):
+ * inspector/front-end/BreakpointManager.js:
+ (WebInspector.BreakpointManager.prototype.createEventListenerBreakpoint):
+ (WebInspector.BreakpointManager.prototype.createXHRBreakpoint):
+ (WebInspector.BreakpointManager.prototype._xhrBreakpointRemoved):
+ (WebInspector.BreakpointManager.prototype._removeNativeBreakpoint):
+ (WebInspector.BreakpointManager.prototype._setNativeBreakpointEnabled):
+ (WebInspector.BreakpointManager.prototype._setNativeBreakpointOnBackend.didSetNativeBreakpoint):
+ (WebInspector.BreakpointManager.prototype._setNativeBreakpointOnBackend):
+ (WebInspector.BreakpointManager.prototype._removeNativeBreakpointFromBackend):
+ (WebInspector.BreakpointManager.prototype.debuggerPaused):
+ (WebInspector.BreakpointManager.prototype.debuggerResumed):
+ (WebInspector.NativeBreakpoint):
+ (WebInspector.NativeBreakpoint.prototype.get enabled):
+ (WebInspector.NativeBreakpoint.prototype.set enabled):
+ (WebInspector.NativeBreakpoint.prototype.remove):
+ * inspector/front-end/BreakpointsSidebarPane.js:
+ (WebInspector.BreakpointItem):
+ (WebInspector.BreakpointItem.prototype._breakpointClicked):
+ (WebInspector.BreakpointItem.prototype._hitStateChanged):
+ * inspector/front-end/CallStackSidebarPane.js:
+ (WebInspector.CallStackSidebarPane.prototype.updateStatus):
+ * inspector/front-end/inspector.css:
+ (.breakpoint-list .breakpoint-hit):
+ * inspector/front-end/inspector.js:
+ (WebInspector.pausedScript):
+ (WebInspector.resumedScript):
+
2010-10-07 Carlos Garcia Campos <cgarcia at igalia.com>
Reviewed by Xan Lopez.
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 5d93a50..1b66851 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -788,7 +788,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
m_nativeBreakpoints.clear();
m_eventListenerBreakpoints.clear();
- m_eventNameToBreakpointCount.clear();
+ m_eventNameToBreakpointId.clear();
m_XHRBreakpoints.clear();
m_lastBreakpointId = 0;
#endif
@@ -1699,14 +1699,12 @@ void InspectorController::setNativeBreakpoint(PassRefPtr<InspectorObject> breakp
String eventName;
if (!condition->getString("eventName", &eventName))
return;
+ if (m_eventNameToBreakpointId.contains(eventName))
+ return;
*breakpointId = ++m_lastBreakpointId;
m_nativeBreakpoints.set(*breakpointId, "EventListener");
m_eventListenerBreakpoints.set(*breakpointId, eventName);
- HashMap<String, unsigned int>::iterator it = m_eventNameToBreakpointCount.find(eventName);
- if (it == m_eventNameToBreakpointCount.end())
- m_eventNameToBreakpointCount.set(eventName, 1);
- else
- it->second += 1;
+ m_eventNameToBreakpointId.set(eventName, *breakpointId);
}
}
@@ -1717,25 +1715,22 @@ void InspectorController::removeNativeBreakpoint(unsigned int breakpointId)
m_XHRBreakpoints.remove(breakpointId);
else if (type == eventListenerNativeBreakpointType) {
String eventName = m_eventListenerBreakpoints.take(breakpointId);
- HashMap<String, unsigned int>::iterator it = m_eventNameToBreakpointCount.find(eventName);
- it->second -= 1;
- if (!it->second)
- m_eventNameToBreakpointCount.remove(it);
+ m_eventNameToBreakpointId.remove(eventName);
}
}
-bool InspectorController::shouldBreakOnEvent(const String& eventName)
+unsigned int InspectorController::findEventListenerBreakpoint(const String& eventName)
{
- return m_eventNameToBreakpointCount.contains(eventName);
+ return m_eventNameToBreakpointId.get(eventName);
}
-bool InspectorController::shouldBreakOnXMLHttpRequest(const String& url)
+unsigned int InspectorController::findXHRBreakpoint(const String& url)
{
for (HashMap<unsigned int, String>::iterator it = m_XHRBreakpoints.begin(); it != m_XHRBreakpoints.end(); ++it) {
if (url.contains(it->second))
- return true;
+ return it->first;
}
- return false;
+ return 0;
}
#endif
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 5e6c7de..0c2885e 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -300,8 +300,8 @@ private:
void toggleRecordButton(bool);
void enableDebuggerFromFrontend(bool always);
- bool shouldBreakOnEvent(const String& eventName);
- bool shouldBreakOnXMLHttpRequest(const String&);
+ unsigned int findEventListenerBreakpoint(const String& eventName);
+ unsigned int findXHRBreakpoint(const String&);
#endif
#if ENABLE(DATABASE)
void selectDatabase(Database* database);
@@ -393,7 +393,7 @@ private:
HashMap<unsigned int, String> m_nativeBreakpoints;
HashMap<unsigned int, String> m_eventListenerBreakpoints;
- HashMap<String, unsigned int> m_eventNameToBreakpointCount;
+ HashMap<String, unsigned int> m_eventNameToBreakpointId;
HashMap<unsigned int, String> m_XHRBreakpoints;
unsigned int m_lastBreakpointId;
diff --git a/WebCore/inspector/InspectorInstrumentation.cpp b/WebCore/inspector/InspectorInstrumentation.cpp
index e744c5e..752f1ed 100644
--- a/WebCore/inspector/InspectorInstrumentation.cpp
+++ b/WebCore/inspector/InspectorInstrumentation.cpp
@@ -139,10 +139,12 @@ void InspectorInstrumentation::willSendXMLHttpRequestImpl(InspectorController* i
if (!debuggerAgent)
return;
- if (!inspectorController->shouldBreakOnXMLHttpRequest(url))
+ unsigned int breakpointId = inspectorController->findXHRBreakpoint(url);
+ if (!breakpointId)
return;
RefPtr<InspectorObject> eventData = InspectorObject::create();
+ eventData->setNumber("breakpointId", breakpointId);
eventData->setString("type", "XHR");
eventData->setString("url", url);
debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData);
@@ -203,8 +205,10 @@ InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(I
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get()) {
- if (inspectorController->shouldBreakOnEvent(event.type())) {
+ unsigned int breakpointId = inspectorController->findEventListenerBreakpoint(event.type());
+ if (breakpointId) {
RefPtr<InspectorObject> eventData = InspectorObject::create();
+ eventData->setNumber("breakpointId", breakpointId);
eventData->setString("type", "EventListener");
eventData->setString("eventName", event.type());
debuggerAgent->schedulePauseOnNextStatement(NativeBreakpointDebuggerEventType, eventData);
diff --git a/WebCore/inspector/front-end/BreakpointManager.js b/WebCore/inspector/front-end/BreakpointManager.js
index bdc508a..e12c8a7 100644
--- a/WebCore/inspector/front-end/BreakpointManager.js
+++ b/WebCore/inspector/front-end/BreakpointManager.js
@@ -30,6 +30,12 @@ WebInspector.BreakpointManager = function()
this._xhrBreakpoints = {};
}
+WebInspector.BreakpointManager.DebuggerEventType = {
+ JavaScriptPause: 0,
+ DOMBreakpoint: 1,
+ NativeBreakpoint: 2
+};
+
WebInspector.BreakpointManager.prototype = {
setOneTimeBreakpoint: function(sourceID, line)
{
@@ -131,7 +137,7 @@ WebInspector.BreakpointManager.prototype = {
createEventListenerBreakpoint: function(eventName)
{
var data = { type: "EventListener", condition: { eventName: eventName } };
- var breakpoint = new WebInspector.NativeBreakpoint(data, false);
+ var breakpoint = new WebInspector.NativeBreakpoint(data, this);
breakpoint.label = eventName;
return breakpoint;
},
@@ -143,7 +149,7 @@ WebInspector.BreakpointManager.prototype = {
this._xhrBreakpoints[url] = true;
var data = { type: "XHR", condition: { url: url } };
- var breakpoint = new WebInspector.NativeBreakpoint(data, true);
+ var breakpoint = new WebInspector.NativeBreakpoint(data, this);
if (!url.length)
breakpoint.label = WebInspector.UIString("Any XHR");
else
@@ -158,11 +164,79 @@ WebInspector.BreakpointManager.prototype = {
breakpoint.addEventListener("removed", this._xhrBreakpointRemoved.bind(this, url));
this.dispatchEventToListeners("xhr-breakpoint-added", breakpoint);
+
+ breakpoint.enabled = true;
},
_xhrBreakpointRemoved: function(url)
{
delete this._xhrBreakpoints[url];
+ },
+
+ _removeNativeBreakpoint: function(breakpoint)
+ {
+ if (breakpoint._beingSetOnBackend)
+ return;
+ if (breakpoint.enabled)
+ this._removeNativeBreakpointFromBackend(breakpoint);
+ 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;
+ InspectorBackend.setNativeBreakpoint(breakpoint._data, didSetNativeBreakpoint.bind(this));
+
+ function didSetNativeBreakpoint(backendBreakpointId)
+ {
+ breakpoint._beingSetOnBackend = false;
+ if (backendBreakpointId !== 0) {
+ 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.BreakpointManager.DebuggerEventType.NativeBreakpoint)
+ return;
+ var breakpoint = this._breakpoints[details.eventData.breakpointId];
+ if (breakpoint) {
+ breakpoint.hit = true;
+ breakpoint.dispatchEventToListeners("hit-state-changed");
+ this._lastHitBreakpoint = breakpoint;
+ }
+ },
+
+ debuggerResumed: function()
+ {
+ if (!this._lastHitBreakpoint)
+ return;
+ this._lastHitBreakpoint.hit = false;
+ this._lastHitBreakpoint.dispatchEventToListeners("hit-state-changed");
+ delete this._lastHitBreakpoint;
}
}
@@ -248,59 +322,26 @@ WebInspector.Breakpoint.prototype = {
WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype;
-WebInspector.NativeBreakpoint = function(data, enabled)
+WebInspector.NativeBreakpoint = function(data, manager)
{
this._data = data;
- this._locked = false;
- this.enabled = enabled;
+ this._manager = manager;
}
WebInspector.NativeBreakpoint.prototype = {
get enabled()
{
- return "_id" in this;
+ return "_backendId" in this;
},
set enabled(enabled)
{
- if (this._locked)
- return;
- if (this.enabled === enabled)
- return;
- if (enabled)
- this._setOnBackend();
- else
- this._removeFromBackend();
+ this._manager._setNativeBreakpointEnabled(this, enabled);
},
remove: function()
{
- if (this._locked)
- return;
- if (this.enabled)
- this._removeFromBackend();
- this.dispatchEventToListeners("removed");
- },
-
- _setOnBackend: function()
- {
- this._locked = true;
- InspectorBackend.setNativeBreakpoint(this._data, didSet.bind(this));
-
- function didSet(breakpointId)
- {
- this._locked = false;
- if (breakpointId)
- this._id = breakpointId;
- this.dispatchEventToListeners("enable-changed");
- }
- },
-
- _removeFromBackend: function()
- {
- InspectorBackend.removeNativeBreakpoint(this._id);
- delete this._id;
- this.dispatchEventToListeners("enable-changed");
+ this._manager._removeNativeBreakpoint(this);
}
}
diff --git a/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
index 34d403f..fbf773d 100644
--- a/WebCore/inspector/front-end/BreakpointsSidebarPane.js
+++ b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
@@ -149,6 +149,7 @@ WebInspector.BreakpointItem = function(breakpoint)
this._element.appendChild(document.createTextNode(this._breakpoint.label));
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"));
}
@@ -168,6 +169,10 @@ WebInspector.BreakpointItem.prototype = {
this._breakpoint.remove();
},
+ _breakpointClicked: function(event)
+ {
+ },
+
_checkboxClicked: function(event)
{
this._breakpoint.enabled = !this._breakpoint.enabled;
@@ -182,8 +187,12 @@ WebInspector.BreakpointItem.prototype = {
checkbox.checked = this._breakpoint.enabled;
},
- _breakpointClicked: function(event)
+ _hitStateChanged: function(event)
{
+ if (event.target.hit)
+ this._element.addStyleClass("breakpoint-hit");
+ else
+ this._element.removeStyleClass("breakpoint-hit");
}
}
diff --git a/WebCore/inspector/front-end/CallStackSidebarPane.js b/WebCore/inspector/front-end/CallStackSidebarPane.js
index a0e5e3b..e1d342b 100644
--- a/WebCore/inspector/front-end/CallStackSidebarPane.js
+++ b/WebCore/inspector/front-end/CallStackSidebarPane.js
@@ -28,12 +28,6 @@ WebInspector.CallStackSidebarPane = function()
WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack"));
}
-WebInspector.CallStackSidebarPane.DebuggerEventType = {
- JavaScriptPause: 0,
- DOMBreakpoint: 1,
- NativeBreakpoint: 2
-};
-
WebInspector.CallStackSidebarPane.prototype = {
update: function(callFrames, sourceIDMap)
{
@@ -91,7 +85,7 @@ WebInspector.CallStackSidebarPane.prototype = {
updateStatus: function(eventType, eventData)
{
var statusElement = document.createElement("div");
- if (eventType === WebInspector.CallStackSidebarPane.DebuggerEventType.DOMBreakpoint) {
+ if (eventType === WebInspector.BreakpointManager.DebuggerEventType.DOMBreakpoint) {
var breakpoint = eventData.breakpoint;
var substitutions = [WebInspector.DOMBreakpoint.labelForType(breakpoint.type), WebInspector.panels.elements.linkifyNodeById(breakpoint.nodeId)];
var formatters = {
@@ -117,9 +111,12 @@ WebInspector.CallStackSidebarPane.prototype = {
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);
- } else if (eventType === WebInspector.CallStackSidebarPane.DebuggerEventType.NativeBreakpoint && eventData.type === "XHR")
- statusElement.appendChild(document.createTextNode(WebInspector.UIString("Paused on XMLHttpRequest.")));
- else
+ } else if (eventType === WebInspector.BreakpointManager.DebuggerEventType.NativeBreakpoint) {
+ if (eventData.type === "XHR")
+ statusElement.appendChild(document.createTextNode(WebInspector.UIString("Paused on a XMLHttpRequest.")));
+ else if (eventData.type === "EventListener")
+ statusElement.appendChild(document.createTextNode(WebInspector.UIString("Paused on a \"%s\" Event Listener.", eventData.eventName)));
+ } else
return;
statusElement.className = "info";
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index e734691..8309f52 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -4023,6 +4023,10 @@ ol.breakpoint-list {
margin: 2px 0 0px 20px;
}
+.breakpoint-list .breakpoint-hit {
+ background-color: yellow;
+}
+
.webkit-html-js-node, .webkit-html-css-node {
white-space: pre;
}
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index b9d09cd..5ab4b32 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1447,11 +1447,13 @@ WebInspector.failedToParseScriptSource = function(sourceURL, source, startingLin
WebInspector.pausedScript = function(details)
{
this.panels.scripts.debuggerPaused(details);
+ this.breakpointManager.debuggerPaused(details);
InspectorFrontendHost.bringToFront();
}
WebInspector.resumedScript = function()
{
+ this.breakpointManager.debuggerResumed();
this.panels.scripts.debuggerResumed();
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list