From 4eb19d19a5c7313fd5f7a4e06a9b735dbbe2c9c6 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 2 Jun 2019 16:57:26 +0200 Subject: [PATCH] Fix storage usage when disabled --- src/librustdoc/html/static/storage.js | 4 +--- 1 file changed, 1 insertion(+), 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) {