summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/test/browser_456342.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /browser/components/sessionstore/test/browser_456342.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/components/sessionstore/test/browser_456342.js')
-rw-r--r--browser/components/sessionstore/test/browser_456342.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/browser/components/sessionstore/test/browser_456342.js b/browser/components/sessionstore/test/browser_456342.js
new file mode 100644
index 000000000..d7ed33ee5
--- /dev/null
+++ b/browser/components/sessionstore/test/browser_456342.js
@@ -0,0 +1,49 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const URL = ROOT + "browser_456342_sample.xhtml";
+
+/**
+ * Bug 456342 - Restore values from non-standard input field types.
+ */
+add_task(function test_restore_nonstandard_input_values() {
+ // Add tab with various non-standard input field types.
+ let tab = gBrowser.addTab(URL);
+ let browser = tab.linkedBrowser;
+ yield promiseBrowserLoaded(browser);
+
+ // Fill in form values.
+ let expectedValue = Math.random();
+ yield setFormElementValues(browser, {value: expectedValue});
+
+ // Remove tab and check collected form data.
+ yield promiseRemoveTab(tab);
+ let undoItems = JSON.parse(ss.getClosedTabData(window));
+ let savedFormData = undoItems[0].state.formdata;
+
+ let countGood = 0, countBad = 0;
+ for (let id of Object.keys(savedFormData.id)) {
+ if (savedFormData.id[id] == expectedValue) {
+ countGood++;
+ } else {
+ countBad++;
+ }
+ }
+
+ for (let exp of Object.keys(savedFormData.xpath)) {
+ if (savedFormData.xpath[exp] == expectedValue) {
+ countGood++;
+ } else {
+ countBad++;
+ }
+ }
+
+ is(countGood, 4, "Saved text for non-standard input fields");
+ is(countBad, 0, "Didn't save text for ignored field types");
+});
+
+function setFormElementValues(browser, data) {
+ return sendMessage(browser, "ss-test:setFormElementValues", data);
+}