resourceloader: Remove use of $.isPlainObject() from mw.Map#set()
Look for typeof 'object' instead. The set() method has good test
coverage which uncovered a few cases that were previously only
working implicitly due to isPlainObject.
* Test case `mw.config.set( [], 'value' )`
This is invalid because `key` must be a string. This was previously
rejected because while array is an object, it isn't a plain object.
This commit intends to remove this distinction and allow any object
to be used with the set(Object) signature. However, we should still
reject set(non-string, string) no matter what kind of object is passed.
Changing from isPlainObject to 'is an object' made this case
wrongly pass instead of fail (because arrays are objects). Fix that,
as well as any other case of non-string as key, by making the code
explicitly reject non-string keys when two arguments are given.
Added test case for `mw.config.set( {}, value ) === false` that did
not pass without the changes in src/.
* Missing `> 1` check in global #set(). The check for arguments.length
was asserting truthiness (non-zero) rather than >1 (2 or more).
This was causing things like `mw.config.set('key')` to throw
"ReferenceError: value not defined" when the underlying mw.Map
is global. The normal #set() method for maps other than mw.config,
was already fine.
Fixed a bug in mediawiki.language.init that was revealed by this.
The bug was not happening previously because when an object
was passed, the second parameter was ignored.
Bug: T192623
Change-Id: Ib53647b324fe3d31e3389ed9aa14a08280d9c830