Skip to content

Commit

Permalink
Let the platform pick the default suspend state at launch
Browse files Browse the repository at this point in the history
Related issue:
- uBlockOrigin/uBlock-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/
  • Loading branch information
gorhill committed May 7, 2020
1 parent e59ec0c commit 80b758e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions src/js/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/traffic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 80b758e

Please sign in to comment.