]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10564 Exception when opening rule description in Google Chrome
authorPascal Mugnier <pascal.mugnier@sonarsource.com>
Fri, 13 Apr 2018 05:41:11 +0000 (07:41 +0200)
committerPascal Mugnier <pascal.mugnier@sonarsource.com>
Fri, 13 Apr 2018 05:41:11 +0000 (07:41 +0200)
server/sonar-web/src/main/js/app/components/RecentHistory.js
server/sonar-web/src/main/js/components/workspace/models/items.js

index 1bc7d308621ad8f6daf99441255d3479ba560c1a..23e4ff59f2066231ee32a478b42c77c9f67fe173 100644 (file)
@@ -51,13 +51,21 @@ export default class RecentHistory {
 
   static set(newHistory /*: History */) /*: void */ {
     if (window.localStorage) {
-      window.localStorage.setItem(STORAGE_KEY, JSON.stringify(newHistory));
+      try {
+        window.localStorage.setItem(STORAGE_KEY, JSON.stringify(newHistory));
+      } catch (e) {
+        /* Fail silently*/
+      }
     }
   }
 
   static clear() /*: void */ {
     if (window.localStorage) {
-      window.localStorage.removeItem(STORAGE_KEY);
+      try {
+        window.localStorage.removeItem(STORAGE_KEY);
+      } catch (e) {
+        /* Fail silently*/
+      }
     }
   }
 
index 655b836da8b87b8ae07719b3665873dd3e0ea4e7..d619d8d72ff08ff3dc9ee5b0c5f8db483d8bc3ad 100644 (file)
@@ -31,7 +31,11 @@ export default Backbone.Collection.extend({
 
   save() {
     const dump = JSON.stringify(this.toJSON());
-    window.localStorage.setItem(STORAGE_KEY, dump);
+    try {
+      window.localStorage.setItem(STORAGE_KEY, dump);
+    } catch (e) {
+      /* Fail silently*/
+    }
   },
 
   load() {