about summary refs log tree commit diff
diff options
context:
space:
mode:
-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) {