@@ -268,14 +268,15 @@ var EditorsHandler = function () {
268
268
269
269
idx = parseInt ( idx ) ;
270
270
this . _getTabMode ( idx ) . then ( function ( data ) {
271
- if ( JSON . parse ( data ) . mode === that . undefinedFileMode ) {
271
+ data = that . isJsonString ( data ) ? JSON . parse ( data ) : data ;
272
+ if ( data . mode === that . undefinedFileMode ) {
272
273
chrome . fileSystem . getDisplayPath ( fileEntry , function ( path ) {
273
274
// noinspection JSUnresolvedVariable
274
275
that . getEditor ( idx ) . setOption ( 'mode' , that . Modelist . getModeForPath ( path ) . mode ) ;
275
276
that . _populateStatusBar ( idx ) ;
276
277
} ) ;
277
278
} else {
278
- that . getEditor ( idx ) . setOption ( 'mode' , 'ace/mode/' + JSON . parse ( data ) . mode ) ;
279
+ that . getEditor ( idx ) . setOption ( 'mode' , 'ace/mode/' + data . mode ) ;
279
280
that . _populateStatusBar ( idx ) ;
280
281
}
281
282
} ) ;
@@ -390,14 +391,15 @@ var EditorsHandler = function () {
390
391
data = that . isJsonString ( data ) ? JSON . parse ( data ) : data ;
391
392
var ext = that . _getTabFileExtension ( idx ) ;
392
393
if ( typeof ext === typeof undefined ) {
393
- deferred . resolve ( JSON . stringify ( {
394
+ deferred . resolve ( {
394
395
"icon" : that . undefinedFileIcon ,
395
396
"mode" : that . undefinedFileMode ,
396
397
"name" : that . undefinedFileName
397
- } ) ) ;
398
+ } ) ;
398
399
}
399
- if ( data . hasOwnProperty ( ext ) ) {
400
- deferred . resolve ( JSON . stringify ( data [ ext ] ) ) ;
400
+
401
+ if ( typeof data [ ext ] !== typeof undefined ) {
402
+ deferred . resolve ( data [ ext ] ) ;
401
403
}
402
404
} ) ;
403
405
@@ -431,6 +433,7 @@ var EditorsHandler = function () {
431
433
432
434
idx = parseInt ( idx ) ;
433
435
this . _getTabMode ( idx ) . then ( function ( data ) {
436
+ data = that . isJsonString ( data ) ? JSON . parse ( data ) : data ;
434
437
var $el = that . getTabNavEl ( idx ) . find ( '*[data-toggle="tab"]' ) . first ( ) ;
435
438
$el . find ( '.filetype-icon' ) . remove ( ) ;
436
439
$el . append ( that . navTabIconHtml ) ;
0 commit comments