From 80b758e18dbd6e5ed06975c2d4f30649a62b17a9 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 6 May 2020 20:30:58 -0400 Subject: [PATCH] Let the platform pick the default suspend state at launch Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1004 The fix is trivial enough that I feel confident to make it part of current RC cycle. There are many reports of block page at launch on Chromium. The fix is to let the platform pick it's natural suspend state rather than force it. Once advanced settings are read, the suspend state will for toggled only if `suspendTabsUntilReady` is either `yes` or `no`. This there should no longer be blocked page on Chromium at launch when using default settings. Related feedback: - https://www.reddit.com/r/uBlockOrigin/comments/gac2h8/ --- src/js/start.js | 12 ++++-------- src/js/traffic.js | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/js/start.js b/src/js/start.js index 5d767f0f8..23db0edf0 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -268,15 +268,11 @@ try { await µb.loadHiddenSettings(); log.info(`Hidden settings ready ${Date.now()-vAPI.T0} ms after launch`); - // By default network requests are always suspended, so we must - // unsuspend immediately if commanded by platform + advanced settings. - if ( - vAPI.net.canSuspend() && - µb.hiddenSettings.suspendTabsUntilReady === 'no' || - vAPI.net.canSuspend() !== true && - µb.hiddenSettings.suspendTabsUntilReady !== 'yes' - ) { + // Maybe override current network listener suspend state + if ( µb.hiddenSettings.suspendTabsUntilReady === 'no' ) { vAPI.net.unsuspend(true); + } else if ( µb.hiddenSettings.suspendTabsUntilReady === 'yes' ) { + vAPI.net.suspend(); } if ( µb.hiddenSettings.disableWebAssembly !== true ) { diff --git a/src/js/traffic.js b/src/js/traffic.js index bf4455a67..622f89030 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -1035,7 +1035,7 @@ const strictBlockBypasser = { return { start: (( ) => { vAPI.net = new vAPI.Net(); - vAPI.net.suspend(true); + vAPI.net.suspend(); return function() { vAPI.net.setSuspendableListener(onBeforeRequest);