about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-06-02 16:57:26 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-06-11 20:59:59 +0200
commit4eb19d19a5c7313fd5f7a4e06a9b735dbbe2c9c6 (patch)
tree6f886c1cab07f46a912d688aba12e13a186823ef
parent8b36867093fb774bcbd9f787cbc470a5f44c1310 (diff)
downloadrust-4eb19d19a5c7313fd5f7a4e06a9b735dbbe2c9c6.tar.gz
rust-4eb19d19a5c7313fd5f7a4e06a9b735dbbe2c9c6.zip
Fix storage usage when disabled
-rw-r--r--src/librustdoc/html/static/storage.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js
index d5dea247d28..e3927350d11 100644
--- a/src/librustdoc/html/static/storage.js
+++ b/src/librustdoc/html/static/storage.js
@@ -64,13 +64,11 @@ function usableLocalStorage() {
     // preferences deny access to localStorage, e.g., to prevent storage of
     // "cookies" (or cookie-likes, as is the case here).
     try {
-        window.localStorage;
+        return window.localStorage !== null && window.localStorage !== undefined;
     } catch(err) {
         // Storage is supported, but browser preferences deny access to it.
         return false;
     }
-
-    return true;
 }
 
 function updateLocalStorage(name, value) {