tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_connection_system_wpad.js (1511B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 add_task(async function test_system_wpad() {
      7  await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
      8  const connectionURL =
      9    "chrome://browser/content/preferences/dialogs/connection.xhtml";
     10 
     11  registerCleanupFunction(function () {
     12    Services.prefs.clearUserPref("network.proxy.system_wpad.allowed");
     13  });
     14 
     15  Services.prefs.setBoolPref("network.proxy.system_wpad.allowed", true);
     16  let dialog = await openAndLoadSubDialog(connectionURL);
     17  let dialogElement = dialog.document.getElementById("ConnectionsDialog");
     18  let systemWpad = dialog.document.getElementById("systemWpad");
     19  Assert.ok(!systemWpad.hidden, "Use system WPAD checkbox should be visible");
     20  let dialogClosingPromise = BrowserTestUtils.waitForEvent(
     21    dialogElement,
     22    "dialogclosing"
     23  );
     24  dialogElement.cancelDialog();
     25  await dialogClosingPromise;
     26 
     27  Services.prefs.setBoolPref("network.proxy.system_wpad.allowed", false);
     28  dialog = await openAndLoadSubDialog(connectionURL);
     29  dialogElement = dialog.document.getElementById("ConnectionsDialog");
     30  systemWpad = dialog.document.getElementById("systemWpad");
     31  Assert.ok(systemWpad.hidden, "Use system WPAD checkbox should be hidden");
     32  dialogClosingPromise = BrowserTestUtils.waitForEvent(
     33    dialogElement,
     34    "dialogclosing"
     35  );
     36  dialogElement.cancelDialog();
     37  await dialogClosingPromise;
     38 
     39  gBrowser.removeCurrentTab();
     40 });