Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Unified Diff: sky/engine/bindings/core/v8/DebuggerScript.js

Issue 743673002: Fix debugger crash in Sky (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/engine/core/inspector/JavaScriptCallFrame.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/bindings/core/v8/DebuggerScript.js
diff --git a/sky/engine/bindings/core/v8/DebuggerScript.js b/sky/engine/bindings/core/v8/DebuggerScript.js
index 695586874c2434e848972ee71d7c81babf9ba90e..b5516026f0da9b98d9e615e6ec375ac74db61890 100644
--- a/sky/engine/bindings/core/v8/DebuggerScript.js
+++ b/sky/engine/bindings/core/v8/DebuggerScript.js
@@ -77,10 +77,13 @@ DebuggerScript.getFunctionScopes = function(fun)
var result = [];
for (var i = 0; i < count; i++) {
var scopeDetails = mirror.scope(i).details();
- result[i] = {
+ var scopeObject = DebuggerScript._buildScopeObject(scopeDetails.type(), scopeDetails.object());
+ if (!scopeObject)
+ continue;
+ result.push({
type: scopeDetails.type(),
- object: DebuggerScript._buildScopeObject(scopeDetails.type(), scopeDetails.object())
- };
+ object: scopeObject
+ });
}
return result;
}
@@ -382,13 +385,27 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame, sc
{
if (!scopeChain) {
scopeChain = [];
- for (var i = 0; i < scopeObjects.length; ++i)
- scopeChain.push(DebuggerScript._buildScopeObject(scopeTypes[i], scopeObjects[i]));
+ for (var i = 0, j = 0; i < scopeObjects.length; ++i) {
+ var scopeObject = DebuggerScript._buildScopeObject(scopeTypes[i], scopeObjects[i]);
+ if (scopeObject) {
+ scopeTypes[j] = scopeTypes[i];
+ scopeChain[j] = scopeObject;
+ ++j;
+ }
+ }
+ scopeTypes.length = scopeChain.length;
scopeObjects = null; // Free for GC.
}
return scopeChain;
}
+ function lazyScopeTypes()
+ {
+ if (!scopeChain)
+ lazyScopeChain();
+ return scopeTypes;
+ }
+
function ensureFuncMirror()
{
if (!funcMirror) {
@@ -490,7 +507,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame, sc
"functionName": functionName,
"thisObject": thisObject,
"scopeChain": lazyScopeChain,
- "scopeType": scopeTypes,
+ "scopeType": lazyScopeTypes,
"evaluate": evaluate,
"caller": callerFrame,
"restart": restart,
« no previous file with comments | « no previous file | sky/engine/core/inspector/JavaScriptCallFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698