- Revision
- 121021
- Author
- [email protected]
- Date
- 2012-06-22 06:56:17 -0700 (Fri, 22 Jun 2012)
Log Message
Web Inspector: Support 'Restart frame' in inspector frontend
https://bugs.webkit.org/show_bug.cgi?id=89678
Patch by Peter Rybin <[email protected]> on 2012-06-22
Reviewed by Pavel Feldman.
Action is added to call frame placard's context menu. Context menu is now built
on a call frame level rather than on callback sidebar level.
* English.lproj/localizedStrings.js:
* inspector/front-end/CallStackSidebarPane.js:
(WebInspector.CallStackSidebarPane):
(WebInspector.CallStackSidebarPane.prototype.update):
(WebInspector.CallStackSidebarPane.Placard):
(WebInspector.CallStackSidebarPane.Placard.prototype._update):
(WebInspector.CallStackSidebarPane.Placard.prototype._placardContextMenu):
(_restartFrame):
* inspector/front-end/DebuggerModel.js:
(WebInspector.DebuggerModel.prototype.rawLocationToUILocation):
(WebInspector.DebuggerModel.prototype.callStackModified):
(WebInspector.DebuggerModel.CallFrame.prototype.restart):
* inspector/front-end/Script.js:
(WebInspector.Script.prototype.editSource):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (121020 => 121021)
--- trunk/Source/WebCore/ChangeLog 2012-06-22 13:24:31 UTC (rev 121020)
+++ trunk/Source/WebCore/ChangeLog 2012-06-22 13:56:17 UTC (rev 121021)
@@ -1,3 +1,28 @@
+2012-06-22 Peter Rybin <[email protected]>
+
+ Web Inspector: Support 'Restart frame' in inspector frontend
+ https://bugs.webkit.org/show_bug.cgi?id=89678
+
+ Reviewed by Pavel Feldman.
+
+ Action is added to call frame placard's context menu. Context menu is now built
+ on a call frame level rather than on callback sidebar level.
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/CallStackSidebarPane.js:
+ (WebInspector.CallStackSidebarPane):
+ (WebInspector.CallStackSidebarPane.prototype.update):
+ (WebInspector.CallStackSidebarPane.Placard):
+ (WebInspector.CallStackSidebarPane.Placard.prototype._update):
+ (WebInspector.CallStackSidebarPane.Placard.prototype._placardContextMenu):
+ (_restartFrame):
+ * inspector/front-end/DebuggerModel.js:
+ (WebInspector.DebuggerModel.prototype.rawLocationToUILocation):
+ (WebInspector.DebuggerModel.prototype.callStackModified):
+ (WebInspector.DebuggerModel.CallFrame.prototype.restart):
+ * inspector/front-end/Script.js:
+ (WebInspector.Script.prototype.editSource):
+
2012-06-22 Jocelyn Turcotte <[email protected]>
[Qt] Fix the remote inspector loading problems on Mac
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (121020 => 121021)
--- trunk/Source/WebCore/English.lproj/localizedStrings.js 2012-06-22 13:24:31 UTC (rev 121020)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js 2012-06-22 13:56:17 UTC (rev 121021)
@@ -543,6 +543,7 @@
localizedStrings["Object types:"] = "Object types:";
localizedStrings["%s() at %s"] = "%s() at %s";
localizedStrings["Copy Stack Trace"] = "Copy Stack Trace";
+localizedStrings["Restart Frame"] = "Restart Frame";
localizedStrings["Collect Garbage"] = "Collect Garbage";
localizedStrings["JSON"] = "JSON";
localizedStrings["Catch"] = "Catch";
Modified: trunk/Source/WebCore/inspector/front-end/CallStackSidebarPane.js (121020 => 121021)
--- trunk/Source/WebCore/inspector/front-end/CallStackSidebarPane.js 2012-06-22 13:24:31 UTC (rev 121020)
+++ trunk/Source/WebCore/inspector/front-end/CallStackSidebarPane.js 2012-06-22 13:56:17 UTC (rev 121021)
@@ -32,7 +32,6 @@
WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack"));
this._model = WebInspector.debuggerModel;
- this.bodyElement.addEventListener("contextmenu", this._contextMenu.bind(this), true);
this.bodyElement.addEventListener("keydown", this._keyDown.bind(this), true);
this.bodyElement.tabIndex = 0;
}
@@ -53,7 +52,7 @@
for (var i = 0; i < callFrames.length; ++i) {
var callFrame = callFrames[i];
- var placard = new WebInspector.CallStackSidebarPane.Placard(callFrame);
+ var placard = new WebInspector.CallStackSidebarPane.Placard(callFrame, this);
placard.element.addEventListener("click", this._placardSelected.bind(this, placard), false);
this.placards.push(placard);
this.bodyElement.appendChild(placard.element);
@@ -108,16 +107,6 @@
this._model.setSelectedCallFrame(placard._callFrame);
},
- _contextMenu: function(event)
- {
- if (!this.placards.length)
- return;
-
- var contextMenu = new WebInspector.ContextMenu();
- contextMenu.appendItem(WebInspector.UIString("Copy Stack Trace"), this._copyStackTrace.bind(this));
- contextMenu.show(event);
- },
-
_copyStackTrace: function()
{
var text = "";
@@ -175,18 +164,39 @@
* @constructor
* @extends {WebInspector.Placard}
* @param {WebInspector.DebuggerModel.CallFrame} callFrame
+ * @param {WebInspector.CallStackSidebarPane} pane
*/
-WebInspector.CallStackSidebarPane.Placard = function(callFrame)
+WebInspector.CallStackSidebarPane.Placard = function(callFrame, pane)
{
WebInspector.Placard.call(this, callFrame.functionName || WebInspector.UIString("(anonymous function)"), "");
callFrame.createLiveLocation(this._update.bind(this));
+ this.element.addEventListener("contextmenu", this._placardContextMenu.bind(this), true);
this._callFrame = callFrame;
+ this._pane = pane;
}
WebInspector.CallStackSidebarPane.Placard.prototype = {
_update: function(uiLocation)
{
this.subtitle = WebInspector.displayNameForURL(uiLocation.uiSourceCode.url) + ":" + (uiLocation.lineNumber + 1);
+ },
+
+ _placardContextMenu: function(event)
+ {
+ var contextMenu = new WebInspector.ContextMenu();
+
+ if (WebInspector.debuggerModel.canSetScriptSource()) {
+ contextMenu.appendItem(WebInspector.UIString("Restart Frame"), this._restartFrame.bind(this));
+ contextMenu.appendSeparator();
+ }
+ contextMenu.appendItem(WebInspector.UIString("Copy Stack Trace"), this._pane._copyStackTrace.bind(this._pane));
+
+ contextMenu.show(event);
+ },
+
+ _restartFrame: function()
+ {
+ this._callFrame.restart(undefined);
}
}
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerModel.js (121020 => 121021)
--- trunk/Source/WebCore/inspector/front-end/DebuggerModel.js 2012-06-22 13:24:31 UTC (rev 121020)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerModel.js 2012-06-22 13:56:17 UTC (rev 121021)
@@ -541,6 +541,24 @@
if (!script)
return null;
return script.rawLocationToUILocation(rawLocation.lineNumber, rawLocation.columnNumber);
+ },
+
+ /**
+ * Handles notification from _javascript_ VM about updated stack (liveedit or frame restart action).
+ * @this {WebInspector.DebuggerModel}
+ * @param {Array.<DebuggerAgent.CallFrame>=} newCallFrames
+ * @param {Object=} details
+ */
+ callStackModified: function(newCallFrames, details)
+ {
+ // FIXME: declare this property in protocol and in _javascript_.
+ if (details && details["stack_update_needs_step_in"])
+ DebuggerAgent.stepInto();
+ else {
+ if (newCallFrames && newCallFrames.length)
+ this._pausedScript(newCallFrames, this._debuggerPausedDetails.reason, this._debuggerPausedDetails.auxData);
+
+ }
}
}
@@ -710,6 +728,27 @@
},
/**
+ * @param {function(?Protocol.Error=)=} callback
+ */
+ restart: function(callback)
+ {
+ /**
+ * @this {WebInspector.DebuggerModel.CallFrame}
+ * @param {?Protocol.Error} error
+ * @param {Array.<DebuggerAgent.CallFrame>=} callFrames
+ * @param {Object=} details
+ */
+ function protocolCallback(error, callFrames, details)
+ {
+ if (!error)
+ WebInspector.debuggerModel.callStackModified(callFrames, details);
+ if (callback)
+ callback(error);
+ }
+ DebuggerAgent.restartFrame(this._payload.callFrameId, protocolCallback);
+ },
+
+ /**
* @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate
*/
createLiveLocation: function(updateDelegate)
Modified: trunk/Source/WebCore/inspector/front-end/Script.js (121020 => 121021)
--- trunk/Source/WebCore/inspector/front-end/Script.js 2012-06-22 13:24:31 UTC (rev 121020)
+++ trunk/Source/WebCore/inspector/front-end/Script.js 2012-06-22 13:56:17 UTC (rev 121021)
@@ -138,6 +138,7 @@
*/
function didEditScriptSource(error, callFrames, debugData)
{
+ // FIXME: support debugData.stack_update_needs_step_in flag by calling WebInspector.debugger_model.callStackModified
if (!error)
this._source = newSource;
callback(error, callFrames);