Make effort to use document in the target's context in key emulation

In Firefox 22, a keyevent created in a privileged context isn't
handled correctly by websites (e.g., Google's search box).
Merge branch 'master' of github.com:mooz/keysnail