mediawiki.api: Check that query exists in api.getToken() response
It's possible that response.query does not exist when requesting a
token. This patch removes the assumption and handles the scenario in the
same way as a missing token.
Additionally, responses with a queryless response are now deleted from the cache.
Corresponding console warning:
> jQuery.Deferred exception: Cannot read property 'tokens' of undefined
> at apiPromise.then.promise.abort (/w/resources/src/mediawiki/api.js)
Change-Id: Ia29e0c0d657bf4b3d94f1d463b942451eebd68b4