about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-07-12 12:04:25 +0000
committerbors <bors@rust-lang.org>2019-07-12 12:04:25 +0000
commit71f9384e3bec467158a628e2d11e77ffada16a90 (patch)
treeb4246f2ff89bf9980c35271092a7e51eaa424c6e /src/librustdoc
parentcd1381e91ff4889616eb0c87bf3c321ea2697d42 (diff)
parent4eb19d19a5c7313fd5f7a4e06a9b735dbbe2c9c6 (diff)
downloadrust-71f9384e3bec467158a628e2d11e77ffada16a90.tar.gz
rust-71f9384e3bec467158a628e2d11e77ffada16a90.zip
Auto merge of #61462 - GuillaumeGomez:fix-local-storage, r=Manishearth
[rustdoc] Fix storage usage when disabled

Fixes #61239.

@starblue: Can you give a try to this change please? I tried on chrome and firefox and both worked so if you're using another web browser, that might be useful. :)

r? @Manishearth
Diffstat (limited to 'src/librustdoc')
-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) {