I have extracted some code from Thunderbird's nsMessengerOSXIntegration.cpp to allow my xulrunner apps to add a number to their Mac OS X dock icon. It's of course a binary component, very simple to build and use. I'll release the code here tomorrow.