From eb6aeb0ec5b2cc6374d8ebe0e48c2b4eceb7e879 Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Sun, 26 Aug 2018 19:35:19 -0700 Subject: [PATCH] Add some feature detection for older browsers. See #1608. --- .../src/module/proxy/proxy_impl_listener.coffee | 4 ++-- omega-web/src/coffee/log_error.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/omega-target-chromium-extension/src/module/proxy/proxy_impl_listener.coffee b/omega-target-chromium-extension/src/module/proxy/proxy_impl_listener.coffee index eb60866a..cfccc4e6 100644 --- a/omega-target-chromium-extension/src/module/proxy/proxy_impl_listener.coffee +++ b/omega-target-chromium-extension/src/module/proxy/proxy_impl_listener.coffee @@ -1,11 +1,11 @@ OmegaTarget = require('omega-target') # The browser only accepts native promises as onRequest return values. # DO NOT USE Bluebird Promises here! -NativePromise = Promise +NativePromise = Promise ? null ProxyImpl = require('./proxy_impl') class ListenerProxyImpl extends ProxyImpl - @isSupported: -> browser?.proxy?.onRequest? + @isSupported: -> Promise? and browser?.proxy?.onRequest? features: ['fullUrl', 'socks5Auth'] constructor: -> super(arguments...) diff --git a/omega-web/src/coffee/log_error.coffee b/omega-web/src/coffee/log_error.coffee index 056f11cb..a58bd9f4 100644 --- a/omega-web/src/coffee/log_error.coffee +++ b/omega-web/src/coffee/log_error.coffee @@ -1,6 +1,6 @@ window.onerror = (message, url, line, col, err) -> log = localStorage['log'] || '' - if err.stack + if err?.stack log += err.stack + '\n\n' else log += "#{url}:#{line}:#{col}:\t#{message}\n\n"