-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rustdoc] Fix storage usage when disabled #61462
Conversation
I'm using Firefox 67.0. |
Hum, that's not very ideal. This fix is pretty simple but it'd have been nice to have a confirmation before actually merging it in case it was useless or not solving your issue. |
I finally managed to build it with |
Perfect, thanks! Just waiting for someone to review now. cc @rust-lang/rustdoc |
@@ -70,7 +70,7 @@ function usableLocalStorage() { | |||
return false; | |||
} | |||
|
|||
return true; | |||
return window.localStorage !== null && typeof window !== 'undefined'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the typeof window !== 'undefined'
check for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I'll update the code soon.
It looks like this is actually quite tricky to get right. How about borrowing the code from https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#Testing_for_availability instead? |
This code seems quite long to run (to be confirmed!). Saving its state should be enough though. |
Pro tip: when letting others test a build, you can |
@ollie27: The code sample you linked checks too many things for us (like if the |
977fc82
to
cf8bb56
Compare
@ishitatsuyuki Thanks for the tip! |
Updated. |
According to the MDN page they linked, we may still get errors about
Also, couldn't we move the final |
Interesting. I'll check on safari to see its behaviour. |
cf8bb56
to
4eb19d1
Compare
Excellent idea! I did it.
I tried on safari, both private and "normal" modes worked fine (I could set settings everything just fine). |
ping from triage @Manishearth waiting for your review on this |
@bors r+ (note for triage: i'm helping out with rustdoc reviews, but please don't block rustdoc reviews on me) |
Nothing happened apparently? I'll close then reopen and give it another try. |
@bors: r=Manishearth |
📌 Commit 4eb19d1 has been approved by |
[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
☀️ Test successful - checks-azure, checks-travis, status-appveyor |
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