tor-browser

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

test_clientValidation.js (891B)


      1 /**
      2 * Any copyright is dedicated to the Public Domain.
      3 * http://creativecommons.org/publicdomain/zero/1.0/
      4 */
      5 
      6 /**
      7 * Because this is an xpcshell global, it does not have an associated client id.
      8 * We turn on client validation for LocalStorage and ensure that we don't have
      9 * access to LocalStorage.
     10 */
     11 add_task(async function testSteps() {
     12  const principal = getPrincipal("http://example.com");
     13 
     14  info("Setting prefs");
     15 
     16  Services.prefs.setBoolPref(
     17    "dom.storage.enable_unsupported_legacy_implementation",
     18    false
     19  );
     20  Services.prefs.setBoolPref("dom.storage.client_validation", true);
     21 
     22  info("Getting storage");
     23 
     24  try {
     25    getLocalStorage(principal);
     26    ok(false, "Should have thrown");
     27  } catch (ex) {
     28    ok(true, "Did throw");
     29    is(ex.name, "NS_ERROR_FAILURE", "Threw right Exception");
     30    is(ex.result, Cr.NS_ERROR_FAILURE, "Threw with right result");
     31  }
     32 });