From eff69f5b77575dcd3fe8605c4575d67162e1df0c Mon Sep 17 00:00:00 2001 From: Kristoffer Walker Date: Mon, 28 Jun 2010 04:22:55 +0800 Subject: [PATCH] bug: window.localStorage in Firefox Firefox 3.6.4 throws an error when trying to access `window.localStorage`. (at least from `chrome://` URLs in extensions if not more) --- lib/less/browser.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/less/browser.js b/lib/less/browser.js index 579d1e15..8eff0915 100644 --- a/lib/less/browser.js +++ b/lib/less/browser.js @@ -49,7 +49,12 @@ if (less.env === 'development') { less.optimization = 3; } -var cache = (typeof(window.localStorage) === 'undefined') ? null : window.localStorage; +var cache; +try { + cache = (typeof(window.localStorage) === 'undefined') ? null : window.localStorage; +} catch (e) { + cache = null; +} // // Get all tags with the 'rel' attribute set to "stylesheet/less"