gecko-dev/dom/browser-element/mochitest/browserElement_ExposableURI.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 строки
1.2 KiB
JavaScript
Исходник Обычный вид История

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";
/* global browserElementTestHelpers */
2012-10-16 15:59:04 +04:00
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
2012-10-16 15:59:04 +04:00
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",
2012-10-16 15:59:04 +04:00
"Username and password shouldn't be exposed in uri."
);
SimpleTest.finish();
}
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() {
SpecialPowers.pushPrefEnv(
{ set: [["network.http.rcwn.enabled", false]] },
_ => {
iframe = document.createElement("iframe");
iframe.setAttribute("mozbrowser", "true");
document.body.appendChild(iframe);
testPassword();
}
);
2012-10-16 15:59:04 +04:00
}
addEventListener("testready", runTest);