Bug 1021569 - rewrite clear-stage-app in javascript