browser_sanitize-formhistory.js (1118B)
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/. */ 4 5 add_task(async function test() { 6 // This test relies on the form history being empty to start with delete 7 // all the items first. 8 // The TabContextMenu initializes its strings only on a focus or mouseover event. 9 // Calls focus event on the TabContextMenu early in the test. 10 gBrowser.selectedTab.focus(); 11 await FormHistory.update({ op: "remove" }); 12 13 // Sanitize now so we can test the baseline point. 14 await Sanitizer.sanitize(["formdata"]); 15 await gFindBarPromise; 16 ok(!gFindBar.hasTransactions, "pre-test baseline for sanitizer"); 17 18 gFindBar.getElement("findbar-textbox").value = "m"; 19 ok(gFindBar.hasTransactions, "formdata can be cleared after input"); 20 21 await Sanitizer.sanitize(["formdata"]); 22 is( 23 gFindBar.getElement("findbar-textbox").value, 24 "", 25 "findBar textbox should be empty after sanitize" 26 ); 27 ok(!gFindBar.hasTransactions, "No transactions after sanitize"); 28 });