~sircmpwn/himitsu-firefox

4824fb6e9f2330a12d971c374a8cf88fb37888f2 — Adnan Maolood 6 months ago e41ede7
Trigger Javascript input events on autofill

This fixes issues with forms that rely on Javascript for validation.
1 files changed, 8 insertions(+), 0 deletions(-)

M content/content.js
M content/content.js => content/content.js +8 -0
@@ 16,7 16,15 @@ function handleAutofill(msg) {
			return;
		};
		const input = form.querySelector(`input[name="${pair.key}"]`);
		input.click();
		input.focus();
		input.value = pair.value;
		input.dispatchEvent(new KeyboardEvent('keydown', {bubbles: true}));
		input.dispatchEvent(new KeyboardEvent('keypress', {bubbles: true}));
		input.dispatchEvent(new KeyboardEvent('keyup', {bubbles: true}));
		input.dispatchEvent(new Event('input', {bubbles: true, cancellable: true}));
		input.dispatchEvent(new Event('change', {bubbles: true, cancellable: true}));
		input.blur();
	});
}