MDL-51461 core: Fix issue with client side mustache templates

This commit is contained in:
Andrew Hancox
2015-09-30 10:37:15 +01:00
parent 2dd2288807
commit cd5f5147df
2 changed files with 15 additions and 6 deletions
+1 -1
View File
@@ -1 +1 @@
define(["core/config"],function(a){var b=!1,c="",d="",e=null,f=function(){if(-1==a.jsrev)return!1;if("undefined"!=typeof window.localStorage)try{return e=window.localStorage,null!==e}catch(b){return!1}},g=function(a){return c+a},h=function(){var b=e.getItem(d);if(null===b)return void e.setItem(d,a.jsrev);var c=a.jsrev;c!=b&&(e.clear(),e.setItem(d,a.jsrev))},i=function(a){var b,c,d,e=0;if(0===a.length)return e;for(b=0,d=a.length;d>b;b++)c=a.charCodeAt(b),e=(e<<5)-e+c,e|=0;return e},j=function(){b=f();var e=a.wwwroot+"/"+a.jsrev,g=i(e);c=g+"/",e=a.wwwroot+"/",g=i(e),d=g+"/jsrev"};return j(),{get:function(a){return b?(h(),a=g(a),e.getItem(a)):!1},set:function(a,c){if(!b)return!1;h(),a=g(a);try{e.setItem(a,c)}catch(d){return!1}return!0}}});
define(["core/config"],function(a){var b=!1,c="",d="",e=null,f=function(){if(-1==a.jsrev)return!1;if("undefined"==typeof window.localStorage)return!1;var b="test";try{return e=window.localStorage,null===e?!1:(e.setItem(b,"1"),e.removeItem(b),!0)}catch(c){return!1}},g=function(a){return c+a},h=function(){var b=e.getItem(d);if(null===b)return void e.setItem(d,a.jsrev);var c=a.jsrev;c!=b&&(e.clear(),e.setItem(d,a.jsrev))},i=function(a){var b,c,d,e=0;if(0===a.length)return e;for(b=0,d=a.length;d>b;b++)c=a.charCodeAt(b),e=(e<<5)-e+c,e|=0;return e},j=function(){b=f();var e=a.wwwroot+"/"+a.jsrev,g=i(e);c=g+"/",e=a.wwwroot+"/",g=i(e),d=g+"/jsrev"};return j(),{get:function(a){return b?(h(),a=g(a),e.getItem(a)):!1},set:function(a,c){if(!b)return!1;h(),a=g(a);try{e.setItem(a,c)}catch(d){return!1}return!0}}});
+14 -5
View File
@@ -46,13 +46,22 @@ define(['core/config'], function(config) {
// Disable cache if debugging.
return false;
}
if (typeof(window.localStorage) !== "undefined") {
try {
localStorage = window.localStorage;
return localStorage !== null;
} catch (ex) {
if (typeof(window.localStorage) === "undefined") {
return false;
}
var testKey = 'test';
try {
localStorage = window.localStorage;
if (localStorage === null) {
return false;
}
// MDL-51461 - Some browsers misreport availability of local storage
// so check it is actually usable.
localStorage.setItem(testKey, '1');
localStorage.removeItem(testKey);
return true;
} catch (ex) {
return false;
}
};