-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for custom non-AMP scripts #6528
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
65410c6
WIP: Start to allow script sanitizer to actually sanitize scripts
westonruter f42d11c
Prevent unwrapping `noscript` elements when there were scripts kept.
westonruter 6d6128a
Use sanitize_scripts as sanitizer arg; remove obsolete todos
westonruter 860ab05
Add sanitization of event handler attributes
westonruter af98e66
Prevent including AMP event handlers as custom event handlers
westonruter b574010
Remove sanitizing JSON scripts in script sanitizer
westonruter cec9be0
Catch MaxCssByteCountExceeded exception when attempting to set style …
westonruter cc0bdb1
Update amp-toolbox-php to https://github.com/ampproject/amp-toolbox-p…
westonruter aa872f8
Add style sanitizer arg to skip_tree_shaking
westonruter bdc673a
Prevent enforcing CSS max byte count on dev mode documents
westonruter 1578aba
Run AMP_Script_Sanitizer first
westonruter e50e6a0
Prevent false positive event handler attribute detection with `amp-po…
westonruter 5c7eb99
Make amp-position-observer and amp-font attribute exceptions more spe…
westonruter b88d876
Turn off tree shaking in style sanitizer when script sanitizer keeps …
westonruter 880eb18
Defer gathering selector conversion mappings until sanitizing
westonruter c16126c
Add titles for script sanitizer error codes
westonruter 842b8b2
Fix commit ref for ampproject/amp-toolbox
westonruter ab30f62
Run composer update
westonruter 2ced838
Include script basename in external script error title
westonruter d918ba2
Add todos
westonruter 5fb6041
Use native img when custom scripts are kept
westonruter 170309a
Allow native post forms when custom scripts are kept
westonruter dae21b9
Fix omission of amp-form script given native_post_forms_allowed arg c…
westonruter f0f613a
Improve PHP comments
westonruter 681233e
Improve test coverage
westonruter dd49403
Rename sanitize_script_elements() back to sanitize_js_script_elements()
westonruter 3070b83
Rename sanitize_scripts arg to sanitize_js_scripts
westonruter 03fb8b7
Avoid false positive sanitization of non-JS scripts
westonruter f35c4e9
Use FQCN in docblock
pierlon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more checking if
amp_is_native_post_form_allowed()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, because now that the
AMP_Script_Sanitizer
can modify the args ofAMP_Form_Sanitizer
to enable thenative_post_forms_allowed
arg, the return value ofamp_is_native_post_form_allowed()
may not be accurate at this point. It's return value is used as the initial value fornative_post_forms_allowed
, but since it can be changed by a sanitizer then it's only relevant for setting the initial value inamp_get_content_sanitizers()
.In fact, there's not really a need for a global
amp_is_native_post_form_allowed()
function anymore.The only reason why the function was here was to offer a slight performance improvement to skip doing the XPath query. But now we are checking to see if the
amp-form
extension was identified instead.