Bug 1256513 - Convert the test for bug 527935 into a browser-chrome test that is enabled on e10s; r=mrbkap

This commit is contained in:
Ehsan Akhgari 2016-03-14 21:24:40 -04:00
Родитель 58e5e16c44
Коммит 825c62d646
5 изменённых файлов: 77 добавлений и 76 удалений

Просмотреть файл

@ -1,3 +1,6 @@
[browser_bug527935.js]
skip-if = toolkit == 'android'
support-files = bug527935.html
[browser_bug629172.js]
skip-if = toolkit == 'android'
support-files = bug629172.html

Просмотреть файл

@ -0,0 +1,63 @@
add_task(function*() {
yield new Promise(resolve => waitForFocus(resolve, window));
const kPageURL = "http://example.org/browser/editor/libeditor/tests/bug527935.html";
yield BrowserTestUtils.withNewTab({
gBrowser,
url: kPageURL
}, function*(aBrowser) {
var popupShown = false;
function listener() {
popupShown = true;
}
SpecialPowers.addAutoCompletePopupEventListener(window, "popupshowing", listener);
yield ContentTask.spawn(aBrowser, {}, function*() {
var window = content.window.wrappedJSObject;
var document = window.document;
var formTarget = document.getElementById("formTarget");
var initValue = document.getElementById("initValue");
window.loadPromise = new Promise(resolve => {
formTarget.onload = resolve;
});
initValue.focus();
initValue.value = "foo";
});
EventUtils.synthesizeKey("VK_RETURN", {});
yield ContentTask.spawn(aBrowser, {}, function*() {
var window = content.window.wrappedJSObject;
var document = window.document;
yield window.loadPromise;
var newInput = document.createElement("input");
newInput.setAttribute("name", "test");
document.body.appendChild(newInput);
var event = document.createEvent("KeyboardEvent");
event.initKeyEvent("keypress", true, true, null, false, false,
false, false, 0, "f".charCodeAt(0));
newInput.value = "";
newInput.focus();
newInput.dispatchEvent(event);
});
yield new Promise(resolve => hitEventLoop(resolve, 100));
ok(!popupShown, "Popup must not be opened");
SpecialPowers.removeAutoCompletePopupEventListener(window, "popupshowing", listener);
});
});
function hitEventLoop(func, times) {
if (times > 0) {
setTimeout(hitEventLoop, 0, func, times - 1);
} else {
setTimeout(func, 0);
}
}

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<html>
<body>
<div id="content">
<iframe id="formTarget" name="formTarget"></iframe>
<form action="data:text/html," target="formTarget">
<input name="test" id="initValue"><input type="submit">
</form>
</div>
</body>
</html

Просмотреть файл

@ -58,8 +58,6 @@ skip-if = toolkit == 'android'
skip-if = toolkit == 'android'
[test_bug525389.html]
skip-if = toolkit == 'android'
[test_bug527935.html]
skip-if = toolkit == 'android' || e10s
[test_bug537046.html]
[test_bug549262.html]
skip-if = toolkit == 'android'

Просмотреть файл

@ -1,74 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=527935
-->
<head>
<title>Test for Bug 527935</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.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=527935">Mozilla Bug 527935</a>
<p id="display"></p>
<div id="content">
<iframe id="formTarget" name="formTarget"></iframe>
<form action="data:text/html," target="formTarget">
<input name="test" id="initValue"><input type="submit">
</form>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 527935 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
var formTarget = document.getElementById("formTarget");
var initValue = document.getElementById("initValue");
formTarget.addEventListener("load", function() {
var newInput = document.createElement("input");
newInput.setAttribute("name", "test");
document.body.appendChild(newInput);
setTimeout(function() {
var popupShown = false;
function listener() {
popupShown = true;
}
SpecialPowers.addAutoCompletePopupEventListener(window, "popupshowing", listener);
var event = document.createEvent("KeyboardEvent");
event.initKeyEvent("keypress", true, true, null, false, false,
false, false, 0, "f".charCodeAt(0));
newInput.value = "";
newInput.focus();
newInput.dispatchEvent(event);
hitEventLoop(function() {
ok(!popupShown, "Popup must not be opened");
SpecialPowers.removeAutoCompletePopupEventListener(window, "popupshowing", listener);
SimpleTest.finish();
}, 100);
}, 0);
}, false);
initValue.focus();
initValue.value = "foo";
synthesizeKey("VK_RETURN", {});
});
function hitEventLoop(func, times) {
if (times > 0) {
setTimeout(hitEventLoop, 0, func, times - 1);
} else {
setTimeout(func, 0);
}
}
</script>
</pre>
</body>
</html>