Merge pull request #20939 from nullaus/bug1027414

bug 1027414 - Dismiss on visibilitychange r=alive (on behalf of 21)
(cherry picked from commit 217b6fac31a8eaa1f74dfff95239fbc29eae4dd4)