mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-02 17:19:38 +02:00
fix #2824: use dummy localStorage if none available
This commit is contained in:
parent
fd67c2db0e
commit
6fb6b4ed98
@ -1394,7 +1394,7 @@ vAPI.cloud = (function() {
|
|||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
defaultDeviceName: window.navigator.platform,
|
defaultDeviceName: window.navigator.platform,
|
||||||
deviceName: window.localStorage.getItem('deviceName') || ''
|
deviceName: vAPI.localStorage.getItem('deviceName') || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is used to find out a rough count of how many chunks exists:
|
// This is used to find out a rough count of how many chunks exists:
|
||||||
@ -1538,7 +1538,7 @@ vAPI.cloud = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( typeof details.deviceName === 'string' ) {
|
if ( typeof details.deviceName === 'string' ) {
|
||||||
window.localStorage.setItem('deviceName', details.deviceName);
|
vAPI.localStorage.setItem('deviceName', details.deviceName);
|
||||||
options.deviceName = details.deviceName;
|
options.deviceName = details.deviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +100,26 @@ try {
|
|||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/gorhill/uBlock/issues/2824
|
||||||
|
// Use a dummy localStorage if for some reasons it's not available.
|
||||||
|
if ( vAPI.localStorage instanceof Object === false ) {
|
||||||
|
vAPI.localStorage = {
|
||||||
|
length: 0,
|
||||||
|
clear: function() {
|
||||||
|
},
|
||||||
|
getItem: function() {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
key: function() {
|
||||||
|
throw new RangeError();
|
||||||
|
},
|
||||||
|
removeItem: function() {
|
||||||
|
},
|
||||||
|
setItem: function() {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
})(this);
|
})(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user