browser_ipprotection_optout.js (995B)
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 "use strict"; 6 7 const lazy = {}; 8 9 ChromeUtils.defineESModuleGetters(lazy, { 10 IPProtectionWidget: 11 "moz-src:///browser/components/ipprotection/IPProtection.sys.mjs", 12 }); 13 14 /** 15 * Tests that setting the optedOut pref removes the toolbar button 16 */ 17 add_task(async function test_opt_out() { 18 let buttonBefore = document.getElementById(lazy.IPProtectionWidget.WIDGET_ID); 19 20 Assert.ok( 21 BrowserTestUtils.isVisible(buttonBefore), 22 "ipprotection toolbar button should be present" 23 ); 24 25 Services.prefs.setBoolPref("browser.ipProtection.optedOut", true); 26 27 let buttonAfter = document.getElementById(lazy.IPProtectionWidget.WIDGET_ID); 28 29 Assert.ok(!buttonAfter, "ipprotection toolbar button should not be present"); 30 31 Services.prefs.clearUserPref("browser.ipProtection.optedOut"); 32 });