Skip to content

Commit 87feb47

Browse files
committed
Support disabling suspendTabsUntilReady in Firefox
The value of `suspendTabsUntilReady` was disregarded in Firefox and uBO defaulted to always defer tab loading until it was ready. This commit allows to disable the deferring of tab loading in Firefox. The new valid values for `suspendTabsUntilReady` are: - `unset`: leave it to the platform to pick the optimal behavior (default) - `no`: do no suspend tab loading at launch time - `yes`: suspend tab loading at launch time
1 parent 928ab91 commit 87feb47

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/js/background.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const µBlock = (function() { // jshint ignore:line
5353
requestJournalProcessPeriod: 1000,
5454
selfieAfter: 11,
5555
strictBlockingBypassDuration: 120,
56-
suspendTabsUntilReady: false,
56+
suspendTabsUntilReady: 'unset',
5757
userResourcesLocation: 'unset'
5858
};
5959

@@ -104,6 +104,11 @@ const µBlock = (function() { // jshint ignore:line
104104
if ( out.hasOwnProperty(k) ) { out[k] = o[k]; }
105105
}
106106
self.log.verbosity = out.consoleLogLevel;
107+
if ( typeof out.suspendTabsUntilReady === 'boolean' ) {
108+
out.suspendTabsUntilReady = out.suspendTabsUntilReady
109+
? 'yes'
110+
: 'unset';
111+
}
107112
}
108113
}
109114
catch(ex) {

src/js/storage.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@
110110
this.hiddenSettings[key] = hs[key];
111111
}
112112
}
113+
if ( typeof this.hiddenSettings.suspendTabsUntilReady === 'boolean' ) {
114+
this.hiddenSettings.suspendTabsUntilReady =
115+
this.hiddenSettings.suspendTabsUntilReady
116+
? 'yes'
117+
: 'unset';
118+
}
113119
}
114120
if ( vAPI.localStorage.getItem('immediateHiddenSettings') === null ) {
115121
this.saveImmediateHiddenSettings();

src/js/traffic.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,10 @@ return {
10021002
if (
10031003
vAPI.net.onBeforeReady instanceof Object &&
10041004
(
1005-
vAPI.net.onBeforeReady.experimental !== true ||
1006-
µBlock.hiddenSettings.suspendTabsUntilReady
1005+
vAPI.net.onBeforeReady.experimental !== true &&
1006+
µBlock.hiddenSettings.suspendTabsUntilReady !== 'no' ||
1007+
vAPI.net.onBeforeReady.experimental &&
1008+
µBlock.hiddenSettings.suspendTabsUntilReady === 'yes'
10071009
)
10081010
) {
10091011
vAPI.net.onBeforeReady.start();

0 commit comments

Comments
 (0)