[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [meek/master] Cancel onBeforeSendHeaders in case of an exception.
commit 73719bb3fddaaddffba7554adabff55bb5bd12ea
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Sat Mar 30 01:29:59 2019 -0600
Cancel onBeforeSendHeaders in case of an exception.
A typo during debugging caused the callback to crash and have no effect.
---
webextension/browser/background.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/webextension/browser/background.js b/webextension/browser/background.js
index d26b744..c47d06b 100644
--- a/webextension/browser/background.js
+++ b/webextension/browser/background.js
@@ -192,6 +192,11 @@ async function roundtrip(request) {
}
let browserHeaders = details.requestHeaders.filter(x => !(x.name.toLowerCase() in overrides));
return {requestHeaders: browserHeaders.concat(headers)};
+ } catch (error) {
+ // In case of any error in the code above, play it safe and cancel
+ // the request.
+ console.log(`${browser.runtime.id}: error in onBeforeSendHeaders: ${error.message}`);
+ return {cancel: true};
} finally {
// Now that the listener has been called, remove it and release the
// lock to allow the next request to set a different listener.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits