Repository navigation
Blocking "early" requests is not possible #1327
Description
Activity
Thing is, even the reading of the user settings -- which contains the state of the "advanced user mode" -- is asynchronous, so theoretically uBO could still be waiting on those settings to be loaded after it has handed control over to FF (i.e. finished executing its first-pass initialization code).
Oops, didn't realize that reading extension settings was async...
Since it has to be Gecko-only, this setting could be an about:config boolean pref named something like extensions.ublock0.blockEarlyRequests and not directly tied to any extension settings.
not directly tied to any extension settings
I have floated the idea of hidden settings since a while now to deal with a number of demands for specific behaviors sort of trivial to implement -- as long as there is no UI and no complicated code paths to add (actually there is already one such setting used in the logger, extensions.ublock0.loggerAutoDeleteVoidRows).
So this could be one of those settings. uBO could completely block a page from loading, and once initialization is done, it could force a reload of the pages which were blocked. The worry though here is about those behind-the-scene tabs (to not confuse with behind-the-scene requests) FF loads at start up time (like https://self-repair.mozilla.org/en-US/repair), will have to experiment to find out the results.
Fixed with 8c3da95. Need to be tested. If the fix does not help, then it will mean there is nothing uBO can do.
Behind-the-scene network requests are left untouched, regardless of filters/rules -- behind-the-scene network requests are tabless, there is no tab which can be force-reloaded once all filters/rules are loaded.
If the fix does not help, then it will mean there is nothing uBO can do.
Oddly, I can't reproduce this issue in uBlock Origin 1.9.17b4 even without flipping that setting. I'd say the fix definitely helped.
We'll flip the setting anyway and let you know any issues.
Thanks. 😃
Link to the documentation on how to enable early blocking: https://github.com/gorhill/uBlock/wiki/Advanced-settings#suspendtabsuntilready-experimental.
This is no longer experimental on Firefox: 41548be as of 1.17.5b17.
Firefox supports the ability to block early requests when a webRequest listener is registered in a certain way, see https://bugzilla.mozilla.org/show_bug.cgi?id=1503721.
Environment: SeaMonkey 2.39, uBlock Origin 1.6.0 (self build from c7f1027 ), new profile
Steps to reproduce:
(shouldn't matter but I'm starting SeaMonkey from command line like:
seamonkey -p. I have seen this issue starting SeaMonkey normally though.)(if re-testing with the same profile, clear cache before restarting SeaMonkey again, to make sure nothing is loaded from cache)
Expected results: image is blocked
Actual results: image appears on screen (it loaded). The image does not get blocked until reloading the page.
(Un-checking "Hide placeholders of blocked elements" makes it easier to see what's going on, but is not necessary to reproduce the problem.)
IIUC this is not technically possible to fix in non-Gecko-based-browsers because there the browser doesn't load extensions until after firing the first network requests, making this moot. However, in Gecko-based browsers the extensions are loaded before any requests are fired, and can have control over these requests.
It is not reasonable to expect that uBlock Origin can finish initializing all its filters before the browser can fire requests, so I would suggest to fix the problem something like this: When "I am an advanced user" is checked, allow the user to choose whether "early" network requests (requests fired before uBlock Origin is finished loading) are allowed or blocked (default to allow, and this setting locked to allow if "I am an advanced user" is un-checked). (Also preferably blocking "early" requests would not be strict-blocked - that is, not blocked unless requested by a document loaded in a browser window/tab. But if top-level documents would have to be blocked as well, it wouldn't end to be a big deal.)