[PM-4011] Remove Autofill Injection in All Frames (#6348)

* [PM-4011] Remove Autofill Injection in All Frames

* [PM-4011] Adding jest tests for the fix
This commit is contained in:
Cesar Gonzalez 2023-09-20 10:25:58 -05:00 committed by GitHub
parent 9e8a67f3bb
commit f0526296e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -75,7 +75,7 @@ describe("AutofillService", () => {
const autofillV1Script = "autofill.js";
const autofillV2Script = "autofill-init.js";
const defaultAutofillScripts = ["autofiller.js", "notificationBar.js", "contextMenuHandler.js"];
const defaultExecuteScriptOptions = { allFrames: true, runAt: "document_start" };
const defaultExecuteScriptOptions = { runAt: "document_start" };
let tabMock: chrome.tabs.Tab;
let sender: chrome.runtime.MessageSender;
@ -91,11 +91,13 @@ describe("AutofillService", () => {
[autofillV1Script, ...defaultAutofillScripts].forEach((scriptName) => {
expect(BrowserApi.executeScriptInTab).toHaveBeenCalledWith(tabMock.id, {
file: `content/${scriptName}`,
frameId: sender.frameId,
...defaultExecuteScriptOptions,
});
});
expect(BrowserApi.executeScriptInTab).not.toHaveBeenCalledWith(tabMock.id, {
file: `content/${autofillV2Script}`,
frameId: sender.frameId,
...defaultExecuteScriptOptions,
});
});

View File

@ -62,7 +62,7 @@ export default class AutofillService implements AutofillServiceInterface {
for (const injectedScript of injectedScripts) {
await BrowserApi.executeScriptInTab(sender.tab.id, {
file: `content/${injectedScript}`,
allFrames: true,
frameId: sender.frameId,
runAt: "document_start",
});
}