You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prevent SystemInfo imports from starting CPU pressure observation when the document permissions policy denies compute-pressure.
Handle observer construction and asynchronous observe() failures so restricted cross-origin iframes do not produce unhandled promise rejections.
Preserve CPU pressure monitoring when policy access is allowed or policy inspection is unavailable.
Testing
yarn test
Manually loaded the linked package in a cross-origin test iframe. Both denied and allow="compute-pressure" cases completed with zero unhandled rejections.
This change implements...
A new feature
A bug fix
Other (please specify):
Is this a breaking change?
Yes
No
I certify that...
All relevant unit and integration tests have passed and/or have been updated according to this change.
Cisco approved GAI tool/IDE was used for coding - eg: VSCode, Cursor, Windsurf, Codex, Claude code
No GAI - Code was written entirely manually without GAI assistance
If a GAI tool/IDE was used then select the category that best describes GAI usage in this PR:
Manual Draft with GAI Refinement - I/we created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code) (Default)
GAI Draft with Manual Customization - GAI tool was used to create a draft that I/we subsequently customized or modified.
GAI Generated Code - Code was generated entirely by GAI
Overall looks fine for me, except testing stuff - there are many conditions in setPermissionsPolicy function depends on testing scenarios that can make hard to debug and tell whats gone wrong if something fails. In my opinion the test scenario should be simple and readable, even if some code overlaps with other tests. This is not the time for doing it when customer is waiting for the fix. I will let you know if it's working - need to test it on local environment then we can merge it.
@wiekiera Thanks, fair point. The setup is more involved because SystemInfo creates the observer during module import, so each case requires a fresh module load and mocked browser globals. I used setPermissionsPolicy to keep the individual tests focused, but I agree that the scenario mapping adds some complication.
These tests will need revisiting with the planned API change anyway, so we can simplify this setup then. 🙌
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
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.
Description
SystemInfoimports from starting CPU pressure observation when the document permissions policy deniescompute-pressure.observe()failures so restricted cross-origin iframes do not produce unhandled promise rejections.Testing
yarn testallow="compute-pressure"cases completed with zero unhandled rejections.This change implements...
Is this a breaking change?
I certify that...
Generative AI (GAI) Usage Disclosure
Reference: Cisco GAI Coding Guidelines
If a GAI tool/IDE was used then select the category that best describes GAI usage in this PR:
Additional GAI Usage Details (Optional):