openstyles / stylus

Stylus - Userstyles Manager
https://add0n.com/stylus.html
GNU General Public License v3.0
5.44k stars 304 forks source link

[Bug] browser.storage.sync is not available #1725

Closed ranvis closed 10 months ago

ranvis commented 10 months ago

Bug Report

Bug Description

Added styles disappear and some of UI elements of the extension ("Manage" openManage, "Find styles" findStyles, "Options" openOptions for example) is unresponsive. (Note that these names in English are guessed from the translation table.)

System Information

Additional Context

Not sure, but the symptom is similar to #1684.

The console only shows "Uncaught (in promise) Error: An unexpected error occurred - (location) undefined", but stepping through the lines shows:

Uncaught (in promise) Error: An unexpected error occurred                                  undefined:11:5
    getValue moz-extension://72269f71-4809-4833-8efd-a8fc9beb38c9/js/storage-util.js:11
    async* moz-extension://72269f71-4809-4833-8efd-a8fc9beb38c9/background/bg-prefs.js:35
    <anonymous> moz-extension://72269f71-4809-4833-8efd-a8fc9beb38c9/background/bg-prefs.js:40
// storage-util.js:
 7|  /** @namespace StorageExtras */
 8|  const StorageExtras = {
 9|    async getValue(key) {
10|      return (await this.get(key))[key];  // key: "settings"
11|    },
...
51|window.chromeSync = Object.assign(browser.storage.sync, StorageExtras, StorageExtrasSync);
// bg-prefs.js:
35|  chromeSync.getValue(STORAGE_KEY).then(orig => {

If I execute await browser.storage.sync.get('settings') from the console with the context of the extension, the same exception is thrown. If I install the original extension on a new profile, there's no problem, and the above snippet returns {"settings":{"editor.keyMap":"sublime"}}. Firefox Sync for addons is enabled in about:preferences#sync for the profile in case it is related.

tophf commented 10 months ago

It means something is broken in your browser profile or in the browser itself. Try uninstalling the extension and install it again. There's not much we can do about it. We can't just hide this error because it may indicate the browser profile is broken.

ranvis commented 10 months ago

tldr: Solved; nothing is wrong with the extension or the profile.

The issue still happened if I created a new profile on the same drive as the problematic profile. My profile is on a RAM-backed disk image. If I changed the virtual drive type from logical to physical, the extension worked again. I still don't konw what the actual problem is though.

Anyway, thank you for the reply. I had been under the wrong impression that some specific Firefox configuration was incompatible with the extension.

tophf commented 10 months ago

The problem is a bug in Firefox: it doesn't support some types of RAM drives. The same happens here with ImDisk.