mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-09-29 13:17:35 +00:00
7afbc5ce92
* more robust method of obtaining URL * decouple performance logging from providers (mostly) * ignore fake XHR object which jQuery returns for JSONP requests * guard for CORS requests - apparently Chrome refuses to return certain information even with an Allow-Origin: * response header. * Resource Timing is limited to 150 results, which causes fake misses in debug mode. There is an API to increase the limit but it is not implemented in Chrome. I am calling it nevertheless, maybe IE understands it (it is present in the MSDN docs at least). This seems to work for AJAX, CORS, JSONP, image AJAX; CORS requests return 0 for a lot of values, per spec a Timing-Allow-Origin: * header might help that. Change-Id: I8353858022f51a7e70774e65513d0fa2554a5064
39 lines
1.2 KiB
JavaScript
Executable file
39 lines
1.2 KiB
JavaScript
Executable file
/*
|
|
* This file is part of the MediaWiki extension MultimediaViewer.
|
|
*
|
|
* MultimediaViewer is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* MultimediaViewer is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with MultimediaViewer. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
( function ( mw, $, oo ) {
|
|
function Api( type, options ) {
|
|
mw.Api.call( this, options );
|
|
|
|
this.performance = new mw.mmv.Performance();
|
|
this.type = type;
|
|
}
|
|
|
|
oo.inheritClass( Api, mw.Api );
|
|
|
|
Api.prototype.ajax = function ( parameters, ajaxOptions ) {
|
|
var start = $.now(),
|
|
api = this;
|
|
|
|
return mw.Api.prototype.ajax.call( this, parameters, ajaxOptions ).done( function ( result, jqxhr ) {
|
|
api.performance.recordJQueryEntryDelayed( api.type, $.now() - start, jqxhr );
|
|
} );
|
|
};
|
|
|
|
mw.mmv.Api = Api;
|
|
}( mediaWiki, jQuery, OO ) );
|