Open inexorabletash opened 1 year ago
In Firefox we return our unknown error because we cleared the global from the factory when the iframe's window was cleaned up. In Firefox devtools this looks like:
DOMException: The operation failed for reasons unrelated to the database itself and not covered by any other error code.
We can probably improve the exception message we throw in Firefox at least.
Throwing seems appropriate for a case like this where the API does not return a Promise.
Agreed re: throwing.
For web locks it's spec'd to reject with an "InvalidStateError" DOMException, which seems reasonable to me. I'd prefer to reserve UnknownError for cases when we're in unspecable/untestable territory, whereas this is just an edge case but totally specable/testable. I don't feel strongly about it though.
FWIW, in Chrome localStorage.getItem() throws a "SecurityError" DOMException and caches.open() returns undefined (not a Promise!). Wheee.
Yes, InvalidStateError seems better and we're fine to change Firefox's behavior here (and have tests that enforce that as the right exception). Thanks!
FWIW, i'm also getting this error with the MetaMask extension, and it completely fails to start now.
UnknownError: The operation failed for reasons unrelated to the database itself and not covered by any other error code.
i have zero clue what goes wrong, where, and how to fix it. deleting the storage would mean hours of work lost.
FWIW, i'm also getting this error with the MetaMask extension, and it completely fails to start now.
UnknownError: The operation failed for reasons unrelated to the database itself and not covered by any other error code.
This sounds browser specific. If this is on Firefox, please file a bug against our IndexedDB component and I can respond there. If this is on another browser, please file against that browser (or the MetaMask extension).
Related to #381
i = document.createElement('iframe');
i.src = location;
document.body.append(i);
ii = i.contentWindow.indexedDB;
ii.open('db');
- returns IDBOpenDBRequesti.remove();
ii.open('db');
- returns ???In Chrome this returns null. Throwing is probably more correct behavior. I haven't tested in other browsers.