Index: third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js |
diff --git a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js |
index 85d214e06efad6011204e3e9974bf4fca7dea040..c6d0ae0d86c40fb8ff19b5f6f718374e5dde8765 100644 |
--- a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js |
+++ b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js |
@@ -395,9 +395,6 @@ DebuggerScript.getBreakpointNumbers = function(eventData) |
return numbers; |
} |
-// NOTE: This function is performance critical, as it can be run on every |
-// statement that generates an async event (like addEventListener) to support |
-// asynchronous call stacks. Thus, when possible, initialize the data lazily. |
/** |
* @param {!FrameMirror} frameMirror |
* @return {!JavaScriptCallFrame} |
@@ -666,36 +663,13 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror) |
*/ |
DebuggerScript._buildScopeObject = function(scopeType, scopeObject) |
{ |
- var result; |
- switch (scopeType) { |
- case ScopeType.Local: |
- case ScopeType.Closure: |
- case ScopeType.Catch: |
- case ScopeType.Block: |
- case ScopeType.Script: |
- // For transient objects we create a "persistent" copy that contains |
- // the same properties. |
- // Reset scope object prototype to null so that the proto properties |
- // don't appear in the local scope section. |
- var properties = /** @type {!ObjectMirror} */(MakeMirror(scopeObject, true /* transient */)).properties(); |
- // Almost always Script scope will be empty, so just filter out that noise. |
- // Also drop empty Block scopes, should we get any. |
- if (!properties.length && (scopeType === ScopeType.Script || scopeType === ScopeType.Block)) |
- break; |
- result = { __proto__: null }; |
- for (var j = 0; j < properties.length; j++) { |
- var name = properties[j].name(); |
- if (name.length === 0 || name.charAt(0) === ".") |
- continue; // Skip internal variables like ".arguments" and variables with empty name |
- result[name] = properties[j].value_; |
- } |
- break; |
- case ScopeType.Global: |
- case ScopeType.With: |
- result = scopeObject; |
- break; |
+ // Almost always Script scope will be empty, so just filter out that noise. |
+ // Also drop empty Block scopes, should we get any. |
+ if (scopeType === ScopeType.Script || scopeType === ScopeType.Block) { |
+ if (Object.getOwnPropertyNames(scopeObject).length === 0) |
+ return undefined; |
} |
- return result; |
+ return scopeObject; |
} |
// We never resolve Mirror by its handle so to avoid memory leaks caused by Mirrors in the cache we disable it. |