Prerequisites
Description
I'm managing a uBlock deployment where we need to update the policy on each deploy because the extension ID is not guaranteed to be consistent between deploys. After we update the policy, we restart Chromium, so we know the extension is running its js/start after the policy file has been written.
Meanwhile, uBlock does not consistently apply the policy's settings. I suspect there is a race condition somewhere, where e.g. Chromium does not guarantee chrome.storage.managed has loaded all its policy files before extensions start to load.
I suspect the chrome.storage.onChanged.addListener API could help fix this easily, and also let deployment admins hot-swap policies as necessary. For example, running µBlock.restoreAdminSettings().then(µBlock.loadSelectedFilterLists) seems to work, although I bet we'd want to adopt some other js/start callbacks too.
A specific URL where the issue occurs
N/A, but here's a Loom: https://www.loom.com/share/55aa104db8d649f1aa622b137ed01cfa
Steps to Reproduce
- Set up a policy in
/etc/chromium/policies/managed/ublock_policy.json
- uBlock doesn't load the policy unless you reload the extension, or quit and restart Chromium
- Now quit Chromium and update the policy
- When you reopen Chromium, uBlock may or may not have loaded the new policy data
Expected behavior:
I expected the policy to be consistently applied in Step 4, and hoped it would have been applied in Step 2
Actual behavior:
The policy was inconsistently applied (today 2/3 times; on Friday's testing 1/4 times) in Step 4, and is never applied in Step 2
Your environment
- uBlock Origin version: 1.35.2
- Browser Name and version: Chromium 90.0.4430.93 (via Mighty)
- Operating System and version: Linux
Prerequisites
Description
I'm managing a uBlock deployment where we need to update the policy on each deploy because the extension ID is not guaranteed to be consistent between deploys. After we update the policy, we restart Chromium, so we know the extension is running its
js/startafter the policy file has been written.Meanwhile, uBlock does not consistently apply the policy's settings. I suspect there is a race condition somewhere, where e.g. Chromium does not guarantee
chrome.storage.managedhas loaded all its policy files before extensions start to load.I suspect the
chrome.storage.onChanged.addListenerAPI could help fix this easily, and also let deployment admins hot-swap policies as necessary. For example, runningµBlock.restoreAdminSettings().then(µBlock.loadSelectedFilterLists)seems to work, although I bet we'd want to adopt some otherjs/startcallbacks too.A specific URL where the issue occurs
N/A, but here's a Loom: https://www.loom.com/share/55aa104db8d649f1aa622b137ed01cfa
Steps to Reproduce
/etc/chromium/policies/managed/ublock_policy.jsonExpected behavior:
I expected the policy to be consistently applied in Step 4, and hoped it would have been applied in Step 2
Actual behavior:
The policy was inconsistently applied (today 2/3 times; on Friday's testing 1/4 times) in Step 4, and is never applied in Step 2
Your environment