File tree Expand file tree Collapse file tree
test/electron-browser/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,6 +100,10 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape {
100100 let clonedConfig = void 0 ;
101101 const cloneOnWriteProxy = ( target : any , accessor : string ) : any => {
102102 let clonedTarget = void 0 ;
103+ const cloneTarget = ( ) => {
104+ clonedConfig = clonedConfig ? clonedConfig : deepClone ( config ) ;
105+ clonedTarget = clonedTarget ? clonedTarget : lookUp ( clonedConfig , accessor ) ;
106+ } ;
103107 return isObject ( target ) ?
104108 new Proxy ( target , {
105109 get : ( target : any , property : string ) => {
@@ -114,10 +118,19 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape {
114118 return result ;
115119 } ,
116120 set : ( target : any , property : string , value : any ) => {
117- clonedConfig = clonedConfig ? clonedConfig : deepClone ( config ) ;
118- clonedTarget = clonedTarget ? clonedTarget : lookUp ( clonedConfig , accessor ) ;
121+ cloneTarget ( ) ;
119122 clonedTarget [ property ] = value ;
120123 return true ;
124+ } ,
125+ deleteProperty : ( target : any , property : string ) => {
126+ cloneTarget ( ) ;
127+ delete clonedTarget [ property ] ;
128+ return true ;
129+ } ,
130+ defineProperty : ( target : any , property : string , descriptor : any ) => {
131+ cloneTarget ( ) ;
132+ Object . defineProperty ( clonedTarget , property , descriptor ) ;
133+ return true ;
121134 }
122135 } ) : target ;
123136 } ;
Original file line number Diff line number Diff line change @@ -102,6 +102,11 @@ suite('ExtHostConfiguration', function () {
102102 'config2' : 'Das Pferd frisst kein Reis.'
103103 } ,
104104 'config4' : ''
105+ } ,
106+ 'workbench' : {
107+ 'colorCustomizations' : {
108+ 'statusBar.foreground' : 'somevalue'
109+ }
105110 }
106111 } ) ;
107112
@@ -131,6 +136,14 @@ suite('ExtHostConfiguration', function () {
131136 actual = testObject . inspect ( 'farboo' ) ;
132137 actual [ 'value' ] = 'effectiveValue' ;
133138 assert . equal ( 'effectiveValue' , actual [ 'value' ] ) ;
139+
140+ testObject = all . getConfiguration ( 'workbench' ) ;
141+ actual = testObject . get ( 'colorCustomizations' ) ;
142+ delete actual [ 'statusBar.foreground' ] ;
143+ assert . equal ( actual [ 'statusBar.foreground' ] , undefined ) ;
144+ testObject = all . getConfiguration ( 'workbench' ) ;
145+ actual = testObject . get ( 'colorCustomizations' ) ;
146+ assert . equal ( actual [ 'statusBar.foreground' ] , 'somevalue' ) ;
134147 } ) ;
135148
136149 test ( 'cannot modify returned configuration' , function ( ) {
@@ -158,7 +171,6 @@ suite('ExtHostConfiguration', function () {
158171 testObject [ 'farboo' ] [ 'config0' ] = false ;
159172 assert . fail ( 'This should be readonly' ) ;
160173 } catch ( e ) {
161- console . log ( e ) ;
162174 }
163175
164176 try {
You can’t perform that action at this time.
0 commit comments