[Pkg-javascript-commits] [pdf.js] 45/210: Catch error when the creation of localStorage polyfill fails in the generic viewer
David Prévot
taffit at moszumanska.debian.org
Thu Jun 5 14:21:00 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch upstream
in repository pdf.js.
commit 8bb19fac2d1b585bb15cd2ff93bf2bd459e5904c
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Tue Apr 29 10:49:08 2014 +0200
Catch error when the creation of localStorage polyfill fails in the generic viewer
---
web/compatibility.js | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/web/compatibility.js b/web/compatibility.js
index 21ac29f..31b6356 100644
--- a/web/compatibility.js
+++ b/web/compatibility.js
@@ -547,13 +547,20 @@ if (typeof PDFJS === 'undefined') {
return;
}
} catch (e) { }
- window.localStorage = {
- data: Object.create(null),
- getItem: function (key) {
- return this.data[key];
- },
- setItem: function (key, value) {
- this.data[key] = value;
- }
- };
+ // When the generic viewer is used in Firefox the following code will fail
+ // when the preference 'network.cookie.lifetimePolicy' is set to 1,
+ // see Mozilla bug 365772.
+ try {
+ window.localStorage = {
+ data: Object.create(null),
+ 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');
+ }
})();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list