mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 795317: Test case r=jlebar
This commit is contained in:
parent
b2b09feb78
commit
a0de7d3984
@ -139,6 +139,9 @@ MOCHITEST_FILES = \
|
||||
file_browserElement_AppFramePermission.html \
|
||||
browserElement_AppFramePermission.js \
|
||||
test_browserElement_inproc_AppFramePermission.html \
|
||||
file_wyciwyg.html \
|
||||
browserElement_ExposableURI.js \
|
||||
test_browserElement_inproc_ExposableURI.html \
|
||||
$(NULL)
|
||||
|
||||
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
|
||||
@ -201,6 +204,7 @@ MOCHITEST_FILES += \
|
||||
test_browserElement_oop_RemoveBrowserElement.html \
|
||||
test_browserElement_oop_DOMRequestError.html \
|
||||
test_browserElement_oop_AppFramePermission.html \
|
||||
test_browserElement_oop_ExposableURI.html \
|
||||
$(NULL)
|
||||
endif #}
|
||||
endif #}
|
||||
|
57
dom/browser-element/mochitest/browserElement_ExposableURI.js
Normal file
57
dom/browser-element/mochitest/browserElement_ExposableURI.js
Normal file
@ -0,0 +1,57 @@
|
||||
/* 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();
|
||||
|
||||
var iframe;
|
||||
|
||||
|
||||
function testPassword() {
|
||||
function locationchange(e) {
|
||||
var uri = e.detail;
|
||||
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;
|
||||
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() {
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.mozbrowser = true;
|
||||
document.body.appendChild(iframe);
|
||||
testWyciwyg();
|
||||
}
|
||||
|
||||
addEventListener('load', function() { SimpleTest.executeSoon(runTest); });
|
14
dom/browser-element/mochitest/file_wyciwyg.html
Normal file
14
dom/browser-element/mochitest/file_wyciwyg.html
Normal file
@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>test</title>
|
||||
<script type="text/javascript">
|
||||
addEventListener('load', function() {
|
||||
window.setTimeout(function() {
|
||||
document.write("test");
|
||||
}, 0);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=795317
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 795317</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=795317">Mozilla Bug 795317</a>
|
||||
|
||||
<script type="application/javascript;version1.7" src="browserElement_ExposableURI.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=795317
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 795317</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=795317">Mozilla Bug 795317</a>
|
||||
|
||||
<script type="application/javascript;version1.7" src="browserElement_ExposableURI.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user