[Project_owners] Anyone interested? Extension Minimizer Tool

Onno Ekker o.e.ekker at gmail.com
Fri May 23 01:24:53 PDT 2008

Axel Hecht wrote:
> Eric H. Jung wrote:
>> If anyone else is interested in a tool like this, please reply here or at https://www.mozdev.org/bugs/show_bug.cgi?id=19120
>> I'd like to request a new mozilla-specific tool for mozdev. 
>> The tool would do the following:
>> 0. User uploads XPI to a page.
>> 1. Tool determines if the XPI defines DTD entities that aren't used.
>> 2. Tool determines if the XPI defines properties that aren't used.
>> Results are reported back to the user. An advanced version might offer the XPI,
>> stripped of unused entities and properties (i.e. "minified") to the user for
>> download. The advanced version might also have options to strip CSS, XUL, and
>> JS of extra whitespace, although I don't imagine many extension authors would
>> use that.
>> Why is this important? Addons that have many localizations tend to build up
>> lots of "string" cruft over time. Some entities and properties are no longer
>> used, but they still exist in various DTD and property files. This can inflate
>> XPI size needlessly, especially when there are a lot of localizations.
>> Manually searching for entities and properties not in use can be extremely
>> labor-intensive when there are hundreds or thousands of them.
>> To simply implementation, the tool could ignore DTDs defined in XUL files (at
>> least for an initial implementation) and instead just parse *.dtd and
>> *.property files.
> You can't reliably do that for un-used properties, as the keys to many 
> of those are dynamically created.
As long as the tool doesn't strip the unused properties, but only warns 
you, the only problem with this is that you might get a lot of bogus 
warnings. But the developer can decide what to do with the warnings...

Maybe adding some sort of pragma "no strict 'refs'" to part of the dtds 
and changing the minimizer tool to skip them would help cutting down on 
warnings, at the risk of leaving unused strings there. Since the purpose 
of this script seems to be to find unused strings, I doubt it would be 
worth the effort, though...


More information about the Project_owners mailing list