[tor-commits] [meek/master] Minor Chrome compatibility.

dcf at torproject.org dcf at torproject.org
Wed Aug 28 05:59:18 UTC 2019


commit d86981fadd29c3364942f07dc9c70ec702905340
Author: David Fifield <david at bamsoftware.com>
Date:   Sat Mar 30 02:02:09 2019 -0600

    Minor Chrome compatibility.
    
    This doesn't hurt, but we're still reliant on Firefox for using the
    global "browser" object (instead of "chrome"), and especially for the
    proxy code, which has a totally different API in Chrome.
---
 webextension/browser/background.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/webextension/browser/background.js b/webextension/browser/background.js
index c47d06b..0b896e9 100644
--- a/webextension/browser/background.js
+++ b/webextension/browser/background.js
@@ -336,7 +336,8 @@ port.onDisconnect.addListener(p => {
     // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port#Type
     // "Note that in Google Chrome port.error is not supported: instead, use
     // runtime.lastError to get the error message."
-    if (p.error) {
-        console.log(`${browser.runtime.id}: disconnected because of error: ${p.error.message}`);
+    let error = p.error || browser.runtime.lastError;
+    if (error) {
+        console.log(`${browser.runtime.id}: disconnected because of error: ${error.message}`);
     }
 });





More information about the tor-commits mailing list