-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
The shim does not work on Safari 8 or 9 #327
Comments
I unfortunately don't have time now to take a closer look at this. We do attempt to set There is a "non-invasive" file in <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="node_modules/babel-polyfill/browser.js"></script>
<script src="dist/indexeddbshim-noninvasive.js"></script>
</head>
<body>
<script>
const obj = {};
setGlobalVars(obj);
console.log(obj.IDBKeyRange.lowerBound('a'));
</script>
</body>
</html> Note that you can also pass in a config object on the second argument. For completeness' sake (though probably only of interest to users doing testing, e.g., for setGlobalVars(obj, {replaceNonIDBGlobals: true}); ...which will attempt to add other shimmed objects on which we rely, i.e., You might take a look at https://github.com/axemclion/IndexedDBShim/blob/master/src/setGlobalVars.js , the file responsible for setting the globals (or pseudo-globals depending on how you call its shim). Of course if it is possible for us to provide a change or fix targeting the affected Safari versions within the above-mentioned file in a way that makes sense, that'd be ideal, so feel free to pass on suggestions. It's just not on my plate to explore these things myself. A PR to better document this (if it is not already so) would also be welcome. Let us know what you may discover. |
Thanks a lot @brettz9. It definitely looks like an idea for me to try using the non-invasive file. These are things that our users do not have the time to figure out themselves so I hope to find a simple and easy way to just making this work. I will try (I hope to have the time) to incorporate the shim in dexie tests (both version 2 and 3/non-invasive) to see which one seems most stable as of now. |
Regarding Safari 9
Can it be solved by setting
|
Tested on Browserstack on iOS v9 Safari ( an IPhone 6S Plus).
Safari 9
...does not do its job to patch the browser no matter manually calling shimIndexedDB.__useShim() or not.
Expected behavior: window.indexedDB references the shim instead of the native.
Actual behavior: window.indexedDB still is native.
But the following works perfectly:
Safari 8
As Safari 8 blocks from patching window.indexedDB, it will not be enough to call shimIndexedDB.__useShim() to support Safari 8. This is not something that can be solved within the shim. But we had a solution for it in Dexie 1.x where it automatically used the shim in case it was included.
Now with Dexie 2.x, the developer will have to manually connect the shim with Dexie.dependencies. I have found no way of doing this in IndexedDBShim 3.x as it does not expose IDBKeyRange publicly what I could see. Dexie 1.x solved this with IndexedDBShim 2.x under the hood for anyone who had included the shim, but due to this comment I removed that part in Dexie 2.x.
My Current Recommendations
I've put a recommended way for Dexie users to support older versions of Safari here: https://stackoverflow.com/a/50855488/1282923
Please advice how this could be improved.
The text was updated successfully, but these errors were encountered: