@@ -85,10 +85,13 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
85
85
86
86
private _evalResultProperties = new Map < number , xdebug . EvalResultProperty > ( ) ;
87
87
88
+ private cookies : string [ ] = [ ] ;
89
+
88
90
public constructor ( ) {
89
91
super ( ) ;
90
92
91
93
const api = new AtelierAPI ( ) ;
94
+ this . cookies = api . cookies ;
92
95
if ( ! api . active ) {
93
96
throw new Error ( "Connection not active" ) ;
94
97
}
@@ -114,7 +117,11 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
114
117
supportsStepBack : false ,
115
118
} ;
116
119
117
- const socket = new WebSocket ( this . _url ) ;
120
+ const socket = new WebSocket ( this . _url , {
121
+ headers : {
122
+ cookie : this . cookies ,
123
+ } ,
124
+ } ) ;
118
125
119
126
const disposeConnection = ( error ?: Error ) : void => {
120
127
this . sendEvent ( new ThreadEvent ( "exited" , this . _connection . id ) ) ;
@@ -130,24 +137,30 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
130
137
this . sendEvent ( new OutputEvent ( data , "stdout" ) ) ;
131
138
} ) ;
132
139
133
- await this . _connection . waitForInitPacket ( ) ;
140
+ try {
141
+ await this . _connection . waitForInitPacket ( ) ;
134
142
135
- await this . _connection . sendFeatureSetCommand ( "max_data" , 8192 ) ;
136
- await this . _connection . sendFeatureSetCommand ( "max_children" , 32 ) ;
137
- await this . _connection . sendFeatureSetCommand ( "max_depth" , 2 ) ;
138
- await this . _connection . sendFeatureSetCommand ( "notify_ok" , 1 ) ;
143
+ await this . _connection . sendFeatureSetCommand ( "max_data" , 8192 ) ;
144
+ await this . _connection . sendFeatureSetCommand ( "max_children" , 32 ) ;
145
+ await this . _connection . sendFeatureSetCommand ( "max_depth" , 2 ) ;
146
+ await this . _connection . sendFeatureSetCommand ( "notify_ok" , 1 ) ;
139
147
140
- this . sendResponse ( response ) ;
148
+ this . sendResponse ( response ) ;
141
149
142
- this . sendEvent ( new InitializedEvent ( ) ) ;
150
+ this . sendEvent ( new InitializedEvent ( ) ) ;
151
+ } catch ( error ) {
152
+ response . success = false ;
153
+ response . message = "Debugger can not start" ;
154
+ this . sendResponse ( response ) ;
155
+ }
143
156
}
144
157
145
158
protected async launchRequest ( response : DebugProtocol . LaunchResponse , args : LaunchRequestArguments ) : Promise < void > {
146
159
// this._args = args;
147
160
148
161
try {
149
162
const debugTarget = `${ this . _namespace } :${ args . program } ` ;
150
- await this . _connection . sendFeatureSetCommand ( "debug_target" , debugTarget ) ;
163
+ await this . _connection . sendFeatureSetCommand ( "debug_target" , debugTarget , true ) ;
151
164
152
165
this . _debugTargetSet . notify ( ) ;
153
166
} catch ( error ) {
0 commit comments