Commit 3d16060a authored by timothy@apple.com's avatar timothy@apple.com

Fixes a crash when stepping out in the Inspector's debugger.

http://bugs.webkit.org/show_bug.cgi?id=19037

Reviewed by Dan Bernstein.

* page/InspectorController.cpp:
(WebCore::currentCallFrame): Adds a null check of currentCallFrame,
since it can be null. Also returns JSNull to better signify this.
* page/inspector/ScriptsPanel.js: Updates the debugger interface
when stepping so the currentCallFrame isn't accessed when not paused.
Adds a _clearInterface function to remove duplicate code.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33425 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1d49bcc3
2008-05-13 Timothy Hatcher <timothy@apple.com>
Fixes a crash when stepping out in the Inspector's debugger.
http://bugs.webkit.org/show_bug.cgi?id=19037
Reviewed by Dan Bernstein.
* page/InspectorController.cpp:
(WebCore::currentCallFrame): Adds a null check of currentCallFrame,
since it can be null. Also returns JSNull to better signify this.
* page/inspector/ScriptsPanel.js: Updates the debugger interface
when stepping so the currentCallFrame isn't accessed when not paused.
Adds a _clearInterface function to remove duplicate code.
2008-05-13 chris fleizach <cfleizach@apple.com> 2008-05-13 chris fleizach <cfleizach@apple.com>
Reviewed by Beth Dakin Reviewed by Beth Dakin
...@@ -828,8 +828,8 @@ static JSValueRef currentCallFrame(JSContextRef ctx, JSObjectRef /*function*/, J ...@@ -828,8 +828,8 @@ static JSValueRef currentCallFrame(JSContextRef ctx, JSObjectRef /*function*/, J
return JSValueMakeUndefined(ctx); return JSValueMakeUndefined(ctx);
JavaScriptCallFrame* callFrame = controller->currentCallFrame(); JavaScriptCallFrame* callFrame = controller->currentCallFrame();
if (!callFrame->isValid()) if (!callFrame || !callFrame->isValid())
return JSValueMakeUndefined(ctx); return JSValueMakeNull(ctx);
ExecState* globalExec = callFrame->execState()->lexicalGlobalObject()->globalExec(); ExecState* globalExec = callFrame->execState()->lexicalGlobalObject()->globalExec();
......
...@@ -288,18 +288,13 @@ WebInspector.ScriptsPanel.prototype = { ...@@ -288,18 +288,13 @@ WebInspector.ScriptsPanel.prototype = {
{ {
this.visibleView = null; this.visibleView = null;
this._clearCurrentExecutionLine();
if (!InspectorController.debuggerAttached()) { if (!InspectorController.debuggerAttached()) {
this._paused = false; this._paused = false;
this._waitingToPause = false; this._waitingToPause = false;
this._stepping = false; this._stepping = false;
} }
this.sidebarPanes.callstack.update(null); this._clearInterface();
this.sidebarPanes.scopechain.update(null);
this._updateDebuggerButtons();
this.filesSelectElement.removeChildren(); this.filesSelectElement.removeChildren();
this.functionsSelectElement.removeChildren(); this.functionsSelectElement.removeChildren();
...@@ -564,12 +559,23 @@ WebInspector.ScriptsPanel.prototype = { ...@@ -564,12 +559,23 @@ WebInspector.ScriptsPanel.prototype = {
} }
}, },
_clearInterface: function()
{
this.sidebarPanes.callstack.update(null);
this.sidebarPanes.scopechain.update(null);
this._clearCurrentExecutionLine();
this._updateDebuggerButtons();
},
_toggleDebugging: function() _toggleDebugging: function()
{ {
this._paused = false; this._paused = false;
this._waitingToPause = false; this._waitingToPause = false;
this._stepping = false; this._stepping = false;
this._clearInterface();
if (InspectorController.debuggerAttached()) { if (InspectorController.debuggerAttached()) {
this.element.appendChild(this.attachOverlayElement); this.element.appendChild(this.attachOverlayElement);
InspectorController.stopDebugging(); InspectorController.stopDebugging();
...@@ -577,12 +583,6 @@ WebInspector.ScriptsPanel.prototype = { ...@@ -577,12 +583,6 @@ WebInspector.ScriptsPanel.prototype = {
this.attachOverlayElement.parentNode.removeChild(this.attachOverlayElement); this.attachOverlayElement.parentNode.removeChild(this.attachOverlayElement);
InspectorController.startDebuggingAndReloadInspectedPage(); InspectorController.startDebuggingAndReloadInspectedPage();
} }
this.sidebarPanes.callstack.update(null);
this.sidebarPanes.scopechain.update(null);
this._clearCurrentExecutionLine();
this._updateDebuggerButtons();
}, },
_togglePause: function() _togglePause: function()
...@@ -597,11 +597,7 @@ WebInspector.ScriptsPanel.prototype = { ...@@ -597,11 +597,7 @@ WebInspector.ScriptsPanel.prototype = {
InspectorController.pauseInDebugger(); InspectorController.pauseInDebugger();
} }
this.sidebarPanes.callstack.update(null); this._clearInterface();
this.sidebarPanes.scopechain.update(null);
this._clearCurrentExecutionLine();
this._updateDebuggerButtons();
}, },
_stepOverClicked: function() _stepOverClicked: function()
...@@ -609,6 +605,8 @@ WebInspector.ScriptsPanel.prototype = { ...@@ -609,6 +605,8 @@ WebInspector.ScriptsPanel.prototype = {
this._paused = false; this._paused = false;
this._stepping = true; this._stepping = true;
this._clearInterface();
InspectorController.stepOverStatementInDebugger(); InspectorController.stepOverStatementInDebugger();
}, },
...@@ -617,6 +615,8 @@ WebInspector.ScriptsPanel.prototype = { ...@@ -617,6 +615,8 @@ WebInspector.ScriptsPanel.prototype = {
this._paused = false; this._paused = false;
this._stepping = true; this._stepping = true;
this._clearInterface();
InspectorController.stepIntoStatementInDebugger(); InspectorController.stepIntoStatementInDebugger();
}, },
...@@ -625,6 +625,8 @@ WebInspector.ScriptsPanel.prototype = { ...@@ -625,6 +625,8 @@ WebInspector.ScriptsPanel.prototype = {
this._paused = false; this._paused = false;
this._stepping = true; this._stepping = true;
this._clearInterface();
InspectorController.stepOutOfFunctionInDebugger(); InspectorController.stepOutOfFunctionInDebugger();
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment