Fix managed settings not being applied on Chromium#2969
Open
RGBCube wants to merge 1 commit intokeepassxreboot:developfrom
Open
Fix managed settings not being applied on Chromium#2969RGBCube wants to merge 1 commit intokeepassxreboot:developfrom
RGBCube wants to merge 1 commit intokeepassxreboot:developfrom
Conversation
…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.
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. |
Author
|
Yeah, the policy isn't getting applied at all for me even though 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 afterAnd: (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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Chromium branch of
page.initSettings()hadchrome.storage.managed.get('settings').then(...)that setpage.settings = item.settings, but the surrounding code never awaited the promise, sopage.settings = item.settingscould 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.