From b79445320df2951445578d44a45953e310b99a6c Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 27 Oct 2019 11:41:08 -0400 Subject: [PATCH] Force-unsuspend when starting webRequest listener Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/759 If for some reasons the launch code throws, uBO could find itself in permanent suspend mode, thus preventing web pages from loading in Firefox. Though uBO should not have exceptions thrown during it's initialization code, this commit will ensure uBO complete its initialization process should it ever happen for whatever reason. --- platform/chromium/vapi-background.js | 8 ++++++-- src/js/traffic.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 01dbb2b84..a4b9c585e 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -1227,9 +1227,13 @@ vAPI.Net = class { this.suspendDepth += 1; } } - unsuspend() { + unsuspend(all = false) { if ( this.suspendDepth === 0 ) { return; } - this.suspendDepth -= 1; + if ( all ) { + this.suspendDepth = 0; + } else { + this.suspendDepth -= 1; + } if ( this.suspendDepth !== 0 ) { return; } this.unsuspendAllRequests(this.suspendableListener); } diff --git a/src/js/traffic.js b/src/js/traffic.js index a69f1796a..56da0a93d 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -1070,7 +1070,7 @@ return { [ 'blocking', 'requestBody' ] ); } - vAPI.net.unsuspend(); + vAPI.net.unsuspend(true); }; })(),