diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:00:38 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:00:38 -0500 |
commit | 8148615da179fdd60f19018e13b4e94b95609cc6 (patch) | |
tree | 771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/components/sessionstore/test/browser_dying_cache.js | |
parent | 494802c1be7888025b95260d23db187467d2b9dd (diff) | |
download | UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.gz UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.lz UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.xz UXP-8148615da179fdd60f19018e13b4e94b95609cc6.zip |
Remove browser tests - Part 1: The Tests (except for experiments)
Diffstat (limited to 'browser/components/sessionstore/test/browser_dying_cache.js')
-rw-r--r-- | browser/components/sessionstore/test/browser_dying_cache.js | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/browser/components/sessionstore/test/browser_dying_cache.js b/browser/components/sessionstore/test/browser_dying_cache.js deleted file mode 100644 index c573aa5d4..000000000 --- a/browser/components/sessionstore/test/browser_dying_cache.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; - -/** - * This test ensures that after closing a window we keep its state data around - * as long as something keeps a reference to it. It should only be possible to - * read data after closing - writing should fail. - */ - -add_task(function* test() { - // Open a new window. - let win = yield promiseNewWindowLoaded(); - - // Load some URL in the current tab. - let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY; - win.gBrowser.selectedBrowser.loadURIWithFlags("about:robots", flags); - yield promiseBrowserLoaded(win.gBrowser.selectedBrowser); - - // Open a second tab and close the first one. - let tab = win.gBrowser.addTab("about:mozilla"); - yield promiseBrowserLoaded(tab.linkedBrowser); - yield TabStateFlusher.flush(tab.linkedBrowser); - yield promiseRemoveTab(win.gBrowser.tabs[0]); - - // Make sure our window is still tracked by sessionstore - // and the window state is as expected. - ok("__SSi" in win, "window is being tracked by sessionstore"); - ss.setWindowValue(win, "foo", "bar"); - checkWindowState(win); - - let state = ss.getWindowState(win); - let closedTabData = ss.getClosedTabData(win); - - // Close our window. - yield BrowserTestUtils.closeWindow(win); - - // SessionStore should no longer track our window - // but it should still report the same state. - ok(!("__SSi" in win), "sessionstore does no longer track our window"); - checkWindowState(win); - - // Make sure we're not allowed to modify state data. - Assert.throws(() => ss.setWindowState(win, {}), - "we're not allowed to modify state data anymore"); - Assert.throws(() => ss.setWindowValue(win, "foo", "baz"), - "we're not allowed to modify state data anymore"); -}); - -function checkWindowState(window) { - let {windows: [{tabs}]} = JSON.parse(ss.getWindowState(window)); - is(tabs.length, 1, "the window has a single tab"); - is(tabs[0].entries[0].url, "about:mozilla", "the tab is about:mozilla"); - - is(ss.getClosedTabCount(window), 1, "the window has one closed tab"); - let [{state: {entries: [{url}]}}] = JSON.parse(ss.getClosedTabData(window)); - is(url, "about:robots", "the closed tab is about:robots"); - - is(ss.getWindowValue(window, "foo"), "bar", "correct extData value"); -} - -function shouldThrow(f) { - try { - f(); - } catch (e) { - return true; - } -} |