diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-06-16 11:45:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-16 11:45:02 +0200 |
commit | d6d968f7b927973830b91c3f43621471b443e29f (patch) | |
tree | b7c405b1aeeeea12600a7a734da423b1decf5468 /application/palemoon/base/content/sanitize.js | |
parent | ce2aae28168ac5dbd861768779ec40c14d92216e (diff) | |
parent | a97887a67742aa3f95c47ad79b3c4c3827565944 (diff) | |
download | UXP-d6d968f7b927973830b91c3f43621471b443e29f.tar UXP-d6d968f7b927973830b91c3f43621471b443e29f.tar.gz UXP-d6d968f7b927973830b91c3f43621471b443e29f.tar.lz UXP-d6d968f7b927973830b91c3f43621471b443e29f.tar.xz UXP-d6d968f7b927973830b91c3f43621471b443e29f.zip |
Merge pull request #503 from janekptacijarabaci/pm_findbar_4_sanitize
[PALEMOON] Sanitize - "Form and search history" sanitize also the Findbar text and history (Ctrl-Z)
Diffstat (limited to 'application/palemoon/base/content/sanitize.js')
-rw-r--r-- | application/palemoon/base/content/sanitize.js | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/application/palemoon/base/content/sanitize.js b/application/palemoon/base/content/sanitize.js index f2eb24a55..74372a4af 100644 --- a/application/palemoon/base/content/sanitize.js +++ b/application/palemoon/base/content/sanitize.js @@ -257,13 +257,18 @@ Sanitizer.prototype = { .getService(Components.interfaces.nsIWindowMediator); var windows = windowManager.getEnumerator("navigator:browser"); while (windows.hasMoreElements()) { - let currentDocument = windows.getNext().document; + let currentWindow = windows.getNext(); + let currentDocument = currentWindow.document; let searchBar = currentDocument.getElementById("searchbar"); if (searchBar) searchBar.textbox.reset(); - let findBar = currentDocument.getElementById("FindToolbar"); - if (findBar) - findBar.clear(); + let tabBrowser = currentWindow.gBrowser; + for (let tab of tabBrowser.tabs) { + if (tabBrowser.isFindBarInitialized(tab)) + tabBrowser.getFindBar(tab).clear(); + } + // Clear any saved find value + tabBrowser._lastFindValue = ""; } let change = { op: "remove" }; @@ -279,7 +284,8 @@ Sanitizer.prototype = { .getService(Components.interfaces.nsIWindowMediator); var windows = windowManager.getEnumerator("navigator:browser"); while (windows.hasMoreElements()) { - let currentDocument = windows.getNext().document; + let currentWindow = windows.getNext(); + let currentDocument = currentWindow.document; let searchBar = currentDocument.getElementById("searchbar"); if (searchBar) { let transactionMgr = searchBar.textbox.editor.transactionManager; @@ -290,8 +296,12 @@ Sanitizer.prototype = { return false; } } - let findBar = currentDocument.getElementById("FindToolbar"); - if (findBar && findBar.canClear) { + let tabBrowser = currentWindow.gBrowser; + let findBarCanClear = Array.some(tabBrowser.tabs, function (aTab) { + return tabBrowser.isFindBarInitialized(aTab) && + tabBrowser.getFindBar(aTab).canClear; + }); + if (findBarCanClear) { aCallback("formdata", true, aArg); return false; } |