Bug 1323807 - Make sanitize.js handle the search bar having moved to the overflow or menu panel. r=mak

--HG--
extra : rebase_source : 9b166413b396a718d08c24737aa6715e2f369bb4
This commit is contained in:
Dão Gottwald 2016-12-16 19:57:08 +01:00
Родитель fc68eda3fc
Коммит a4f102118b
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -409,14 +409,20 @@ Sanitizer.prototype = {
let refObj = {}; let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_FORMDATA", refObj); TelemetryStopwatch.start("FX_SANITIZE_FORMDATA", refObj);
try { try {
// Clear undo history of all searchBars // Clear undo history of all search bars.
let windows = Services.wm.getEnumerator("navigator:browser"); let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) { while (windows.hasMoreElements()) {
let currentWindow = windows.getNext(); let currentWindow = windows.getNext();
let currentDocument = currentWindow.document; let currentDocument = currentWindow.document;
// searchBar.textbox may not exist due to the search bar binding
// not having been constructed yet if the search bar is in the
// overflow or menu panel. It won't have a value or edit history in
// that case.
let searchBar = currentDocument.getElementById("searchbar"); let searchBar = currentDocument.getElementById("searchbar");
if (searchBar) if (searchBar && searchBar.textbox)
searchBar.textbox.reset(); searchBar.textbox.reset();
let tabBrowser = currentWindow.gBrowser; let tabBrowser = currentWindow.gBrowser;
if (!tabBrowser) { if (!tabBrowser) {
// No tab browser? This means that it's too early during startup (typically, // No tab browser? This means that it's too early during startup (typically,