summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/test/browser_665702-state_session.js
blob: fc024e22471a64054cf5fefbb64c7e43faec0fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

function compareArray(a, b) {
  if (a.length !== b.length) {
    return false;
  }
  for (let i = 0; i < a.length; i++) {
    if (a[i] !== b[i]) {
      return false;
    }
  }
  return true;
}

function test() {
  let currentState = JSON.parse(ss.getBrowserState());
  ok(currentState.session, "session data returned by getBrowserState");

  let keys = Object.keys(currentState.session);
  let expectedKeys = ["lastUpdate", "startTime", "recentCrashes"];
  ok(
    compareArray(keys.sort(), expectedKeys.sort()),
    "session object from getBrowserState has correct keys"
  );
}