Skip to content

Fix managed settings not being applied on Chromium#2969

Open
RGBCube wants to merge 1 commit intokeepassxreboot:developfrom
RGBCube:fix-managed-settings-chromium
Open

Fix managed settings not being applied on Chromium#2969
RGBCube wants to merge 1 commit intokeepassxreboot:developfrom
RGBCube:fix-managed-settings-chromium

Conversation

@RGBCube
Copy link
Copy Markdown

@RGBCube RGBCube commented May 7, 2026

The Chromium branch of page.initSettings() had chrome.storage.managed.get('settings').then(...) that set page.settings = item.settings, but the surrounding code never awaited the promise, so page.settings = item.settings could randomly not use the managed storage.

Switch the Chromium branch to await + try/catch (matching the Firefox branch) and then merge the two branches into a single block.

  • ✅ Bug fix (non-breaking change that fixes an issue)

…owsers

The Chromium branch of `page.initSettings()` had `chrome.storage.managed.get('settings').then(...)` that set `page.settings = item.settings`, but the surrounding code never awaited the promise, so `page.settings = item.settings` could randomly not use the managed storage.

Switch the Chromium branch to await + try/catch (matching the Firefox branch) and then merge the two branches into a single block.
@varjolintu
Copy link
Copy Markdown
Member

Are you sure this works? I remember I had explicitly add a different handling for Chrome/Chromium because the default method didn't work.

@varjolintu varjolintu self-requested a review May 7, 2026 16:28
@varjolintu varjolintu added the bug label May 7, 2026
@RGBCube
Copy link
Copy Markdown
Author

RGBCube commented May 7, 2026

Yeah, the policy isn't getting applied at all for me even though await chrome.storage.managed.get(null) returns the values I've configured.

Also tested these:

  console.log('start');
  chrome.storage.managed.get('settings').then(m => console.log('then ran with:', m));
  console.log('after .then call (this prints first - that is the bug)');

> start
> after .then call (this prints first - that is the bug)
undefined // this is the return value of the expr
> then ran with: {settings: {}} // printed after

And:

  (async () => {
      const before = (await chrome.storage.local.get({ settings: {} })).settings;
      const managed = await chrome.storage.managed.get('settings');
      console.log('managed.get returned:', managed);

      if (managed?.settings) {
          await chrome.storage.local.set({ settings: managed.settings });
          console.log('local.settings overwritten with managed values');
      } else {
          console.warn('no managed settings');
      }

      const after = (await chrome.storage.local.get('settings')).settings;
      console.log({ before, after });
  })();

Which successfully configured the plugin. Feel free to test my patch out, I tested all of these in Helium which is an Ungoogled Chromium-like browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants