Skip to content

Add classname to silent token renewal iframe HTML Element #6960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Add classname to silent token renewal iframe HTML element #6960",
"packageName": "@azure/msal-browser",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export class SilentHandler extends InteractionHandler {
private createHiddenIframe(): HTMLIFrameElement {
const authFrame = document.createElement("iframe");

authFrame.className = "msalSilentIframe";
authFrame.style.visibility = "hidden";
authFrame.style.position = "absolute";
authFrame.style.width = authFrame.style.height = "0";
Expand Down
10 changes: 10 additions & 0 deletions lib/msal-browser/test/interaction_handler/SilentHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,14 @@ describe("SilentHandler.ts Unit Tests", () => {
}, 500);
});
});

describe("createHiddenIframe()", () => {
it("creates iframe HTML element with classname and src properties", () => {
const silentHandler = new SilentHandler(authCodeModule, browserStorage, defaultTokenRequest, browserRequestLogger, { navigateFrameWait: DEFAULT_IFRAME_TIMEOUT_MS, pollIntervalMilliseconds: DEFAULT_POLL_INTERVAL_MS }, performanceClient);
// @ts-ignore
const authFrame = silentHandler.createHiddenIframe();
expect(authFrame instanceof HTMLIFrameElement).toBe(true);
expect(authFrame.className).toEqual("msalSilentIframe");
});
})
});