2012-10-16 15:59:04 +04:00
|
|
|
/* 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";
|
2019-03-19 23:56:24 +03:00
|
|
|
|
|
|
|
/* global browserElementTestHelpers */
|
|
|
|
|
2012-10-16 15:59:04 +04:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
2013-03-28 23:51:10 +04:00
|
|
|
browserElementTestHelpers.setEnabledPref(true);
|
|
|
|
browserElementTestHelpers.addPermission();
|
2012-10-16 15:59:04 +04:00
|
|
|
|
|
|
|
var iframe;
|
|
|
|
|
|
|
|
function testPassword() {
|
|
|
|
function locationchange(e) {
|
2016-09-02 12:20:05 +03:00
|
|
|
var uri = e.detail.url;
|
2019-03-19 23:56:10 +03:00
|
|
|
is(
|
|
|
|
uri,
|
|
|
|
"http://mochi.test:8888/tests/dom/browser-element/mochitest/file_empty.html",
|
2012-10-16 15:59:04 +04:00
|
|
|
"Username and password shouldn't be exposed in uri."
|
|
|
|
);
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
2019-03-19 23:56:10 +03:00
|
|
|
iframe.addEventListener("mozbrowserlocationchange", locationchange);
|
2012-10-16 15:59:04 +04:00
|
|
|
iframe.src =
|
|
|
|
"http://iamuser:iampassword@mochi.test:8888/tests/dom/browser-element/mochitest/file_empty.html";
|
|
|
|
}
|
|
|
|
|
|
|
|
function runTest() {
|
2019-03-19 23:56:10 +03:00
|
|
|
SpecialPowers.pushPrefEnv(
|
|
|
|
{ set: [["network.http.rcwn.enabled", false]] },
|
|
|
|
_ => {
|
|
|
|
iframe = document.createElement("iframe");
|
|
|
|
iframe.setAttribute("mozbrowser", "true");
|
2017-07-19 05:24:00 +03:00
|
|
|
document.body.appendChild(iframe);
|
2019-02-28 04:09:48 +03:00
|
|
|
testPassword();
|
2017-07-19 05:24:00 +03:00
|
|
|
}
|
|
|
|
);
|
2012-10-16 15:59:04 +04:00
|
|
|
}
|
|
|
|
|
2019-03-19 23:56:10 +03:00
|
|
|
addEventListener("testready", runTest);
|