tor-browser

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

test_session_schema.js (795B)


      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_schema_smoke_test() {
      7  let sessionData = await IOUtils.readJSON(
      8    PathUtils.join(do_get_cwd().path, "data", "sessionstore_complete.json")
      9  );
     10  let result;
     11 
     12  Assert.ok(
     13    sessionData.version[0],
     14    "Looks like we loaded up the session data ok"
     15  );
     16 
     17  try {
     18    result = await SessionStore.validateState(sessionData);
     19  } catch (ex) {
     20    info("Exception validating session data:" + ex.message);
     21  }
     22 
     23  if (!result.valid) {
     24    info(`Failed validation: ${JSON.stringify(result.errors)}`);
     25  }
     26  Assert.ok(result, "Got a validation result object");
     27 
     28  Assert.ok(result.valid, "the session file was validated against the schema");
     29 });