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 /dom/browser-element/mochitest/browserElement_ExposableURI.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 'dom/browser-element/mochitest/browserElement_ExposableURI.js')
-rw-r--r-- | dom/browser-element/mochitest/browserElement_ExposableURI.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/dom/browser-element/mochitest/browserElement_ExposableURI.js b/dom/browser-element/mochitest/browserElement_ExposableURI.js new file mode 100644 index 000000000..435e11a80 --- /dev/null +++ b/dom/browser-element/mochitest/browserElement_ExposableURI.js @@ -0,0 +1,55 @@ +/* Any copyright is dedicated to the public domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Bug 795317: Test that the browser element sanitizes its URIs by removing the +// "unexposable" parts before sending them in the locationchange event. + +"use strict"; +SimpleTest.waitForExplicitFinish(); +browserElementTestHelpers.setEnabledPref(true); +browserElementTestHelpers.addPermission(); + +var iframe; + +function testPassword() { + function locationchange(e) { + var uri = e.detail.url; + is(uri, 'http://mochi.test:8888/tests/dom/browser-element/mochitest/file_empty.html', + "Username and password shouldn't be exposed in uri."); + SimpleTest.finish(); + } + + iframe.addEventListener('mozbrowserlocationchange', locationchange); + iframe.src = "http://iamuser:iampassword@mochi.test:8888/tests/dom/browser-element/mochitest/file_empty.html"; +} + +function testWyciwyg() { + var locationChangeCount = 0; + + function locationchange(e) { + // locationChangeCount: + // 0 - the first load. + // 1 - after document.write(). + if (locationChangeCount == 0) { + locationChangeCount ++; + } else if (locationChangeCount == 1) { + var uri = e.detail.url; + is(uri, 'http://mochi.test:8888/tests/dom/browser-element/mochitest/file_wyciwyg.html', "Scheme in string shouldn't be wyciwyg"); + iframe.removeEventListener('mozbrowserlocationchange', locationchange); + SimpleTest.executeSoon(testPassword); + } + } + + // file_wyciwyg.html calls document.write() to create a wyciwyg channel. + iframe.src = 'file_wyciwyg.html'; + iframe.addEventListener('mozbrowserlocationchange', locationchange); +} + +function runTest() { + iframe = document.createElement('iframe'); + iframe.setAttribute('mozbrowser', 'true'); + document.body.appendChild(iframe); + testWyciwyg(); +} + +addEventListener('testready', runTest); |