Workaround for Firefox re-injecting content scripts when reloaded.

This commit is contained in:
ccd0 2017-10-08 23:28:00 -07:00
parent e4e7bbea7e
commit c717897532

View File

@ -4,8 +4,12 @@ Main =
return if d.body and not $ 'title', d.head
# XXX dwb userscripts extension reloads scripts run at document-start when replaceState/pushState is called.
return if window['<%= meta.name %> antidup']
window['<%= meta.name %> antidup'] = true
# XXX Firefox reinjects WebExtension content scripts when extension is updated / reloaded.
try
w = window
w = (w.wrappedJSObject or w) if $.platform is 'crx'
return if '<%= meta.name %> antidup' of w
w['<%= meta.name %> antidup'] = true
if location.hostname is 'www.google.com'
if location.pathname is '/recaptcha/api/noscript'