fix(sandbox): filter deprecated window properties to prevent Lighthouse penalty#698
Open
SurceBeats wants to merge 1 commit intoQwikDev:mainfrom
Open
fix(sandbox): filter deprecated window properties to prevent Lighthouse penalty#698SurceBeats wants to merge 1 commit intoQwikDev:mainfrom
SurceBeats wants to merge 1 commit intoQwikDev:mainfrom
Conversation
…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
|
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.