--- a/.eslintignore
+++ b/.eslintignore
@@ -70,16 +70,17 @@ view/**
browser/app/**
browser/branding/**/firefox-branding.js
# Gzipped test file.
browser/base/content/test/general/gZipOfflineChild.html
browser/base/content/test/urlbar/file_blank_but_not_blank.html
# New tab is likely to be replaced soon.
browser/base/content/newtab/**
# Test files that are really json not js, and don't need to be linted.
+browser/components/sessionstore/test/unit/data/sessionstore_counts.js
browser/components/sessionstore/test/unit/data/sessionstore_valid.js
browser/components/sessionstore/test/unit/data/sessionstore_invalid.js
# generated & special files in cld2
browser/components/translation/cld2/**
# Screenshots and Follow-on search are imported as a system add-on and have
# their own lint rules currently.
browser/extensions/followonsearch/**
browser/extensions/screenshots/**
new file mode 100644
--- /dev/null
+++ b/browser/components/sessionstore/test/unit/data/sessionstore_counts.js
@@ -0,0 +1,11 @@
+{
+ "windows": [
+ {"tabs": [
+ {"url": "http://example.com/1"},
+ {"url": "http://example.com/2"}
+ ]},
+ {"tabs": [
+ {"url": "http://example.com/3"}
+ ]}
+ ]
+}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/browser/components/sessionstore/test/unit/test_session_counts.js
@@ -0,0 +1,33 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+Cu.import("resource://gre/modules/Services.jsm");
+
+function run_test() {
+ let profd = do_get_profile();
+ const {SessionFile} = Cu.import("resource:///modules/sessionstore/SessionFile.jsm", {});
+
+ let sourceSession = do_get_file("data/sessionstore_counts.js");
+ sourceSession.copyTo(profd, "sessionstore.js");
+
+ let sourceCheckpoints = do_get_file("data/sessionCheckpoints_all.json");
+ sourceCheckpoints.copyTo(profd, "sessionCheckpoints.json");
+
+ // Compress sessionstore.js to sessionstore.jsonlz4
+ // and remove sessionstore.js
+ let oldExtSessionFile = SessionFile.Paths.clean.replace("jsonlz4", "js");
+ writeCompressedFile(oldExtSessionFile, SessionFile.Paths.clean).then(() => {
+ afterSessionStartupInitialization(async function cb() {
+ const {SessionStore} = Cu.import("resource:///modules/sessionstore/SessionStore.jsm", {});
+
+ let ssp = SessionStore.promiseInitialized;
+ SessionStore.init()
+ await ssp;
+
+ deepEqual(SessionStore.restorableObjectsCount, {windows: 2, tabs: 3});
+ do_test_finished();
+ });
+ });
+
+ do_test_pending();
+}
--- a/browser/components/sessionstore/test/unit/xpcshell.ini
+++ b/browser/components/sessionstore/test/unit/xpcshell.ini
@@ -1,17 +1,19 @@
[DEFAULT]
head = head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =
data/sessionCheckpoints_all.json
+ data/sessionstore_counts.js
data/sessionstore_invalid.js
data/sessionstore_valid.js
[test_backup_once.js]
[test_histogram_corrupt_files.js]
[test_migration_lz4compression.js]
[test_scalar_worker_restarts.js]
+[test_session_counts.js]
[test_shutdown_cleanup.js]
[test_startup_nosession_async.js]
[test_startup_session_async.js]
[test_startup_invalid_session.js]