userContent.jsとgreasemonkeyの違いを判断する方法があるのか分かりませんが、
もしあればスクリプトの先頭付近で
var window = hoge ? window : unsafeWindow;
みたいにできそうですけど…