@@ -10,7 +10,7 @@ import {logOnceWebWorkerWarning, IWorker, IWorkerCallback, IWorkerFactory} from
1010import * as dom from 'vs/base/browser/dom' ;
1111
1212function defaultGetWorkerUrl ( workerId :string , label :string ) : string {
13- return require . toUrl ( './' + workerId ) ;
13+ return require . toUrl ( './' + workerId ) + '#' + label ;
1414}
1515var getWorkerUrl = flags . getCrossOriginWorkerScriptUrl || defaultGetWorkerUrl ;
1616
@@ -130,10 +130,12 @@ export class DefaultWorkerFactory implements IWorkerFactory {
130130
131131 private static LAST_WORKER_ID = 0 ;
132132
133+ private _label : string ;
133134 private _fallbackToIframe :boolean ;
134135 private _webWorkerFailedBeforeError :any ;
135136
136- constructor ( fallbackToIframe :boolean ) {
137+ constructor ( label :string , fallbackToIframe :boolean ) {
138+ this . _label = label ;
137139 this . _fallbackToIframe = fallbackToIframe ;
138140 this . _webWorkerFailedBeforeError = false ;
139141 }
@@ -147,7 +149,7 @@ export class DefaultWorkerFactory implements IWorkerFactory {
147149 }
148150
149151 try {
150- return new WebWorker ( moduleId , workerId , 'service ' + workerId , onMessageCallback , ( err ) => {
152+ return new WebWorker ( moduleId , workerId , this . _label || 'anonymous ' + workerId , onMessageCallback , ( err ) => {
151153 logOnceWebWorkerWarning ( err ) ;
152154 this . _webWorkerFailedBeforeError = err ;
153155 onErrorCallback ( err ) ;
@@ -161,7 +163,7 @@ export class DefaultWorkerFactory implements IWorkerFactory {
161163 if ( this . _webWorkerFailedBeforeError ) {
162164 throw this . _webWorkerFailedBeforeError ;
163165 }
164- return new WebWorker ( moduleId , workerId , 'service ' + workerId , onMessageCallback , ( err ) => {
166+ return new WebWorker ( moduleId , workerId , this . _label || 'anonymous ' + workerId , onMessageCallback , ( err ) => {
165167 logOnceWebWorkerWarning ( err ) ;
166168 this . _webWorkerFailedBeforeError = err ;
167169 onErrorCallback ( err ) ;
0 commit comments