faster form filling; support for filling fake password fields like at att.com:

This commit is contained in:
Chris Karlof 2013-01-08 15:47:01 -08:00
Родитель be70a79f7e
Коммит 53e7234b90
3 изменённых файлов: 22 добавлений и 7 удалений

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

@ -1,2 +1,2 @@
// AUTOGENERATED FILE: edit 'site_configs.yml' instead and run 'build_site_configs.rb'
var SiteConfigs = { "citi.com": { "domains": [ "citibank.com", "accountonline.com", "citicards.com" ] }};
var SiteConfigs = { "citi.com": { "domains": [ "citibank.com", "accountonline.com", "citicards.com" ] }, "att.com": { "fakePasswordFill": "#password" }};

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

@ -27,3 +27,6 @@
citi.com:
domains: ["citibank.com", "accountonline.com", "citicards.com"]
att.com:
fakePasswordFill: "#password"

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

@ -53,7 +53,7 @@ var PasswordForm = function($, DomMonitor) {
var partialValue = value.substring(0, currentIndex+1);
setTimeout(function() {
$el.keydown();
$el.val(value);
$el.val(partialValue);
setTimeout(function() {
$el.keyup();
setTimeout(function() {
@ -75,9 +75,6 @@ var PasswordForm = function($, DomMonitor) {
setTimeout(callback, 0);
}
value = value || "";
// if typeValueInElementHelper is too slow, then use this code below.
// $el.val(value);
// blur();
setTimeout(function() {
// After focusing on the given element, the page's javascript may
// change the focus (for example, swap out a fake field for a real one)
@ -86,7 +83,10 @@ var PasswordForm = function($, DomMonitor) {
if (isPossibleUsernameField(activeElement) || isPasswordField(activeElement)) {
$el = $(activeElement);
}
typeValueInElementHelper($el, value, 0, blur);
// keep it simple for now
$el.val(value);
blur();
//typeValueInElementHelper($el, value, 0, blur);
}, 0);
}
@ -195,6 +195,16 @@ var PasswordForm = function($, DomMonitor) {
});
}
function maybeFillFakePassword(value, callback) {
var fakePasswordEl = $(this.config.fakePasswordFill).get(0);
console.log("maybeFillFakePassword", fakePasswordEl);
if (fakePasswordEl) {
fillField(fakePasswordEl, value, callback);
return true;
}
return false;
}
// Create an object that representing username and password fields.
// el is the raw DOM element, $el is the jQuery wrapped DOM element, and val
// is for storing captured credentials.
@ -269,6 +279,7 @@ var PasswordForm = function($, DomMonitor) {
maybeTickleFakeInputFields.call(this, FAKE_USERNAME_FIELD_HINTS);
fillField(this.usernameField.el, credentials.username, (function() {
maybeTickleFakeInputFields.call(this, FAKE_PASSWORD_FIELD_HINTS);
maybeFillFakePassword.call(this, credentials.password);
fillField(this.passwordField.el, credentials.password);
}).bind(this));
return this;
@ -322,4 +333,5 @@ var PasswordForm = function($, DomMonitor) {
};
return PasswordForm;
};
};