Skip to content

fix(sandbox): filter deprecated window properties to prevent Lighthouse penalty#698

Open
SurceBeats wants to merge 1 commit intoQwikDev:mainfrom
SurceBeats:fix/filter-deprecated-window-properties
Open

fix(sandbox): filter deprecated window properties to prevent Lighthouse penalty#698
SurceBeats wants to merge 1 commit intoQwikDev:mainfrom
SurceBeats:fix/filter-deprecated-window-properties

Conversation

@SurceBeats
Copy link

Partytown enumerates all window properties to build proxies in the sandbox. When it hits window.SharedStorage and window.AttributionReporting, Chrome logs "Deprecated feature used" warnings. Lighthouse picks those up and tanks the Best Practices score from 100 to ~81 on any site using Partytown, even though the site itself never uses those APIs. It's... Basically Google against Google.

The fix adds a DEPRECATED_WINDOW_PROPERTIES blocklist (a simple Set in utils.ts) and filters those properties in two places: isValidMemberName() so readImplementationMember() never accesses the values, and readMainInterfaces() so they get skipped during the Object.getOwnPropertyNames(window) enumeration.

These are Privacy Sandbox APIs that no third-party script like GA, GTM or Facebook Pixel needs, so there's zero impact on Partytown's functionality. Adding future deprecated APIs is just one line in the Set.

Closes #694
Related #313
Related: withastro/astro#15494

Includes 4 new unit tests. All 47 pass, TypeScript compiles clean, build works fine.

…se penalty

Accessing window.SharedStorage and window.AttributionReporting during
sandbox initialization triggers Chrome "Deprecated feature used" warnings,
which Lighthouse reads and penalizes Best Practices score (~81 instead of 100).

Add a maintainable blocklist (DEPRECATED_WINDOW_PROPERTIES) and filter these
properties in both isValidMemberName() and readMainInterfaces() to prevent
the property access that triggers the warnings.

Closes QwikDev#313
@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

⚠️ No Changeset found

Latest commit: b0163ec

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

Lighthouse warnings for deprecated APIs (SharedStorage & AttributionReporting) - Astro users impacted

1 participant