diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /browser/components/sessionstore/test/browser_466937.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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_466937.js')
-rw-r--r-- | browser/components/sessionstore/test/browser_466937.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/browser/components/sessionstore/test/browser_466937.js b/browser/components/sessionstore/test/browser_466937.js new file mode 100644 index 000000000..0a07caa0c --- /dev/null +++ b/browser/components/sessionstore/test/browser_466937.js @@ -0,0 +1,42 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const URL = ROOT + "browser_466937_sample.html"; + +/** + * Bug 466937 - Prevent file stealing with sessionstore. + */ +add_task(function test_prevent_file_stealing() { + // Add a tab with some file input fields. + let tab = gBrowser.addTab(URL); + let browser = tab.linkedBrowser; + yield promiseBrowserLoaded(browser); + + // Generate a path to a 'secret' file. + let file = Services.dirsvc.get("TmpD", Ci.nsIFile); + file.append("466937_test.file"); + file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666); + let testPath = file.path; + + // Fill in form values. + yield setInputValue(browser, {id: "reverse_thief", value: "/home/user/secret2"}); + yield setInputValue(browser, {id: "bystander", value: testPath}); + + // Duplicate and check form values. + let tab2 = gBrowser.duplicateTab(tab); + let browser2 = tab2.linkedBrowser; + yield promiseTabRestored(tab2); + + let thief = yield getInputValue(browser2, {id: "thief"}); + is(thief, "", "file path wasn't set to text field value"); + let reverse_thief = yield getInputValue(browser2, {id: "reverse_thief"}); + is(reverse_thief, "", "text field value wasn't set to full file path"); + let bystander = yield getInputValue(browser2, {id: "bystander"}); + is(bystander, testPath, "normal case: file path was correctly preserved"); + + // Cleanup. + gBrowser.removeTab(tab); + gBrowser.removeTab(tab2); +}); |