diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/sessionstore/test/browser_485482.js | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/sessionstore/test/browser_485482.js')
-rw-r--r-- | browser/components/sessionstore/test/browser_485482.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/browser/components/sessionstore/test/browser_485482.js b/browser/components/sessionstore/test/browser_485482.js new file mode 100644 index 0000000000..f32523005b --- /dev/null +++ b/browser/components/sessionstore/test/browser_485482.js @@ -0,0 +1,76 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +if (gFissionBrowser) { + addCoopTask( + "browser_485482_sample.html", + test_xpath_exp_for_strange_documents, + HTTPSROOT + ); +} +addNonCoopTask( + "browser_485482_sample.html", + test_xpath_exp_for_strange_documents, + ROOT +); +addNonCoopTask( + "browser_485482_sample.html", + test_xpath_exp_for_strange_documents, + HTTPSROOT +); +addNonCoopTask( + "browser_485482_sample.html", + test_xpath_exp_for_strange_documents, + HTTPROOT +); + +/** + * Bug 485482 - Make sure that we produce valid XPath expressions even for very + * weird HTML documents. + */ +async function test_xpath_exp_for_strange_documents(aURL) { + // Load a page with weird tag names. + let tab = BrowserTestUtils.addTab(gBrowser, aURL); + let browser = tab.linkedBrowser; + await promiseBrowserLoaded(browser); + + // Fill in some values. + let uniqueValue = Math.random(); + await setPropertyOfFormField( + browser, + "input[type=text]", + "value", + uniqueValue + ); + await setPropertyOfFormField( + browser, + "input[type=checkbox]", + "checked", + true + ); + + // Duplicate the tab. + let tab2 = gBrowser.duplicateTab(tab); + let browser2 = tab2.linkedBrowser; + await promiseTabRestored(tab2); + + // Check that we generated valid XPath expressions to restore form values. + let text = await getPropertyOfFormField( + browser2, + "input[type=text]", + "value" + ); + is("" + text, "" + uniqueValue, "generated XPath expression was valid"); + let checkbox = await getPropertyOfFormField( + browser2, + "input[type=checkbox]", + "checked" + ); + ok(checkbox, "generated XPath expression was valid"); + + // Cleanup. + gBrowser.removeTab(tab2); + gBrowser.removeTab(tab); +} |