function sendAKeyEvent() {
synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_A, {}, "a", "a");
}
function isFocused(aElement) {
return (SpecialPowers.focusManager.focusedElement == aElement);
}
function runTest() {
sendAKeyEvent();
ok(true, "Not crashed: input on the document");
$("input_text").focus();
sendAKeyEvent();
ok(true, "Not crashed: input on text\">");
$("input_password").focus();
sendAKeyEvent();
ok(true, "Not crashed: input on password\">");
$("input_password").blur();
sendAKeyEvent();
ok(true, "Not crashed: input on the document after blur() of password\">");
$("input_password").focus();
$("input_text_readonly").focus();
sendAKeyEvent();
ok(true, "Not crashed: input on text\" readonly>");
$("input_password").focus();
$("input_text_ime_mode_disabled").focus();
sendAKeyEvent();
ok(true, "Not crashed: input on text\" style=\"ime-mode: disabled;\">");
$("input_password").focus();
$("textarea").focus();
sendAKeyEvent();
ok(true, "Not crashed: input on );
$("input_password").focus();
$("contenteditable").focus();
sendAKeyEvent();
ok(true, "Not crashed: input on
");
$("input_change").focus();
$("input_change").type = "password";
sendAKeyEvent();
ok(true, "Not crashed: input on password\"> changed from type=\"text\"");
$("input_change").type = "text";
sendAKeyEvent();
ok(true, "Not crashed: input on text\"> changed from type=\"password\"");
var otherWindow =
window.browsingContext.topChromeWindow.open("file_secure_input.html", "_blank", "chrome,width=100,height=100");
ok(otherWindow, "failed to open other window");
if (!otherWindow) {
SimpleTest.finish();
return;
}
$("input_text").focus();
otherWindow.focus();
SimpleTest.waitForFocus(function() {
window.focus();
sendAKeyEvent();
ok(isFocused($("input_text")), "focused element isn't text\">");
ok(true, "Not crashed: input on text\"> after the other document has focus");
$("input_password").focus();
otherWindow.focus();
window.focus();
sendAKeyEvent();
ok(isFocused($("input_password")), "focused element isn't password\">");
ok(true, "Not crashed: input on password\"> after the other document has focus");
$("input_text").focus();
otherWindow.focus();
otherWindow.document.getElementById("text").focus();
window.focus();
sendAKeyEvent();
ok(isFocused($("input_text")), "focused element isn't text\">");
ok(true, "Not crashed: input on text\"> after the other document's text\"> has focus");
$("input_password").focus();
otherWindow.focus();
otherWindow.document.getElementById("text").focus();
window.focus();
sendAKeyEvent();
ok(isFocused($("input_password")), "focused element isn't password\">");
ok(true, "Not crashed: input on password\"> after the other document's text\"> has focus");
$("input_text").focus();
otherWindow.focus();
otherWindow.document.getElementById("password").focus();
window.focus();
sendAKeyEvent();
ok(isFocused($("input_text")), "focused element isn't text\">");
ok(true, "Not crashed: input on text\"> after the other document's password\"> has focus");
$("input_password").focus();
otherWindow.focus();
otherWindow.document.getElementById("password").focus();
window.focus();
sendAKeyEvent();
ok(isFocused($("input_password")), "focused element isn't password\">");
ok(true, "Not crashed: input on password\"> after the other document's password\"> has focus");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.