Revert some changes

This commit is contained in:
varjolintu 2022-03-18 17:00:27 +02:00
parent ecae40a6b6
commit 97e801271f
4 changed files with 56 additions and 73 deletions

2
.gitignore vendored
View file

@ -10,5 +10,3 @@
.bz2
.xz
node_modules/*
test-results/
playwright-report/

11
.vscode/launch.json vendored
View file

@ -1,11 +0,0 @@
{
"configurations": [
{
"type": "node-terminal",
"name": "Run Script: Playwright tests",
"request": "launch",
"command": "npx playwright test",
"cwd": "${workspaceFolder}"
}
]
}

View file

@ -14,8 +14,8 @@
)("undefined" == typeof globalThis ? "undefined" == typeof self ? this : self : globalThis, function(a) {
"use strict";
if ("undefined" == typeof browser || Object.getPrototypeOf(browser) !== Object.prototype) {
//if ("object" != typeof chrome || !chrome || !chrome.runtime || !chrome.runtime.id)
//throw new Error("This script should only be loaded in a browser extension.");
if ("object" != typeof chrome || !chrome || !chrome.runtime || !chrome.runtime.id)
throw new Error("This script should only be loaded in a browser extension.");
a.exports = (a=>{
const b = {
alarms: {

View file

@ -788,62 +788,58 @@ if (document.readyState === 'complete' || (document.readyState !== 'loading' &&
}
// These are executed in each frame. Try/catch is for tests where browser can be undefined.
try {
browser.runtime.onMessage.addListener(async function(req, sender) {
if ('action' in req) {
// Don't allow any actions if the site is ignored
if (await kpxc.siteIgnored()) {
logDebug('This site is ignored in Site Preferences.');
return;
}
if (req.action === 'activated_tab') {
kpxc.triggerActivatedTab();
} else if (req.action === 'add_username_only_option') {
kpxc.addToSitePreferences();
} else if (req.action === 'check_database_hash' && 'hash' in req) {
kpxc.detectDatabaseChange(req);
} else if (req.action === 'choose_credential_fields') {
kpxcDefine.init();
} else if (req.action === 'clear_credentials') {
kpxc.clearAllFromPage();
} else if (req.action === 'fill_user_pass_with_specific_login') {
kpxcFill.fillFromPopup(req.id, req.uuid);
} else if (req.action === 'fill_username_password') {
sendMessage('page_set_manual_fill', ManualFill.BOTH);
await kpxc.receiveCredentialsIfNecessary();
kpxcFill.fillInFromActiveElement();
} else if (req.action === 'fill_password') {
sendMessage('page_set_manual_fill', ManualFill.PASSWORD);
await kpxc.receiveCredentialsIfNecessary();
kpxcFill.fillInFromActiveElement(true); // passOnly to true
} else if (req.action === 'fill_totp') {
await kpxc.receiveCredentialsIfNecessary();
kpxcFill.fillFromTOTP();
} else if (req.action === 'fill_attribute' && req.args) {
await kpxc.receiveCredentialsIfNecessary();
kpxcFill.fillAttributeToActiveElementWith(req.args);
} else if (req.action === 'ignore_site') {
kpxc.ignoreSite(req.args);
} else if (req.action === 'redetect_fields') {
const response = await sendMessage('load_settings');
kpxc.settings = response;
kpxc.inputs = [];
kpxc.combinations = [];
kpxc.initCredentialFields();
} else if (req.action === 'reload_extension') {
sendMessage('reconnect');
} else if (req.action === 'save_credentials') {
kpxc.rememberCredentialsFromContextMenu();
} else if (req.action === 'retrive_credentials_forced') {
await kpxc.retrieveCredentials(true);
} else if (req.action === 'show_password_generator') {
kpxcPasswordDialog.trigger();
} else if (req.action === 'request_autotype') {
sendMessage('request_autotype', [ window.location.hostname ]);
}
browser.runtime.onMessage.addListener(async function(req, sender) {
if ('action' in req) {
// Don't allow any actions if the site is ignored
if (await kpxc.siteIgnored()) {
logDebug('This site is ignored in Site Preferences.');
return;
}
});
} catch (e) {
console.log(e.message);
}
if (req.action === 'activated_tab') {
kpxc.triggerActivatedTab();
} else if (req.action === 'add_username_only_option') {
kpxc.addToSitePreferences();
} else if (req.action === 'check_database_hash' && 'hash' in req) {
kpxc.detectDatabaseChange(req);
} else if (req.action === 'choose_credential_fields') {
kpxcDefine.init();
} else if (req.action === 'clear_credentials') {
kpxc.clearAllFromPage();
} else if (req.action === 'fill_user_pass_with_specific_login') {
kpxcFill.fillFromPopup(req.id, req.uuid);
} else if (req.action === 'fill_username_password') {
sendMessage('page_set_manual_fill', ManualFill.BOTH);
await kpxc.receiveCredentialsIfNecessary();
kpxcFill.fillInFromActiveElement();
} else if (req.action === 'fill_password') {
sendMessage('page_set_manual_fill', ManualFill.PASSWORD);
await kpxc.receiveCredentialsIfNecessary();
kpxcFill.fillInFromActiveElement(true); // passOnly to true
} else if (req.action === 'fill_totp') {
await kpxc.receiveCredentialsIfNecessary();
kpxcFill.fillFromTOTP();
} else if (req.action === 'fill_attribute' && req.args) {
await kpxc.receiveCredentialsIfNecessary();
kpxcFill.fillAttributeToActiveElementWith(req.args);
} else if (req.action === 'ignore_site') {
kpxc.ignoreSite(req.args);
} else if (req.action === 'redetect_fields') {
const response = await sendMessage('load_settings');
kpxc.settings = response;
kpxc.inputs = [];
kpxc.combinations = [];
kpxc.initCredentialFields();
} else if (req.action === 'reload_extension') {
sendMessage('reconnect');
} else if (req.action === 'save_credentials') {
kpxc.rememberCredentialsFromContextMenu();
} else if (req.action === 'retrive_credentials_forced') {
await kpxc.retrieveCredentials(true);
} else if (req.action === 'show_password_generator') {
kpxcPasswordDialog.trigger();
} else if (req.action === 'request_autotype') {
sendMessage('request_autotype', [ window.location.hostname ]);
}
}
});