Bug 1029385 - Rewrite app-makefile rule in javascript

this is a feature I missed on [bug 1028085](https://bugzilla.mozilla.org/show_bug.cgi?id=1028085), since it is a small patch, I would like to add it in this pull request.