about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-05-16 17:51:16 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2020-05-19 16:48:21 +0200
commited8478036c416694db5f51f6e43078a1c07532cf (patch)
treeecf0d481b818c4b7f0c19098298b3c6a6eb2076e
parent97f3eeec8216d7155c24674b9be55e7c672bcae3 (diff)
downloadrust-ed8478036c416694db5f51f6e43078a1c07532cf.tar.gz
rust-ed8478036c416694db5f51f6e43078a1c07532cf.zip
Fix going back in history to a search result page on firefox
-rw-r--r--src/librustdoc/html/static/main.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index a023d5a2d95..fffabcf79fe 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -2703,3 +2703,9 @@ function focusSearchBar() {
 function defocusSearchBar() {
     getSearchInput().blur();
 }
+
+// This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run
+// the JS, therefore preventing rustdoc from setting a few things required to be able to reload the
+// previous search results (if you navigated to a search result with the keyboard, pressed enter on
+// it to navigate to that result, and then came back to this page).
+window.onunload = function(){};