Don't pass protocol-relative URLs to the Ace worker

Bug: T271487
Change-Id: Ib344e7c021f9224f08c0c844d4e96e5bede356c8
This commit is contained in:
Daimona Eaytoy 2021-01-11 13:33:11 +01:00
parent a9a8675d81
commit b9efb9ec7d

View file

@ -123,13 +123,16 @@ ace.define( 'ace/mode/abusefilter', [ 'require', 'exports', 'module', 'ace/lib/o
this.createWorker = function ( session ) {
var extPath = mw.config.get( 'wgExtensionAssetsPath' ),
worker;
worker,
apiPath;
ace.config.set( 'workerPath', extPath + '/AbuseFilter/modules' );
worker = new WorkerClient( [ 'ace' ], 'ace/mode/abusefilter_worker', 'AbuseFilterWorker' );
worker.$worker.postMessage( {
apipath: mw.config.get( 'wgServer' ) + new mw.Api().defaults.ajax.url
} );
apiPath = mw.config.get( 'wgServer' ) + new mw.Api().defaults.ajax.url;
if ( apiPath.substr( 0, 2 ) === '//' ) {
apiPath = window.location.protocol + apiPath;
}
worker.$worker.postMessage( { apipath: apiPath } );
worker.attachToDocument( session.getDocument() );