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

Per tab storage for settings & values #351

Closed
ffoodd opened this issue May 3, 2019 · 2 comments
Closed

Per tab storage for settings & values #351

ffoodd opened this issue May 3, 2019 · 2 comments

Comments

@ffoodd
Copy link
Owner

ffoodd commented May 3, 2019

Related to #292, we need to store tools status and values for each tab before making webextension the main way to use a11y.css.

This is somehow working in Nightly with my profile (extensions and custom config) but not in an empty profile:

function storeTextSpacingStatus(strStatus) {
	// Get a11y.css stored levels
	let getStatus = browser.storage.local.get("textSpacingStatus");
	getStatus.then(
		// when we got something
		(item) => {
			if (item && item.textSpacingStatus) {
				// Get current tab ID
				browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => {
					// Get current stored value
					let textSpacingStatus = item.textSpacingStatus;
					// Add or replace current tab's value
					textSpacingStatus[tabs[0].id] = {"status": strStatus};
					// And set it back to the storage
					let setting = browser.storage.local.set({ textSpacingStatus });
					setting.then(null, onError); // just in case
				});
			}
		}
	);
}

I wasn't able to find out why this is working… Or rather why this is not working with a new profile.

FWIW, Mozilla's webextension-polyfill is loaded everywhere within webextension.Please help :D

@ffoodd
Copy link
Owner Author

ffoodd commented May 3, 2019

Might be somehow related: mozilla/webextension-polyfill#102

@ffoodd
Copy link
Owner Author

ffoodd commented May 9, 2019

Working in Firefox and Chromium next to #352

@ffoodd ffoodd closed this as completed May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant