Fix processing of element child sanitization loop when invalid elements are replaced with children#4512
Merged
westonruter merged 3 commits intodevelopfrom Apr 3, 2020
Merged
Conversation
schlessera
approved these changes
Apr 3, 2020
schlessera
approved these changes
Apr 3, 2020
westonruter
added a commit
that referenced
this pull request
Apr 3, 2020
…ts are replaced with children (#4512) * Add failing test showing missing amp-form component script * Fix sanitization loop when invalid node is replaced with children * Add additional test case for gathering script from invalid parent
westonruter
added a commit
that referenced
this pull request
Apr 3, 2020
* tag '1.5.2': Bump 1.5.2 Bump version to 1.5.1-RC1 Cache response status and headers when fetching external stylesheets (#4509) Fix securing multi-line mustache templates (#4521) Add CSS monitoring time series to Site Health debugging info (#4519) Update hostname used for WordPress TV embeds to fix external HTTP requests (#4524) Fix processing of element child sanitization loop when invalid elements are replaced with children (#4512) Account for more YouTube URL formats (#4508) Update selected featured image ID on select (#4453) Raise default threshold for disabling CSS caching (#4513) Cast i-amphtml-intrinsic-sizer dimensions to integers (#4506) Only move meta tags to the head when required and add processing for meta[http-equiv] (#4505) Fix failing tests (#4507) Bump 1.5.2-alpha
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.
Summary
Fixes #4511.
When an unrecognized element is encountered, it is replaced with its children. This process wasn't accounted for when looping over the children of an element to sanitize. This PR ensures that when a child element is removed, the next loop iteration will pick up with the first valid descendant node that was in the now-removed child.
Checklist