]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10564 Exception when opening rule description in Google Chrome (#3169)
authorPascal Mugnier <pascal.mugnier@sonarsource.com>
Fri, 13 Apr 2018 10:43:54 +0000 (12:43 +0200)
committerGitHub <noreply@github.com>
Fri, 13 Apr 2018 10:43:54 +0000 (12:43 +0200)
server/sonar-web/src/main/js/app/components/RecentHistory.js
server/sonar-web/src/main/js/components/workspace/models/items.js

index 1bc7d308621ad8f6daf99441255d3479ba560c1a..64da44492ecc36f888aa88b3f13b7a17b49213b7 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..9a82d7ebbf7e8ae1f90b388e4bc690746ac44ad2 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() {