Backed out changeset 7969278ce39f (bug 1869884) for causing failures on browser_sanit...
[gecko.git] / browser / base / content / test / sanitize / browser_sanitize-formhistory.js
blob903dbbfebd7ee2602fbb0e9a007147f8c2c8700f
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  *  License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 add_task(async function test() {
6   let prefs = ["history", "historyAndFormData"];
8   for (let pref of prefs) {
9     // This test relies on the form history being empty to start with delete
10     // all the items first.
11     // The TabContextMenu initializes its strings only on a focus or mouseover event.
12     // Calls focus event on the TabContextMenu early in the test.
13     gBrowser.selectedTab.focus();
14     await FormHistory.update({ op: "remove" });
16     // Sanitize now so we can test the baseline point.
17     await Sanitizer.sanitize([pref]);
18     await gFindBarPromise;
19     ok(!gFindBar.hasTransactions, "pre-test baseline for sanitizer");
21     gFindBar.getElement("findbar-textbox").value = "m";
22     ok(gFindBar.hasTransactions, "formdata can be cleared after input");
24     await Sanitizer.sanitize(["formdata"]);
25     is(
26       gFindBar.getElement("findbar-textbox").value,
27       "",
28       "findBar textbox should be empty after sanitize"
29     );
30     ok(!gFindBar.hasTransactions, "No transactions after sanitize");
31   }
32 });