summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/test/browser_467409-backslashplosion.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
commit8148615da179fdd60f19018e13b4e94b95609cc6 (patch)
tree771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/components/sessionstore/test/browser_467409-backslashplosion.js
parent494802c1be7888025b95260d23db187467d2b9dd (diff)
downloadUXP-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_467409-backslashplosion.js')
-rw-r--r--browser/components/sessionstore/test/browser_467409-backslashplosion.js74
1 files changed, 0 insertions, 74 deletions
diff --git a/browser/components/sessionstore/test/browser_467409-backslashplosion.js b/browser/components/sessionstore/test/browser_467409-backslashplosion.js
deleted file mode 100644
index 0e990c614..000000000
--- a/browser/components/sessionstore/test/browser_467409-backslashplosion.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test Summary:
-// 1. Open about:sessionrestore where formdata is a JS object, not a string
-// 1a. Check that #sessionData on the page is readable after JSON.parse (skipped, checking formdata is sufficient)
-// 1b. Check that there are no backslashes in the formdata
-// 1c. Check that formdata doesn't require JSON.parse
-//
-// 2. Use the current state (currently about:sessionrestore with data) and then open that in a new instance of about:sessionrestore
-// 2a. Check that there are no backslashes in the formdata
-// 2b. Check that formdata doesn't require JSON.parse
-//
-// 3. [backwards compat] Use a stringified state as formdata when opening about:sessionrestore
-// 3a. Make sure there are nodes in the tree on about:sessionrestore (skipped, checking formdata is sufficient)
-// 3b. Check that there are no backslashes in the formdata
-// 3c. Check that formdata doesn't require JSON.parse
-
-const CRASH_STATE = {windows: [{tabs: [{entries: [{url: "about:mozilla" }]}]}]};
-const STATE = createEntries(CRASH_STATE);
-const STATE2 = createEntries({windows: [{tabs: [STATE]}]});
-const STATE3 = createEntries(JSON.stringify(CRASH_STATE));
-
-function createEntries(sessionData) {
- return {
- entries: [{url: "about:sessionrestore"}],
- formdata: {id: {sessionData: sessionData}, url: "about:sessionrestore"}
- };
-}
-
-add_task(function test_nested_about_sessionrestore() {
- // Prepare a blank tab.
- let tab = gBrowser.addTab("about:blank");
- let browser = tab.linkedBrowser;
- yield promiseBrowserLoaded(browser);
-
- // test 1
- yield promiseTabState(tab, STATE);
- yield checkState("test1", tab);
-
- // test 2
- yield promiseTabState(tab, STATE2);
- yield checkState("test2", tab);
-
- // test 3
- yield promiseTabState(tab, STATE3);
- yield checkState("test3", tab);
-
- // Cleanup.
- gBrowser.removeTab(tab);
-});
-
-function* checkState(prefix, tab) {
- // Flush and query tab state.
- yield TabStateFlusher.flush(tab.linkedBrowser);
- let {formdata} = JSON.parse(ss.getTabState(tab));
-
- ok(formdata.id["sessionData"], prefix + ": we have form data for about:sessionrestore");
-
- let sessionData_raw = JSON.stringify(formdata.id["sessionData"]);
- ok(!/\\/.test(sessionData_raw), prefix + ": #sessionData contains no backslashes");
- info(sessionData_raw);
-
- let gotError = false;
- try {
- JSON.parse(formdata.id["sessionData"]);
- } catch (e) {
- info(prefix + ": got error: " + e);
- gotError = true;
- }
- ok(gotError, prefix + ": attempting to JSON.parse form data threw error");
-}