@@ -274,7 +274,7 @@ function createRepl(inspector) {
274274 }
275275
276276 function isCurrentScript ( script ) {
277- return getCurrentLocation ( ) . scriptId === script . scriptId ;
277+ return selectedFrame && getCurrentLocation ( ) . scriptId === script . scriptId ;
278278 }
279279
280280 function formatScripts ( displayNatives = false ) {
@@ -354,6 +354,12 @@ function createRepl(inspector) {
354354 }
355355 }
356356
357+ function getSourceSnippet ( location , delta = 5 ) {
358+ const { scriptId } = location ;
359+ return Debugger . getScriptSource ( { scriptId } )
360+ . then ( ( { scriptSource } ) => new SourceSnippet ( location , delta , scriptSource ) ) ;
361+ }
362+
357363 class CallFrame {
358364 constructor ( callFrame ) {
359365 Object . assign ( this , callFrame ) ;
@@ -374,9 +380,7 @@ function createRepl(inspector) {
374380 }
375381
376382 list ( delta = 5 ) {
377- const { scriptId } = this . location ;
378- return Debugger . getScriptSource ( { scriptId } )
379- . then ( ( { scriptSource } ) => new SourceSnippet ( this . location , delta , scriptSource ) ) ;
383+ return getSourceSnippet ( this . location , delta ) ;
380384 }
381385 }
382386
@@ -557,7 +561,7 @@ function createRepl(inspector) {
557561 function registerBreakpoint ( { breakpointId, actualLocation } ) {
558562 handleBreakpointResolved ( { breakpointId, location : actualLocation } ) ;
559563 if ( actualLocation && actualLocation . scriptId ) {
560- if ( ! silent ) return list ( 5 ) ;
564+ if ( ! silent ) return getSourceSnippet ( actualLocation , 5 ) ;
561565 } else {
562566 print ( `Warning: script '${ script } ' was not loaded yet.` ) ;
563567 }
0 commit comments