Skip to content
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

#804 Update Allowed Tags And Attributes #823

Merged
merged 27 commits into from
Dec 12, 2017
Merged

Commits on Dec 5, 2017

  1. 804 : Update allowed AMP tags in sanitizer file.

    Generate class-amp-allowed-tags-generated.php,
    Using amp_wp_build.py.
    Followed the instructions at the top of the file.
    This is spec file revision 527.
    Ryan Kienstra committed Dec 5, 2017
    Configuration menu
    Copy the full SHA
    0b987a6 View commit details
    Browse the repository at this point in the history
  2. 804 : Prevent errors on amp_wp_build.py, update extensions dir.

    Before, there was an error in:
    tag_spec.also_requires_tag
    This didn't always have the property.
    Also, update the directory of the extensions.
    The .protoascii file is no longer in the directory '0.1.'
    Ryan Kienstra committed Dec 5, 2017
    Configuration menu
    Copy the full SHA
    30064ca View commit details
    Browse the repository at this point in the history

Commits on Dec 6, 2017

  1. Create is_mandatory_attribute_missing method

    Ryan Kienstra committed Dec 6, 2017
    Configuration menu
    Copy the full SHA
    ba459a2 View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2017

  1. 804 : Modify PHPUnit tests for tag and attribute validation.

    Since the allowed tags and attributes are updated,
    Several assertions failed.
    Update them to reflect the new AMP spec.
    Since there is no longer a protocol whitelist,
    Remove the assertions for protocols.
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    8cff768 View commit details
    Browse the repository at this point in the history
  2. 804 : Remove the requirement that 'data-multi-size' be empty.

    This file was generated from a build script,
    In the repo https://github.com/ampproject/amphtml
    The spec file seems to require an empty value:
    extensions/amp-ad/validator-amp-ad.protoascii
    But examples of <amp-ad> seem to have the value.
    Like <amp-ad data-multi-size=320x50.
    @see examples/a4a-multisize.amp.html.
    So remove the line in the PHP file that requires it to be empty.
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    dd807a8 View commit details
    Browse the repository at this point in the history
  3. 804 : PHPUnit tests for newly-allowed tags.

    Having generated a new file for the allowed tags and attributes,
    Add these to the data for test_sanitizer().
    Also, add unit test for is_missing_mandatory_attribute().
    And rename that function from:
    is_mandatory_attribute_missing().
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    a698eea View commit details
    Browse the repository at this point in the history
  4. 804 : Move logic for missing attributes.

    Before, this was inside an 'else' block.
    And it should be outside of this,
    So it applies more broadly.
    If there is a list of attributes, and one is missing,
    Remove the node.
    This was the previous behavior.
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    a066117 View commit details
    Browse the repository at this point in the history
  5. 804 : Remove the unused $spec_value variable.

    This was assigned a value that's used later.
    There's no need to store it in a variable.
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    cfcf730 View commit details
    Browse the repository at this point in the history
  6. 804 : Improve variable alignment and add PHPDoc tags.

    There was some missing documentation.
    Add this for test_sanitizer and validate_tag_spec_for_node.
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    8f0a925 View commit details
    Browse the repository at this point in the history
  7. 804 : Exclude the generated allowed tags file from PHPCS checks.

    This has hundreds of errors and warnings.
    It's generated from a Python script.
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    a400fa5 View commit details
    Browse the repository at this point in the history
  8. 804 : Align 'array' keywords vertically.

    In response to the warnings in Travis.
    And align an equal sign in test_sanitizer().
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    cfc0247 View commit details
    Browse the repository at this point in the history
  9. 804 : Change the conditional to simply compare to true.

    Before, there was a failed Travis build.
    This used boolval(), which caused a fatal error.
    Instead, simply compare the value to true.
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    7f9a2db View commit details
    Browse the repository at this point in the history
  10. 804 : Array and equal sign alignment fixes.

    In response to a failed Travis build.
    Fix an error in an array not being aligned.
    An move an = sign 2 spaces to the left.
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    b4bfd81 View commit details
    Browse the repository at this point in the history
  11. 804 : Prevent accessing an object as an array.

    There was an error in the Travis build.
    A function accessed a DOMElement property as an array.
    Instead, use the setAttribute() method.
    Ryan Kienstra committed Dec 7, 2017
    Configuration menu
    Copy the full SHA
    6f5e39d View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2017

  1. Configuration menu
    Copy the full SHA
    2b1443e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c73f92b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f67041d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    236968b View commit details
    Browse the repository at this point in the history

