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
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;
},