@@ -54,21 +54,6 @@ DebuggerScript.getAfterCompileScript = function(eventData)
54
54
return DebuggerScript . _formatScript ( eventData . script_ . script_ ) ;
55
55
}
56
56
57
- DebuggerScript . getWorkerScripts = function ( )
58
- {
59
- var result = [ ] ;
60
- var scripts = Debug . scripts ( ) ;
61
- for ( var i = 0 ; i < scripts . length ; ++ i ) {
62
- var script = scripts [ i ] ;
63
- // Workers don't share same V8 heap now so there is no need to complicate stuff with
64
- // the context id like we do to discriminate between scripts from different pages.
65
- // However we need to filter out v8 native scripts.
66
- if ( script . context_data && script . context_data === "worker" )
67
- result . push ( DebuggerScript . _formatScript ( script ) ) ;
68
- }
69
- return result ;
70
- }
71
-
72
57
DebuggerScript . getFunctionScopes = function ( fun )
73
58
{
74
59
var mirror = MakeMirror ( fun ) ;
@@ -89,6 +74,31 @@ DebuggerScript.getFunctionScopes = function(fun)
89
74
return result ;
90
75
}
91
76
77
+ DebuggerScript . getGeneratorObjectDetails = function ( object )
78
+ {
79
+ var mirror = MakeMirror ( object , true /* transient */ ) ;
80
+ if ( ! mirror . isGenerator ( ) )
81
+ return null ;
82
+ var funcMirror = mirror . func ( ) ;
83
+ if ( ! funcMirror . resolved ( ) )
84
+ return null ;
85
+ var result = {
86
+ "function" : funcMirror . value ( ) ,
87
+ "functionName" : DebuggerScript . _displayFunctionName ( funcMirror ) || "" ,
88
+ "status" : mirror . status ( )
89
+ } ;
90
+ var script = funcMirror . script ( ) ;
91
+ var location = mirror . sourceLocation ( ) || funcMirror . sourceLocation ( ) ;
92
+ if ( script && location ) {
93
+ result [ "location" ] = {
94
+ "scriptId" : String ( script . id ( ) ) ,
95
+ "lineNumber" : location . line ,
96
+ "columnNumber" : location . column
97
+ } ;
98
+ }
99
+ return result ;
100
+ }
101
+
92
102
DebuggerScript . getCollectionEntries = function ( object )
93
103
{
94
104
var mirror = MakeMirror ( object , true /* transient */ ) ;
@@ -103,20 +113,6 @@ DebuggerScript.getCollectionEntries = function(object)
103
113
}
104
114
}
105
115
106
- DebuggerScript . getInternalProperties = function ( value )
107
- {
108
- var properties = ObjectMirror . GetInternalProperties ( value ) ;
109
- var result = [ ] ;
110
- for ( var i = 0 ; i < properties . length ; i ++ ) {
111
- var mirror = properties [ i ] ;
112
- result . push ( {
113
- name : mirror . name ( ) ,
114
- value : mirror . value ( ) . value ( )
115
- } ) ;
116
- }
117
- return result ;
118
- }
119
-
120
116
DebuggerScript . setFunctionVariableValue = function ( functionValue , scopeIndex , variableName , newValue )
121
117
{
122
118
var mirror = MakeMirror ( functionValue ) ;
@@ -134,24 +130,24 @@ DebuggerScript._setScopeVariableValue = function(scopeHolder, scopeIndex, variab
134
130
return undefined ;
135
131
}
136
132
137
- DebuggerScript . getScripts = function ( contextData )
133
+ DebuggerScript . getScripts = function ( contextGroupId )
138
134
{
139
135
var result = [ ] ;
140
-
141
- if ( ! contextData )
142
- return result ;
143
- var comma = contextData . indexOf ( "," ) ;
144
- if ( comma === - 1 )
145
- return result ;
146
- // Context data is a string in the following format:
147
- // ("page"|"injected")","<page id>
148
- var idSuffix = contextData . substring ( comma ) ; // including the comma
149
-
150
136
var scripts = Debug . scripts ( ) ;
137
+ var contextDataPrefix = null ;
138
+ if ( contextGroupId )
139
+ contextDataPrefix = contextGroupId + "," ;
151
140
for ( var i = 0 ; i < scripts . length ; ++ i ) {
152
141
var script = scripts [ i ] ;
153
- if ( script . context_data && script . context_data . lastIndexOf ( idSuffix ) != - 1 )
154
- result . push ( DebuggerScript . _formatScript ( script ) ) ;
142
+ if ( contextDataPrefix ) {
143
+ if ( ! script . context_data )
144
+ continue ;
145
+ // Context data is a string in the following format:
146
+ // <id>","("page"|"injected"|"worker")
147
+ if ( script . context_data . indexOf ( contextDataPrefix ) !== 0 )
148
+ continue ;
149
+ }
150
+ result . push ( DebuggerScript . _formatScript ( script ) ) ;
155
151
}
156
152
return result ;
157
153
}
@@ -183,7 +179,8 @@ DebuggerScript._formatScript = function(script)
183
179
startColumn : script . column_offset ,
184
180
endLine : endLine ,
185
181
endColumn : endColumn ,
186
- isContentScript : ! ! script . context_data && script . context_data . indexOf ( "injected" ) == 0
182
+ isContentScript : ! ! script . context_data && script . context_data . endsWith ( ",injected" ) ,
183
+ isInternalScript : script . is_debugger_script
187
184
} ;
188
185
}
189
186
@@ -276,6 +273,11 @@ DebuggerScript.stepOutOfFunction = function(execState, callFrame)
276
273
execState . prepareStep ( Debug . StepAction . StepOut , 1 ) ;
277
274
}
278
275
276
+ DebuggerScript . clearStepping = function ( )
277
+ {
278
+ Debug . clearStepping ( ) ;
279
+ }
280
+
279
281
// Returns array in form:
280
282
// [ 0, <v8_result_report> ] in case of success
281
283
// or [ 1, <general_error_message>, <compiler_message>, <line_number>, <column_number> ] in case of compile error, numbers are 1-based.
@@ -296,7 +298,7 @@ DebuggerScript.liveEditScriptSource = function(scriptId, newSource, preview)
296
298
var changeLog = [ ] ;
297
299
try {
298
300
var result = Debug . LiveEdit . SetScriptSource ( scriptToEdit , newSource , preview , changeLog ) ;
299
- return [ 0 , result ] ;
301
+ return [ 0 , result . stack_modified ] ;
300
302
} catch ( e ) {
301
303
if ( e instanceof Debug . LiveEdit . Failure && "details" in e ) {
302
304
var details = e . details ;
@@ -357,6 +359,17 @@ DebuggerScript.isEvalCompilation = function(eventData)
357
359
return ( script . compilationType ( ) === Debug . ScriptCompilationType . Eval ) ;
358
360
}
359
361
362
+ DebuggerScript . _displayFunctionName = function ( funcMirror )
363
+ {
364
+ if ( ! funcMirror . resolved ( ) )
365
+ return undefined
366
+ var displayName ;
367
+ var valueMirror = funcMirror . property ( "displayName" ) . value ( ) ;
368
+ if ( valueMirror && valueMirror . isString ( ) )
369
+ displayName = valueMirror . value ( ) ;
370
+ return displayName || funcMirror . name ( ) || funcMirror . inferredName ( ) ;
371
+ }
372
+
360
373
// NOTE: This function is performance critical, as it can be run on every
361
374
// statement that generates an async event (like addEventListener) to support
362
375
// asynchronous call stacks. Thus, when possible, initialize the data lazily.
@@ -458,14 +471,19 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame, sc
458
471
459
472
function functionName ( )
460
473
{
461
- var func = ensureFuncMirror ( ) ;
462
- if ( ! func . resolved ( ) )
463
- return undefined ;
464
- var displayName ;
465
- var valueMirror = func . property ( "displayName" ) . value ( ) ;
466
- if ( valueMirror && valueMirror . isString ( ) )
467
- displayName = valueMirror . value ( ) ;
468
- return displayName || func . name ( ) || func . inferredName ( ) ;
474
+ return DebuggerScript . _displayFunctionName ( ensureFuncMirror ( ) ) ;
475
+ }
476
+
477
+ function functionLine ( )
478
+ {
479
+ var location = ensureFuncMirror ( ) . sourceLocation ( ) ;
480
+ return location ? location . line : 0 ;
481
+ }
482
+
483
+ function functionColumn ( )
484
+ {
485
+ var location = ensureFuncMirror ( ) . sourceLocation ( ) ;
486
+ return location ? location . column : 0 ;
469
487
}
470
488
471
489
function evaluate ( expression , scopeExtension )
@@ -475,7 +493,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame, sc
475
493
476
494
function restart ( )
477
495
{
478
- return Debug . LiveEdit . RestartFrame ( frameMirror ) ;
496
+ return frameMirror . restart ( ) ;
479
497
}
480
498
481
499
function setVariableValue ( scopeNumber , variableName , newValue )
@@ -511,6 +529,8 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame, sc
511
529
"column" : column ,
512
530
"scriptName" : scriptName ,
513
531
"functionName" : functionName ,
532
+ "functionLine" : functionLine ,
533
+ "functionColumn" : functionColumn ,
514
534
"thisObject" : thisObject ,
515
535
"scopeChain" : lazyScopeChain ,
516
536
"scopeType" : lazyScopeTypes ,
0 commit comments