mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 511639 - Login manager should ignore untrusted events. r=gavin, sr=mconnor
This commit is contained in:
parent
03467114a9
commit
34a657bd23
@ -349,6 +349,9 @@ LoginManager.prototype = {
|
|||||||
|
|
||||||
|
|
||||||
handleEvent : function (event) {
|
handleEvent : function (event) {
|
||||||
|
if (!event.isTrusted)
|
||||||
|
return;
|
||||||
|
|
||||||
this._pwmgr.log("domEventListener: got event " + event.type);
|
this._pwmgr.log("domEventListener: got event " + event.type);
|
||||||
|
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
@ -183,6 +183,12 @@ function checkACForm(expectedUsername, expectedPassword) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function sendFakeAutocompleteEvent(element) {
|
||||||
|
var acEvent = document.createEvent("HTMLEvents");
|
||||||
|
acEvent.initEvent("DOMAutoComplete", true, false);
|
||||||
|
element.dispatchEvent(acEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main section of test...
|
* Main section of test...
|
||||||
@ -194,7 +200,11 @@ function checkACForm(expectedUsername, expectedPassword) {
|
|||||||
*/
|
*/
|
||||||
function runTest(testNum) {
|
function runTest(testNum) {
|
||||||
// Seems we need to enable this again, or sendKeyEvent() complaints.
|
// Seems we need to enable this again, or sendKeyEvent() complaints.
|
||||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
// But don't for test 14, or else dispatchEvent will send it as a trusted
|
||||||
|
// event (we're testing to see if we ignore untrusted events, so don't want
|
||||||
|
// that).
|
||||||
|
if (testNum != 14)
|
||||||
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||||
ok(true, "Starting test #" + testNum);
|
ok(true, "Starting test #" + testNum);
|
||||||
|
|
||||||
switch(testNum) {
|
switch(testNum) {
|
||||||
@ -356,6 +366,19 @@ function runTest(testNum) {
|
|||||||
doKey("page_down");
|
doKey("page_down");
|
||||||
doKey("return");
|
doKey("return");
|
||||||
checkACForm("zzzuser4", "zzzpass4");
|
checkACForm("zzzuser4", "zzzpass4");
|
||||||
|
restoreForm();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 14:
|
||||||
|
// Send a fake (untrusted) event.
|
||||||
|
checkACForm("", "");
|
||||||
|
uname.value = "zzzuser4";
|
||||||
|
sendFakeAutocompleteEvent(uname);
|
||||||
|
checkACForm("zzzuser4", "");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
checkACForm("zzzuser4", "");
|
||||||
|
|
||||||
// Trigger autocomplete popup
|
// Trigger autocomplete popup
|
||||||
restoreForm();
|
restoreForm();
|
||||||
@ -363,19 +386,6 @@ function runTest(testNum) {
|
|||||||
testNum = 49;
|
testNum = 49;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 14:
|
|
||||||
// Abort with ESC
|
|
||||||
// XXX This isn't working in the test suite, seems to fubar any later tests.
|
|
||||||
// doKey("down");
|
|
||||||
// doKey("down");
|
|
||||||
// doKey("escape");
|
|
||||||
// checkACForm("", "");
|
|
||||||
|
|
||||||
// Trigger autocomplete popup
|
|
||||||
// restoreForm();
|
|
||||||
// doKey("down");
|
|
||||||
break;
|
|
||||||
|
|
||||||
// XXX tried sending character "t" before/during dropdown to test
|
// XXX tried sending character "t" before/during dropdown to test
|
||||||
// filtering, but had no luck. Seemed like the character was getting lost.
|
// filtering, but had no luck. Seemed like the character was getting lost.
|
||||||
// Setting uname.value didn't seem to work either. This works with a human
|
// Setting uname.value didn't seem to work either. This works with a human
|
||||||
|
Loading…
Reference in New Issue
Block a user