Bug 1029385 - Rewrite app-makefile rule in javascript

I'm wondering... does it has anything to do with app-makefile?
(I'm ok to land that as part of this patch, even if that's not directly related)