Catch error when the creation of localStorage polyfill fails in the generic viewer
This commit is contained in:
parent
e62f18c975
commit
8bb19fac2d
@ -547,13 +547,20 @@ if (typeof PDFJS === 'undefined') {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
window.localStorage = {
|
// When the generic viewer is used in Firefox the following code will fail
|
||||||
data: Object.create(null),
|
// when the preference 'network.cookie.lifetimePolicy' is set to 1,
|
||||||
getItem: function (key) {
|
// see Mozilla bug 365772.
|
||||||
return this.data[key];
|
try {
|
||||||
},
|
window.localStorage = {
|
||||||
setItem: function (key, value) {
|
data: Object.create(null),
|
||||||
this.data[key] = value;
|
getItem: function (key) {
|
||||||
}
|
return this.data[key];
|
||||||
};
|
},
|
||||||
|
setItem: function (key, value) {
|
||||||
|
this.data[key] = value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Unable to create polyfill for localStorage');
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user