Merge "Provide command to adjust phpunit.xml for code coverage"
[lhc/web/wiklou.git] / resources / src / mediawiki.inspect.js
index 72a27fa..c7b99b2 100644 (file)
                } );
        }
 
-       function humanSize( bytes ) {
+       function humanSize( bytesInput ) {
                var i,
+                       bytes = +bytesInput,
                        units = [ '', ' KiB', ' MiB', ' GiB', ' TiB', ' PiB' ];
 
-               if ( !$.isNumeric( bytes ) || bytes === 0 ) {
-                       return bytes;
+               if ( bytes === 0 || isNaN( bytes ) ) {
+                       return bytesInput;
                }
 
                for ( i = 0; bytes >= 1024; bytes /= 1024 ) {
 
                style.textContent = css;
                document.body.appendChild( style );
-               // eslint-disable-next-line jquery/no-each-util
+               // eslint-disable-next-line no-jquery/no-each-util
                $.each( style.sheet.cssRules, function ( index, rule ) {
                        selectors.total++;
                        // document.querySelector() on prefixed pseudo-elements can throw exceptions
         */
        inspect.grep = function ( pattern ) {
                if ( typeof pattern.test !== 'function' ) {
-                       pattern = new RegExp( mw.RegExp.escape( pattern ), 'g' );
+                       pattern = new RegExp( mw.util.escapeRegExp( pattern ), 'g' );
                }
 
                return inspect.getLoadedModules().filter( function ( moduleName ) {
                        if ( stats.enabled ) {
                                $.extend( stats, mw.loader.store.stats );
                                try {
-                                       raw = localStorage.getItem( mw.loader.store.getStoreKey() );
+                                       raw = localStorage.getItem( mw.loader.store.key );
                                        stats.totalSizeInBytes = byteLength( raw );
                                        stats.totalSize = humanSize( byteLength( raw ) );
                                } catch ( e ) {}