Fix $modal being mixed between modals... (bug 998301)

See https://bugzilla.mozilla.org/show_bug.cgi?id=998301