mirror of
https://github.com/debug-js/debug.git
synced 2026-01-25 16:42:28 +00:00
Merge pull request #168 from yields/fix/security-error
fix: security error on safari - closes #167
This commit is contained in:
commit
2c384416fb
19
browser.js
19
browser.js
@ -21,7 +21,7 @@ var storage;
|
||||
if (typeof chrome !== 'undefined' && typeof chrome.storage !== 'undefined')
|
||||
storage = chrome.storage.local;
|
||||
else
|
||||
storage = window.localStorage;
|
||||
storage = localstorage();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
@ -156,3 +156,20 @@ function load() {
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage(){
|
||||
try {
|
||||
return window.localStorage;
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user