rustdoc: fix GUI crash when searching for magic JS property values

This commit is contained in:
Michael Howell 2022-05-12 14:15:31 -07:00
parent c6499fd998
commit d3fd6bfd30
3 changed files with 22 additions and 2 deletions

View File

@ -119,7 +119,7 @@ window.initSearch = rawSearchIndex => {
*/
let searchIndex;
let currentResults;
const ALIASES = {};
const ALIASES = Object.create(null);
const params = searchState.getQueryStringParams();
// Populate search bar with query string search term when provided,
@ -1953,7 +1953,7 @@ window.initSearch = rawSearchIndex => {
}
if (aliases) {
ALIASES[crate] = {};
ALIASES[crate] = Object.create(null);
for (const alias_name in aliases) {
if (!hasOwnPropertyRustdoc(aliases, alias_name)) {
continue;

16
src/test/rustdoc-js/prototype.js vendored Normal file
View File

@ -0,0 +1,16 @@
// exact-check
const QUERY = ['constructor', '__proto__'];
const EXPECTED = [
{
'others': [],
'returned': [],
'in_args': [],
},
{
'others': [],
'returned': [],
'in_args': [],
},
];

View File

@ -0,0 +1,4 @@
// The alias needed to be there to reproduce the bug
// that used to be here.
#[doc(alias="other_alias")]
pub fn something_else() {}