-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Crashes applications when access to localStorage
is blocked
#41
Comments
Suggestion from this comment would resolve: #8 (comment) |
Lines 21 to 44 in 8ed05fb
@DevinBarth-Zen I've added not sure if it's solved, you can give it a try. |
Thank you for the release. Will test latest version and update you soon! |
This looks like it would still cause the same issue. I would suggest moving the default inside of your try/catch statement. function dealIncognito(storage) {
var _KEY = '_Is_Incognit', _VALUE = 'yes';
try {
// NOTE: set default storage when not passed in
if (!storage) {
storage = window.localStorage;
}
storage.setItem(_KEY, _VALUE);
storage.removeItem(_KEY);
} catch (e) {
Storage.prototype._data = {};
Storage.prototype.setItem = function (id, val) {
return this._data[id] = String(val);
};
Storage.prototype.getItem = function (id) {
return this._data.hasOwnProperty(id) ? this._data[id] : undefined;
};
Storage.prototype.removeItem = function (id) {
return delete this._data[id];
};
Storage.prototype.clear = function () {
return this._data = {};
}
storage = Storage;
}
finally { if (storage.getItem(_KEY) === _VALUE) storage.removeItem(_KEY); }
return storage;
} |
Closing this issue as it has been resolved! |
This causes applications to crash when access to localStorage has been blocked:
store.js/src/main.js
Line 1 in 3b336fa
Causes: rudderlabs/rudder-sdk-js/issues/689
The text was updated successfully, but these errors were encountered: