Bug 695322: fix browser_privatebrowsing_searchbar.js to clean up after itself and succeed when run individually, r=ehsan

This commit is contained in:
Gavin Sharp 2011-10-20 10:41:36 -04:00
parent 6b1a73e5bb
commit 152c5be816

View File

@ -41,15 +41,23 @@
function test() {
// initialization
waitForExplicitFinish();
gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
// fill in the search bar with something
// fill in the search bar with something, twice to populate undo history
const kTestSearchString = "privatebrowsing";
let searchBar = BrowserSearch.searchBar;
searchBar.value = kTestSearchString + "foo";
searchBar.value = kTestSearchString;
gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
registerCleanupFunction(function () {
searchBar.textbox.reset();
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
});
// enter private browsing mode
pb.privateBrowsingEnabled = true;
@ -85,8 +93,6 @@ function test() {
gBrowser.removeTab(gBrowser.selectedTab);
pb.privateBrowsingEnabled = false;
// cleanup
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
finish();
}, true);
}