async function withLogin(action, params = {}) {
    try {
        const url = helpers.parseAuthUrl(this.settings?.tab?.url ?? null);
        const askToProceed =
            action === "fill" &&
            this.settings?.authRequested &&
            !params?.confirmedAlready &&
            !url?.match(/^https:/i);
        if (askToProceed) {
            const that = this;
            that.doAction = withLogin.bind({
                settings: this.settings,
                login: this.login,
            });
            dialog.open(
                { message: helpers.unsecureRequestWarning(url), type: "warning" },
                function () {
                    // proceed
                    params.confirmedAlready = true;
                    that.doAction(action, params);
                }
            );
            return;
        }
    } catch (e) {
        console.error(e);
    }

    try {
        switch (action) {
            case "fill":
                handleError("Filling login details...", "info");
                break;
            case "launch":
                handleError("Launching URL...", "info");
                break;
            case "launchInNewTab":
                handleError("Launching URL in a new tab...", "info");
                break;
            case "copyPassword":
                handleError("Copying password to clipboard...", "info");
                break;
            case "copyUsername":
                handleError("Copying username to clipboard...", "info");
                break;
            case "copyOTP":
                handleError("Copying OTP token to clipboard...", "info");
                break;
            default:
                handleError("Please wait...", "info");
                break;
        }

        const login = helpers.deepCopy(this.login);

        // hand off action to background script
        var response = await chrome.runtime.sendMessage({ action, login, params });
        if (response.status != "ok") {
            throw new Error(response.message);
        } else {
            if (response.login && typeof response.login === "object") {
                response.login.doAction = withLogin.bind({
                    settings: this.settings,
                    login: response.login,
                });
            } else {
                window.close();
            }
        }
    } catch (e) {
        handleError(e);
    }
}
Do a login action

@since 3.0.0

@param string action Action to take
@param object params Action parameters
@return void