@@ -207,6 +207,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
207
207
super ( ) ;
208
208
209
209
//#region create browser window
210
+ let useSandbox = false ;
210
211
{
211
212
// Load window state
212
213
const [ state , hasMultipleDisplays ] = this . restoreWindowState ( config . state ) ;
@@ -225,7 +226,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
225
226
226
227
const windowSettings = this . configurationService . getValue < IWindowSettings | undefined > ( 'window' ) ;
227
228
228
- let useSandbox = false ;
229
229
if ( typeof windowSettings ?. experimental ?. useSandbox === 'boolean' ) {
230
230
useSandbox = windowSettings . experimental . useSandbox ;
231
231
} else if ( this . productService . quality === 'stable' && CodeWindow . sandboxState ) {
@@ -442,7 +442,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
442
442
this . createTouchBar ( ) ;
443
443
444
444
// Eventing
445
- this . registerListeners ( ) ;
445
+ this . registerListeners ( useSandbox ) ;
446
446
}
447
447
448
448
setRepresentedFilename ( filename : string ) : void {
@@ -546,12 +546,12 @@ export class CodeWindow extends Disposable implements ICodeWindow {
546
546
} ) ;
547
547
}
548
548
549
- private registerListeners ( ) : void {
549
+ private registerListeners ( sandboxed : boolean ) : void {
550
550
551
551
// Window error conditions to handle
552
- this . _win . on ( 'unresponsive' , ( ) => this . onWindowError ( WindowError . UNRESPONSIVE ) ) ;
553
- this . _win . webContents . on ( 'render-process-gone' , ( event , details ) => this . onWindowError ( WindowError . PROCESS_GONE , details ) ) ;
554
- this . _win . webContents . on ( 'did-fail-load' , ( event , exitCode , reason ) => this . onWindowError ( WindowError . LOAD , { reason, exitCode } ) ) ;
552
+ this . _win . on ( 'unresponsive' , ( ) => this . onWindowError ( WindowError . UNRESPONSIVE , { sandboxed } ) ) ;
553
+ this . _win . webContents . on ( 'render-process-gone' , ( event , details ) => this . onWindowError ( WindowError . PROCESS_GONE , { ... details , sandboxed } ) ) ;
554
+ this . _win . webContents . on ( 'did-fail-load' , ( event , exitCode , reason ) => this . onWindowError ( WindowError . LOAD , { reason, exitCode, sandboxed } ) ) ;
555
555
556
556
// Prevent windows/iframes from blocking the unload
557
557
// through DOM events. We have our own logic for
@@ -648,10 +648,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
648
648
return this . marketplaceHeadersPromise ;
649
649
}
650
650
651
- private async onWindowError ( error : WindowError . UNRESPONSIVE ) : Promise < void > ;
652
- private async onWindowError ( error : WindowError . PROCESS_GONE , details : { reason : string ; exitCode : number } ) : Promise < void > ;
653
- private async onWindowError ( error : WindowError . LOAD , details : { reason : string ; exitCode : number } ) : Promise < void > ;
654
- private async onWindowError ( type : WindowError , details ? : { reason : string ; exitCode : number } ) : Promise < void > {
651
+ private async onWindowError ( error : WindowError . UNRESPONSIVE , details : { sandboxed : boolean } ) : Promise < void > ;
652
+ private async onWindowError ( error : WindowError . PROCESS_GONE , details : { reason : string ; exitCode : number ; sandboxed : boolean } ) : Promise < void > ;
653
+ private async onWindowError ( error : WindowError . LOAD , details : { reason : string ; exitCode : number ; sandboxed : boolean } ) : Promise < void > ;
654
+ private async onWindowError ( type : WindowError , details : { reason ? : string ; exitCode ? : number ; sandboxed : boolean } ) : Promise < void > {
655
655
656
656
switch ( type ) {
657
657
case WindowError . PROCESS_GONE :
@@ -669,6 +669,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
669
669
type WindowErrorClassification = {
670
670
type : { classification : 'SystemMetaData' ; purpose : 'PerformanceAndHealth' ; isMeasurement : true ; comment : 'The type of window error to understand the nature of the error better.' } ;
671
671
reason : { classification : 'SystemMetaData' ; purpose : 'PerformanceAndHealth' ; comment : 'The reason of the window error to understand the nature of the error better.' } ;
672
+ sandboxed : { classification : 'SystemMetaData' ; purpose : 'PerformanceAndHealth' ; comment : 'If the window was sandboxed or not.' } ;
672
673
code : { classification : 'SystemMetaData' ; purpose : 'PerformanceAndHealth' ; isMeasurement : true ; comment : 'The exit code of the window process to understand the nature of the error better' } ;
673
674
owner : 'bpasero' ;
674
675
comment : 'Provides insight into reasons the vscode window had an error.' ;
@@ -677,8 +678,14 @@ export class CodeWindow extends Disposable implements ICodeWindow {
677
678
type : WindowError ;
678
679
reason : string | undefined ;
679
680
code : number | undefined ;
681
+ sandboxed : string ;
680
682
} ;
681
- this . telemetryService . publicLog2 < WindowErrorEvent , WindowErrorClassification > ( 'windowerror' , { type, reason : details ?. reason , code : details ?. exitCode } ) ;
683
+ this . telemetryService . publicLog2 < WindowErrorEvent , WindowErrorClassification > ( 'windowerror' , {
684
+ type,
685
+ reason : details ?. reason ,
686
+ code : details ?. exitCode ,
687
+ sandboxed : details ?. sandboxed ? '1' : '0'
688
+ } ) ;
682
689
683
690
// Inform User if non-recoverable
684
691
switch ( type ) {
@@ -782,7 +789,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
782
789
}
783
790
}
784
791
785
- private async handleWindowsAdminCrash ( details : { reason : string ; exitCode : number } ) {
792
+ private async handleWindowsAdminCrash ( details : { reason ? : string ; exitCode ? : number ; sandboxed : boolean } ) {
786
793
787
794
// Prepare telemetry event (TODO@bpasero remove me eventually)
788
795
const appenders : ITelemetryAppender [ ] = [ ] ;
0 commit comments