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

Firefox: An unexpected error occurred #444

Open
anijatsu opened this issue Dec 6, 2023 · 11 comments
Open

Firefox: An unexpected error occurred #444

anijatsu opened this issue Dec 6, 2023 · 11 comments
Assignees
Labels
bug firefox Issues specific to the Firefox browser

Comments

@anijatsu
Copy link

anijatsu commented Dec 6, 2023

Describe the bug
Tab Wrangler does not automatically close unused tabs, doesn't accept settings changes, has the Pause button greyed out.

To Reproduce
Open the Tab Wrangler toolbar icon.
Note that no tabs don't seem to close post the defined in settings interval.
Go to Settings page.
Try to change any of the settings.
Encounter a red error box in the top-right corner of the addon window: "An unexpected error occurred"
Expected behavior
The opposite of everything in "describe the bug" :)

Version (please complete the following information):

  • OS: [e.g. Windows, MacOS] Windows 11 23H2 22631.2715
  • Browser [e.g. Chrome, Firefox] Firefox Developer Edition 121.0b7 (64-bit)
  • Version [e.g. v6.0.0] 7.2.2

Additionally, the following appears in the Developer Tools panel for the addon, each time onNewTab event happens, or whenever I open the addon window:

    apply self-hosted:2337
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.sys.mjs:640
    wrapPromise resource://gre/modules/ExtensionCommon.sys.mjs:968
    (Async: promise callback)
    wrapPromise resource://gre/modules/ExtensionCommon.sys.mjs:927
    wrapPromise resource://gre/modules/ExtensionCommon.sys.mjs:926
    callAsyncFunction resource://gre/modules/ExtensionCommon.sys.mjs:1165
    callAsyncFunction resource://gre/modules/ExtensionChild.sys.mjs:720
    callAndLog resource://gre/modules/ExtensionChild.sys.mjs:700
    callAsyncFunction resource://gre/modules/ExtensionChild.sys.mjs:719
    stub resource://gre/modules/Schemas.sys.mjs:2893
    setValue moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    set moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    _initLockedIds moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    InterpretGeneratorResume self-hosted:1465
    AsyncFunctionNext self-hosted:852
    (Async: async)
    init moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    apply self-hosted:2337
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.sys.mjs:640
    wrapPromise resource://gre/modules/ExtensionCommon.sys.mjs:920
    withLastError resource://gre/modules/ExtensionCommon.sys.mjs:839
    wrapPromise resource://gre/modules/ExtensionCommon.sys.mjs:908
    (Async: promise callback)
    wrapPromise resource://gre/modules/ExtensionCommon.sys.mjs:890
    callAsyncFunction resource://gre/modules/ExtensionCommon.sys.mjs:1165
    callAsyncFunction resource://gre/modules/ExtensionChild.sys.mjs:720
    callAndLog resource://gre/modules/ExtensionChild.sys.mjs:700
    callAsyncFunction resource://gre/modules/ExtensionChild.sys.mjs:719
    stub resource://gre/modules/Schemas.sys.mjs:2893
    init moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    init moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    Xl moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:33
    fu moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:33
    du moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:33
    w moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    M moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    p moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    p moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    l moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    (Async: EventListener.handleEvent)
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    n moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    n moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    n moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:33
    n moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:33
    n moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:6
    n moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:43
    n moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1
    <anonymous> moz-extension://8127e2e9-19cb-4d4b-8d54-76d11a4a7098/popup.entry.js:1

Screenshot 2023-12-06 121455
Screenshot 2023-12-06 121502
Screenshot 2023-12-06 121514
Screenshot 2023-12-06 121706
Screenshot 2023-12-06 121821

@anijatsu
Copy link
Author

anijatsu commented Dec 6, 2023

