Skip to content

Some packaged assets fetched from remote server on first install #3761

@gorhill

Description

@gorhill

Discussed in #3760

Originally posted by asWichita August 17, 2025
I like my system to boot from the default state, with all the customizations applied explicitly each time. For uBlockOrigin it means that only the unpacked extension and a backup file (as saved from Settings panel) persist between boots.

The simplest way to achieve this is to replace

const json = store.adminSettings;

in js/storage.js with

const response = await fetch(browser.runtime.getURL('ublock0.txt')) || {};
const json = await response.json() || {};

where ublock0.txt is put into extension's root and is actually a symbolic link to wherever I like to keep my backup.

It works great, except starting from version 1.54.0, the extension kind of freezes and doesn't populate Filter Lists panel in case the network is up but there is no access to the internet, even if Auto-update filter lists is disabled.

Of course, the culprit is the function in js/assets.js (added exactly in version 1.54.0), preceded with this comment:

// favorLocal: avoid making network requests whenever possible
// favorOrigin: avoid using CDN URLs whenever possible

If one puts

alert(contentURLs);

right before return statement, one sees that for public_suffix_list.dat and ublock-badlists the extension makes a network request anyway.

The simplest workaround is to comment out the if statement that rearranges order of CDN URLs in that function (apparently, it doesn't always work correctly) and place lines with local assets before the network ones in assets/assets.json (just for public_suffix_list.dat and ublock-badlists).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedissue has been addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions