Skip to content

added uri check#2128

Open
aryanku-dev wants to merge 3 commits intomasterfrom
PER-7051-issue-2120
Open

added uri check#2128
aryanku-dev wants to merge 3 commits intomasterfrom
PER-7051-issue-2120

Conversation

@aryanku-dev
Copy link

This pull request improves the robustness of the iframe serialization logic by handling cases where an iframe's baseURI is not a valid URL. It ensures that the code does not crash when encountering such cases and adds a test to verify this behavior.

Error Handling Improvements:

  • Updated setBaseURI in serialize-frames.js to safely handle unparseable baseURI values by wrapping the URL constructor in a try/catch block and exiting early if parsing fails.

Testing Enhancements:

  • Added a test in serialize-frames.test.js to ensure that serialization does not throw errors when an iframe has an invalid baseURI, and that no <base> tag is injected in this scenario.

@aryanku-dev aryanku-dev requested a review from a team as a code owner March 1, 2026 18:44
function setBaseURI(dom) {
let parsedURL;
try {
parsedURL = new URL(dom.baseURI);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should log some warning that we are skipping due to this issue, check same script how it's done for iframe outside body

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.

2 participants