mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Use new brower.proxy.register/unregister API when possible.
This commit is contained in:
parent
9e016bff4b
commit
7a46271487
@ -189,8 +189,13 @@ class ChromeOptions extends OmegaTarget.Options
|
|||||||
if profile.profileType == 'SystemProfile'
|
if profile.profileType == 'SystemProfile'
|
||||||
# MOZ: SystemProfile cannot be done now due to lack of "PASS" support.
|
# MOZ: SystemProfile cannot be done now due to lack of "PASS" support.
|
||||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1319634
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1319634
|
||||||
# In the mean time, let's just set an invalid script to unregister it.
|
# In the mean time, let's just unregister the script.
|
||||||
browser.proxy.registerProxyScript('js/omega_invalid_proxy_script.min.js')
|
if browser.proxy.unregister?
|
||||||
|
browser.proxy.unregister()
|
||||||
|
else
|
||||||
|
# Some older browers may not ship with .unregister API.
|
||||||
|
# In that case, let's just set an invalid script to unregister it.
|
||||||
|
browser.proxy.registerProxyScript('js/omega_invalid_proxy_script.js')
|
||||||
@_proxyScriptDisabled = true
|
@_proxyScriptDisabled = true
|
||||||
else
|
else
|
||||||
@_proxyScriptState = state
|
@_proxyScriptState = state
|
||||||
@ -206,8 +211,8 @@ class ChromeOptions extends OmegaTarget.Options
|
|||||||
if not @_proxyScriptInitialized
|
if not @_proxyScriptInitialized
|
||||||
browser.proxy.onProxyError.addListener (err) =>
|
browser.proxy.onProxyError.addListener (err) =>
|
||||||
if err and err.message.indexOf('Invalid Proxy Rule: DIRECT') >= 0
|
if err and err.message.indexOf('Invalid Proxy Rule: DIRECT') >= 0
|
||||||
# MOZ: DIRECT cannot be correctly parsed due to a bug. Even though it
|
# DIRECT cannot be parsed in Mozilla earlier due to a bug. Even though
|
||||||
# throws, it actually falls back to direct connection so it works.
|
# it throws, it actually falls back to direct connection so it works.
|
||||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1355198
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1355198
|
||||||
return
|
return
|
||||||
@log.error(err)
|
@log.error(err)
|
||||||
@ -228,6 +233,10 @@ class ChromeOptions extends OmegaTarget.Options
|
|||||||
browser.runtime.onMessage.removeListener onMessage
|
browser.runtime.onMessage.removeListener onMessage
|
||||||
return
|
return
|
||||||
browser.runtime.onMessage.addListener onMessage
|
browser.runtime.onMessage.addListener onMessage
|
||||||
|
# The API has been renamed to .register but for some old browsers' sake:
|
||||||
|
if browser.proxy.register?
|
||||||
|
browser.proxy.register(@_proxyScriptUrl)
|
||||||
|
else
|
||||||
browser.proxy.registerProxyScript(@_proxyScriptUrl)
|
browser.proxy.registerProxyScript(@_proxyScriptUrl)
|
||||||
@_proxyScriptDisabled = false
|
@_proxyScriptDisabled = false
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user