Correctly validate a provider for local api

Make sure that the validation method accounts for local api
vs remote api when checking for valid variables.

Bug: T90795
Change-Id: Ia6877ca6ccc4e65d1db053f107e7702721e2da3c
This commit is contained in:
Moriel Schottlender 2015-02-25 15:19:28 -08:00
parent bc75cf573f
commit b85b81c501

View file

@ -24,6 +24,7 @@ ve.dm.MWMediaResourceProvider = function VeDmMWMediaResourceProvider( apiurl, co
// Fetching configuration
this.scriptDirUrl = config.scriptDirUrl;
this.isLocal = config.local;
if ( config.local ) {
this.setAjaxSettings( {
@ -291,8 +292,10 @@ ve.dm.MWMediaResourceProvider.prototype.isValid = function () {
var params = this.getUserParams();
return params.gsrsearch &&
(
this.isLocal ||
// If we don't have either 'apiurl' or 'scriptDirUrl'
// the source is invalid, and we will skip it
this.apiurl !== undefined || this.scriptDirUrl !== undefined
this.apiurl !== undefined ||
this.scriptDirUrl !== undefined
);
};