mw.inspect: Include templates and messages in size
Currently, mw.inspect#getModuleSize omits the size of templates and messages while calculating a ResourceLoader module's size despite them being included in the module's definition. Change-Id: Ib8d52c901a8e1656b8b6996762bfbff3af16a834
This commit is contained in:
parent
c10cdec089
commit
ce2652c9ec
1 changed files with 9 additions and 0 deletions
|
|
@ -95,6 +95,15 @@
|
|||
payload += $.byteLength( module.script.toString() );
|
||||
}
|
||||
|
||||
// Tally templates and messages. Calculate their JSON size so that keys
|
||||
// are included in the module size - in the case of messages, keys can be
|
||||
// longer than values - and so that empty objects are also included.
|
||||
$.each( [ module.templates, module.messages ], function ( i, object ) {
|
||||
if ( object ) {
|
||||
payload += $.byteLength( JSON.stringify( object ) );
|
||||
}
|
||||
} );
|
||||
|
||||
return payload;
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue