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

Unified Diff: src/inspector/debugger-script.js

Issue 2415073003: [debug] [reland] Consistently use script from FrameMirror (Closed)
Patch Set: address comments and minor other fixes Created 4 years, 2 months 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 | « src/debug/mirrors.js ('k') | src/inspector/debugger_script_externs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/debugger-script.js
diff --git a/src/inspector/debugger-script.js b/src/inspector/debugger-script.js
index 98910d69df7167d0bb7e1ff8b9cd5b777cf6ec23..deb875f79f410693be257070ba9674897f546394 100644
--- a/src/inspector/debugger-script.js
+++ b/src/inspector/debugger-script.js
@@ -416,6 +416,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
var frameDetails = frameMirror.details();
var funcObject = frameDetails.func();
+ var scriptObject = frameDetails.script();
var sourcePosition = frameDetails.sourcePosition();
var thisObject = frameDetails.receiver();
@@ -448,6 +449,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
// Calculated lazily.
var scopeChain;
var funcMirror;
+ var scriptMirror;
var location;
/** @type {!Array<?RawLocation>} */
var scopeStartLocations;
@@ -516,7 +518,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
{
if (!details) {
var scopeObjects = ensureScopeChain();
- var script = ensureFuncMirror().script();
+ var script = ensureScriptMirror();
/** @type {!Array<Scope>} */
var scopes = [];
for (var i = 0; i < scopeObjects.length; ++i) {
@@ -570,14 +572,24 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
}
/**
+ * @return {!ScriptMirror}
+ */
+ function ensureScriptMirror()
+ {
+ if (!scriptMirror) {
+ scriptMirror = MakeMirror(scriptObject);
+ }
+ return /** @type {!ScriptMirror} */(scriptMirror);
+ }
+
+ /**
* @return {!{line: number, column: number}}
*/
function ensureLocation()
{
if (!location) {
- var script = ensureFuncMirror().script();
- if (script)
- location = script.locationFromPosition(sourcePosition, true);
+ var script = ensureScriptMirror();
+ location = script.locationFromPosition(sourcePosition, true);
if (!location)
location = { line: 0, column: 0 };
}
@@ -616,12 +628,12 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
}
/**
- * @return {number|undefined}
+ * @return {number}
*/
function sourceID()
{
- var script = ensureFuncMirror().script();
- return script && script.id();
+ var script = ensureScriptMirror();
+ return script.id();
}
/**
« no previous file with comments | « src/debug/mirrors.js ('k') | src/inspector/debugger_script_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698