Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the example with Firefox on macOS when managed storage isn't available. #554

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions favourite-colour/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ async function saveOptions(e) {
}

async function restoreOptions() {
let res = await browser.storage.managed.get('colour');
document.querySelector("#managed-colour").innerText = res.colour;
try {
let res = await browser.storage.managed.get('colour');
document.querySelector("#managed-colour").innerText = res.colour || "Could not find 'colour' in managed storage.";
} catch(error) {
if (error.message === "Managed storage manifest not found") {
document.querySelector("#managed-colour").innerText = "Managed storage manifest not found. Make sure it's stored in an appropriate location.";
} else {
document.querySelector("#managed-colour").innerText = `Unexpected managed storage error: ${error.message}`;
}
}

res = await browser.storage.sync.get('colour');
document.querySelector("#colour").value = res.colour || 'Firefox red';
Expand Down
Loading