Reinstalling the addon (right-click > Remove Extension, then redownloading it off of Mozilla's webstore) does not fix it either, it just cleared my tab list and reset the settings to default values. I still can't change them.

@ssorallen
Copy link
Member

Ugh! Okay thank you, let me figure out what is going on.

@ssorallen ssorallen added bug firefox Issues specific to the Firefox browser labels Dec 6, 2023
@ssorallen ssorallen self-assigned this Dec 6, 2023
@ssorallen
Copy link
Member

This looks like it's failing whenever it tries to write to chrome.storage.sync, both of those stacktraces go to the extension trying to write to extension storage.

Can you try debugging the extension and seeing how much storage it's using?

chrome.storage.sync.getBytesInUse().then((val) => console.log(val))

This should be a small value. Also try setting a value from inside debugging the extension to see if there is an issue in writing to storage?

chrome.storage.sync.set({"testVal": "test"}) // write the val
chrome.storage.sync.get("testVal").then((val) => console.log(val)) // read it back

@anijatsu
Copy link
Author

anijatsu commented Dec 9, 2023

chrome.storage.sync.getBytesInUse().then((val) => console.log(val))
Promise { <state>: "pending" }
​
<state>: "rejected"
​
<reason>: Error: An unexpected error occurred
​
<prototype>: Promise.prototype { … }

Uncaught (in promise) Error: An unexpected error occurred undefined
chrome.storage.sync.set({"testVal": "test"}) // write the val
Promise { <state>: "pending" }
​
<state>: "rejected"
​
<reason>: Error: An unexpected error occurred
​
<prototype>: Promise.prototype { … }

Uncaught (in promise) Error: An unexpected error occurred undefined
chrome.storage.sync.get("testVal").then((val) => console.log(val)) // read it back
Promise { <state>: "pending" }
​
<state>: "rejected"
​
<reason>: Error: An unexpected error occurred
​
<prototype>: Promise.prototype { … }

Uncaught (in promise) Error: An unexpected error occurred
chrome.storage.local.clear()
Promise { <state>: "pending" }
​
<state>: "fulfilled"
​
<value>: undefined
​
<prototype>: Promise.prototype { … }

chrome.storage.sync.clear()
Promise { <state>: "pending" }
​
<state>: "rejected"
​
<reason>: Error: An unexpected error occurred
​
<prototype>: Promise.prototype { … }

I think there might be an issue with the sync storage (object?). I'm not sure how to access it outside of the API, or if there's some more bruteforce-y command to outright remove all of its data?

@ssorallen
Copy link
Member

I fixed a likely cause of this error in commit 03b766d. I am pushing out v7.2.3 with the fix.

@ssorallen
Copy link
Member

Closing this as fixed with v7.2.3. Please upgrade to the latest version and let me know if you still have this issue. Thanks again for reporting.

@anijatsu
Copy link
Author

And thank you for the update! Unfortunately it doesn't seem to have helped here.
Is there any other information I could provide?

From my own tinkering:
Out of curiosity, and since chrome.storage API is returning an unspecified error on the simple .get() call, I've started looking into where the extensions store their data as physical files, and sure enough I found the sqlite database file I expected. It doesn't seem corrupted. I can open it with sqlitebrowser v. 3.12.2 and browse around the tables, but they're mostly devoid of data.
The location I found it in is:
\storage\default\moz-extension+++<extension's Internal UUID>^userContextId=<containers.json ID>\idb

(extension's internal UUID refers to the Internal UUID seen in about:debugging for the plugin,
containers.json ID refers to the key with property-value pair: "name": "userContextIdInternal.webextStorageLocal", stored in the containers.json file)

This file being empty seems to correlate to the description in the following StackOverflow post:
https://stackoverflow.com/questions/54920939/parsing-fb-puritys-firefox-idb-indexed-database-api-object-data-blob-from-lin/59923297#59923297

An utility designed to read the blobs embedded in these sqLite files is mentioned, but I had no luck running it. It seems to be unable to read my prefs.js file (I get the message: "Failed to look up internal UUID for extension ID: None (is the extension installed?)" even if I move the prefs.js file away).

I have tried to move the file away while the browser was turned off, in hopes of having it recreated by the addon, and it seems to be - a new file appears in its place, with a different SHA256 hash, but trying to do any changes in the addon's settings still causes the same error with the same console error message.

I've also checked the profile-wide storage-sync-v2.sqlite file out of my own accord, but while the extension is in there, (storage_sync_data table, key being the Extension ID from about:debugging), it has valid JSON data containing e.g. the domain whitelist and so on. So, I don't think that's the place that chrome.storage refers to, and I'd focus my attention on the idb*.sqlite file... if I only managed to read it.

I'll update the comment or write a new one if I manage any significant development.

@ssorallen ssorallen reopened this Dec 13, 2023
@ssorallen
Copy link
Member

  • Can you try running one of the failing commands again and then inspecting chrome.runtime.lastError? That may include more information about what is going wrong.
  • Does deleting the Sqlite DB fix the issue?
  • Can you call chrome.storage.sync.clear to empty the DB of all data and then reinstall the extension?

@nkitsaini
Copy link

Just want to point out that I was having similar issue, I did not see the logs back then but basically none of the tabs were getting closed for past few weeks. But reinstalling the latest extension version and restarting firefox fixed that. I did not observe the "A unexpected error occurred" popup either.

Not sure which recent release fixed it as the reinstall was required but thanks for the fix! 🙇

@ssorallen
Copy link
Member

@nkitsaini Thanks for reporting. I fixed a known issue in v7.2.3 that was likely causing your issue. Let me know if you run into anything else and thanks for bearing with the mess as I upgrade for Chrome's Manifest v3.

@anijatsu
Copy link
Author

anijatsu commented Dec 14, 2023

  • Can you try running one of the failing commands again and then inspecting chrome.runtime.lastError? That may include more information about what is going wrong.

    • Does deleting the Sqlite DB fix the issue?

    • Can you call chrome.storage.sync.clear to empty the DB of all data and then reinstall the extension?

I have ran it for chrome.storage.local at first by accident, and it seems that only chrome.storage.sync is impacted.

I'm not sure but maybe it's something to do with what the Firefox account (now called Mozilla account) has stored and is now unable to get rid of?

chrome.storage.local.clear()
    Promise { <state>: "pending" }
        <state>: "fulfilled"
        <value>: undefined
        <prototype>: Promise.prototype {  }

chrome.storage.sync.clear()
    Promise { <state>: "pending" }
        <state>: "rejected"
        <reason>: Error: An unexpected error occurred
            columnNumber: 1
            fileName: "undefined"
            lineNumber: 0
            message: "An unexpected error occurred"
            stack: ""
        <prototype>: Error.prototype { stack: "",  }
        <prototype>: Promise.prototype {  }

chrome.runtime.lastError
    null
Screenshot of the same chrome.storage functions' outputs

image

Moving the extension's idb folder away doesn't seem to have helped.

I have noticed one additional error that shows up when I try to export the saved browser tabs from the extension window's Settings tab. Is that the same API call the extension tries to run?
can't access property "savedTabs", e is undefined
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug firefox Issues specific to the Firefox browser
Projects
None yet
Development

No branches or pull requests

3 participants