|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 "use strict"; |
|
5 |
|
6 const URL = ROOT + "browser_485482_sample.html"; |
|
7 |
|
8 /** |
|
9 * Bug 485482 - Make sure that we produce valid XPath expressions even for very |
|
10 * weird HTML documents. |
|
11 */ |
|
12 add_task(function test_xpath_exp_for_strange_documents() { |
|
13 // Load a page with weird tag names. |
|
14 let tab = gBrowser.addTab(URL); |
|
15 let browser = tab.linkedBrowser; |
|
16 yield promiseBrowserLoaded(browser); |
|
17 |
|
18 // Fill in some values. |
|
19 let uniqueValue = Math.random(); |
|
20 yield setInputValue(browser, {selector: "input[type=text]", value: uniqueValue}); |
|
21 yield setInputChecked(browser, {selector: "input[type=checkbox]", checked: true}); |
|
22 |
|
23 // Duplicate the tab. |
|
24 let tab2 = gBrowser.duplicateTab(tab); |
|
25 let browser2 = tab2.linkedBrowser; |
|
26 yield promiseTabRestored(tab2); |
|
27 |
|
28 // Check that we generated valid XPath expressions to restore form values. |
|
29 let text = yield getInputValue(browser2, {selector: "input[type=text]"}); |
|
30 is(text, uniqueValue, "generated XPath expression was valid"); |
|
31 let checkbox = yield getInputChecked(browser2, {selector: "input[type=checkbox]"}); |
|
32 ok(checkbox, "generated XPath expression was valid"); |
|
33 |
|
34 // Cleanup. |
|
35 gBrowser.removeTab(tab2); |
|
36 gBrowser.removeTab(tab); |
|
37 }); |