Skip to content

fix: avoid unconditional use of window in policy creation logic#1234

Open
usefulthink wants to merge 2 commits into
googlemaps:mainfrom
usefulthink:fix/no-window
Open

fix: avoid unconditional use of window in policy creation logic#1234
usefulthink wants to merge 2 commits into
googlemaps:mainfrom
usefulthink:fix/no-window

Conversation

@usefulthink

@usefulthink usefulthink commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #1233 🦕

Comment thread src/setScriptSrc.test.ts Outdated

// @jest-environment node
describe("setScriptSrc(): SSR safety", () => {
it("should be importable when window is not available", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case our infra changes over time, can you assert that window is not available for this test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, added a check for this

Comment thread src/setScriptSrc.test.ts
describe("setScriptSrc(): SSR safety", () => {
it("should be importable when window is not available", async () => {
await expect(import("./setScriptSrc.js")).resolves.toBeDefined();
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also get some coverage of what the expected output is, both for supported Trusted Types envs and unsupported envs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also added tests for the different new and old behaviors of setScriptSrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Window is not defined

2 participants