Skip to content

Rollup of 12 pull requests #82010

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

Closed
wants to merge 34 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2b9ba46
fix indefinite article in cell.rs
petar-dambovaliev Dec 12, 2020
86a4b27
Increment `self.index` before calling `Iterator::self.a.__iterator_ge…
sdroege Feb 4, 2021
55ca27f
use rwlock for accessing ENV
the8472 Feb 6, 2021
406fd3a
silence dead code warnings on windows
the8472 Feb 7, 2021
c7d9bff
HWASan support
Jan 23, 2021
9c34c14
HWASan documentation
Feb 8, 2021
2200cf1
avoid &mut on the read path since it now allows concurrent readers
the8472 Feb 8, 2021
44abad5
introduce StaticRWLock wrapper to make methods safe
the8472 Feb 8, 2021
1d9ac3c
Fix const generics in GAT
BoxyUwU Feb 9, 2021
4fc181d
split guard into read and write types
the8472 Feb 9, 2021
471ed5f
Use ItemCtxt::to_ty
camsteffen Feb 10, 2021
883988b
RELEASES.md 1.50: Group platform support notes together
joshtriplett Feb 10, 2021
d3fea13
bootstrap: Locate llvm-dwp based on llvm-config bindir
dtolnay Feb 10, 2021
2c4337a
Comments :3
BoxyUwU Feb 10, 2021
0422745
Fix comment smol mistakes
BoxyUwU Feb 10, 2021
0ffa2da
comma...
BoxyUwU Feb 10, 2021
a6d4137
Fix assosiated typo
therealprof Feb 10, 2021
7ca96ed
rewrite the comments
BoxyUwU Feb 10, 2021
f13bbea
Catch errors on localStorage setting failure
lovasoa Feb 10, 2021
16f0ccd
Fix getCurrentValue
lovasoa Feb 10, 2021
5034b50
bootstrap: fix wrong docs installation path
pietroalbini Feb 10, 2021
bfd1ccf
Seal the CommandExt, OsStrExt and OsStringExt traits
Amanieu Feb 10, 2021
02ab235
Rollup merge of #79983 - petar-dambovaliev:master, r=Dylan-DPC
Dylan-DPC Feb 11, 2021
9fad47a
Rollup merge of #81506 - vo4:hwasan, r=nagisa
Dylan-DPC Feb 11, 2021
94d1441
Rollup merge of #81741 - sdroege:zip-trusted-random-access-specializa…
Dylan-DPC Feb 11, 2021
9947da8
Rollup merge of #81850 - the8472:env-rwlock, r=m-ou-se
Dylan-DPC Feb 11, 2021
ebe4041
Rollup merge of #81911 - BoxyUwU:constgenericgaticefix, r=nikomatsakis
Dylan-DPC Feb 11, 2021
dd73aab
Rollup merge of #81947 - camsteffen:to-ty, r=jyn514
Dylan-DPC Feb 11, 2021
3a0fb95
Rollup merge of #81954 - joshtriplett:release-notes-group-platform-no…
Dylan-DPC Feb 11, 2021
daccdb3
Rollup merge of #81955 - dtolnay:dwp, r=Mark-Simulacrum
Dylan-DPC Feb 11, 2021
9e4c98d
Rollup merge of #81959 - therealprof:fix-typo, r=oli-obk
Dylan-DPC Feb 11, 2021
0db0a0a
Rollup merge of #81964 - lovasoa:patch-1, r=GuillaumeGomez
Dylan-DPC Feb 11, 2021
67cc5e4
Rollup merge of #81968 - pietroalbini:fix-doc-install-path, r=Mark-Si…
Dylan-DPC Feb 11, 2021
12c5065
Rollup merge of #81975 - Amanieu:seal2, r=m-ou-se
Dylan-DPC Feb 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Catch errors on localStorage setting failure
Fixes #81928

“Ask forgiveness not permission”  : this makes the code both simpler and more robust
  • Loading branch information
lovasoa authored Feb 10, 2021
commit f13bbea1243d35467601e82096b3db956774b2a5
31 changes: 8 additions & 23 deletions src/librustdoc/html/static/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,35 +89,20 @@ function hasOwnProperty(obj, property) {
return Object.prototype.hasOwnProperty.call(obj, property);
}

function usableLocalStorage() {
// Check if the browser supports localStorage at all:
if (typeof Storage === "undefined") {
return false;
}
// Check if we can access it; this access will fail if the browser
// preferences deny access to localStorage, e.g., to prevent storage of
// "cookies" (or cookie-likes, as is the case here).
try {
return window.localStorage !== null && window.localStorage !== undefined;
} catch(err) {
// Storage is supported, but browser preferences deny access to it.
return false;
}
}

function updateLocalStorage(name, value) {
if (usableLocalStorage()) {
localStorage[name] = value;
} else {
// No Web Storage support so we do nothing
try {
window.localStorage.setItem(name, value);
} catch(e) {
// localStorage is not accessible, do nothing
}
}

function getCurrentValue(name) {
if (usableLocalStorage() && localStorage[name] !== undefined) {
return localStorage[name];
try {
window.localStorage.getItem(name);
} catch(e) {
return null;
}
return null;
}

function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) {
Expand Down