Bug 1021270 - Focus the top active window while permission dialog hide

focus will definitely impact load time so that's the reason we depends on loaded state here.