mirror of
https://github.com/bitwarden/browser
synced 2026-02-10 21:50:15 +00:00
when requestInitiator is falsy but active auto submit exists, cleanup should still occur
This commit is contained in:
@@ -249,6 +249,20 @@ describe("AutoSubmitLoginBackground", () => {
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("properly cleans up auto-submit workflows when requestInitiator is falsy but active auto-submit hosts exist", async () => {
|
||||
webRequestDetails.initiator = undefined;
|
||||
jest
|
||||
.spyOn(BrowserApi, "getTab")
|
||||
.mockResolvedValue(mock<chrome.tabs.Tab>({ url: validAutoSubmitUrl, id: 1 }));
|
||||
|
||||
triggerWebRequestOnBeforeRequestEvent(webRequestDetails);
|
||||
await flushPromises();
|
||||
|
||||
expect(autoSubmitLoginBackground["validAutoSubmitHosts"].has(validAutoSubmitHost)).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when the extension is running on a Safari browser", () => {
|
||||
|
||||
@@ -187,8 +187,8 @@ export class AutoSubmitLoginBackground implements AutoSubmitLoginBackgroundAbstr
|
||||
return;
|
||||
}
|
||||
|
||||
if (requestInitiator) {
|
||||
this.disableAutoSubmitFlow(requestInitiator, details).catch((error) =>
|
||||
if (requestInitiator || this.validAutoSubmitHosts.size > 0) {
|
||||
this.disableAutoSubmitFlow(requestInitiator || "", details).catch((error) =>
|
||||
this.logService.error(error),
|
||||
);
|
||||
}
|
||||
@@ -437,7 +437,7 @@ export class AutoSubmitLoginBackground implements AutoSubmitLoginBackgroundAbstr
|
||||
*/
|
||||
private getUrlHost = (url: string) => {
|
||||
let parsedUrl = url;
|
||||
if (!parsedUrl) {
|
||||
if (!parsedUrl || typeof parsedUrl !== "string") {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user