Commits on Dec 9, 2017

  1. 804 : Add a contributing.md file, with steps to use build script.

    This describes how to use the new script amphtml-update.sh.
    This is mainly modified from another open-source file.
    It could probably use more information.
    Including the workflow for submitting pull requests.
    Ryan Kienstra committed Dec 9, 2017
    Configuration menu
    Copy the full SHA
    eab6207 View commit details
    Browse the repository at this point in the history
  2. 804 : Test that 'amp-playbuzz' is sanitized properly.

    As harrisdavid mentioned, before this PR, the 'src' was mandatory.
    But with the updated AMP spec, it's not.
    Ryan Kienstra committed Dec 9, 2017
    Configuration menu
    Copy the full SHA
    eef4b8b View commit details
    Browse the repository at this point in the history
  3. 804 : Add allowed protocols to sanitization file.

    Before, there was an issue in the file that created:
    class-amp-allowed-tags-generated.php.
    amphtml-update.sh had a conditional:
    if isinstance(value, list)
    But the allowed_protocol attribute has a type of:
    google.protobuf.internal.containers.RepeatedScalarFieldContainer
    So that conditional failed.
    And allowed_protocol wasn't added.
    So instead, make that an 'else' statement.
    That change only resulted in 'allowed_tags' being added.
    Ryan Kienstra committed Dec 9, 2017
    Configuration menu
    Copy the full SHA
    ae92a58 View commit details
    Browse the repository at this point in the history

Commits on Dec 11, 2017

  1. Fix WPCS warning

    ThierryA committed Dec 11, 2017
    Configuration menu
    Copy the full SHA
    4597be5 View commit details
    Browse the repository at this point in the history
  2. 804 : Add to contributing.md, including unit test information.

    Add a point that this requires WP unit tests.
    Also, begin with the welcome that Thierry suggested.
    Props @ThierryA.
    Ryan Kienstra committed Dec 11, 2017
    Configuration menu
    Copy the full SHA
    44554c5 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'feature/804-allowed-tags' of https://github.com/Automat…

    …tic/amp-wp into feature/804-allowed-tags
    Ryan Kienstra committed Dec 11, 2017
    Configuration menu
    Copy the full SHA
    ed3c93d View commit details
    Browse the repository at this point in the history
  4. 804 : Merge in develop, resolve conflicts.

    In phpcs.xml, retain edits from both branches.
    There were several conflicts in:
    class-amp-tag-and-attribute-sanitizer.php
    These were mainly conflicts with 03c12.
    Some were only DocBlocks, but some were logic.
    I mainly resovled them in favor of this branch:
    feature/804-allowed-tags.
    Ryan Kienstra committed Dec 11, 2017
    Configuration menu
    Copy the full SHA
    c3b28c0 View commit details
    Browse the repository at this point in the history

Commits on Dec 12, 2017

  1. 804 : Correct PHPUnit test for <script> validation.

    When this has a type of 'application/json,'
    There is a required ancestor.
    So create an ancestor of <amp-analytics>.
    Ryan Kienstra committed Dec 12, 2017
    Configuration menu
    Copy the full SHA
    4b3ec53 View commit details
    Browse the repository at this point in the history
  2. 804 : Add spaces to correct PHPCS errors.

    In response to a failed Travis build.
    Also, change == to ===.
    Ryan Kienstra committed Dec 12, 2017
    Configuration menu
    Copy the full SHA
    af7b830 View commit details
    Browse the repository at this point in the history