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

Add debugging query arguments #3448

Closed
wants to merge 34 commits into from
Closed

Commits on Oct 4, 2019

  1. Add debugging query arguments

    - disable_post_processing
    - disable_response_cache
    - prevent_redirect
    - reject_all_errors
    @todo: add a query arg to exclude sanitizers.
    kienstra committed Oct 4, 2019
    Configuration menu
    Copy the full SHA
    37de1c3 View commit details
    Browse the repository at this point in the history
  2. Use the filter 'amp_validation_error_sanitized' instead of another co…

    …nditional
    
    As Weston mentioned, this can simply use
    the filter that exists,
    kienstra committed Oct 4, 2019
    Configuration menu
    Copy the full SHA
    e738bcf View commit details
    Browse the repository at this point in the history
  3. Add a separate filter for 'amp_validation_error_sanitized', add top-l…

    …evel var
    
    The filter in accept_validation_errors()
    might not actually run,
    if get_acceptable_errors() doesn't return anything.
    kienstra committed Oct 4, 2019
    Configuration menu
    Copy the full SHA
    19363fc View commit details
    Browse the repository at this point in the history

Commits on Oct 8, 2019

  1. Configuration menu
    Copy the full SHA
    aeeda26 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2019

  1. Add a query var to accept 'excessive_css' errors

    This adds a callback for 'amp_validation_error_sanitized',
    and also checks for the presence of the 'reject_all_errors'
    query var in that callback.
    The query var is accessed like:
    ?amp_flags[accept_excessive_css]
    kienstra committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    388de8e View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2019

  1. Configuration menu
    Copy the full SHA
    17747a4 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2019

  1. Add a query var to skip tree shaking

    This prevents raising an 'excessive_css' error,
    and simply prints all of the styling in the
    <style amp-custom>
    kienstra committed Oct 13, 2019
    Configuration menu
    Copy the full SHA
    2c0b1d0 View commit details
    Browse the repository at this point in the history
  2. Add a debug query var to disable AMP

    This is mainly intended for Standard mode,
    as it would be strange to have an ?amp
    query var, then one after it to disable AMP.
    Still, there's an issue where on redirecting
    
    in Transitional mode,
    the query var is still present in the URL, like:
    https://example.com/new-post-2/?amp_flags%5Bdisable_amp%5D
    kienstra committed Oct 13, 2019
    Configuration menu
    Copy the full SHA
    e41505d View commit details
    Browse the repository at this point in the history
  3. In the case of redirecting to the non-AMP URL, remove the flags query…

    … arg
    
    It's possible, though probably not common,
    that a request would have ?amp
    and the query arg to disable AMP.
    When in Transitional mode, this will
    cause a redirect to the non-AMP endpoint.
    This ensures that the amp_flags query
    var is stripped from the redirect URL.
    kienstra committed Oct 13, 2019
    Configuration menu
    Copy the full SHA
    ac1311e View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2019

  1. Begin to add the submenu in the admin bar for AMP debugging options

    This uses React on the front-end,
    as it will use toggles,
    and may need to de-select some toggles
    when certain toggles are selected.
    It might be a little too much to enqueue React
    (wp-element) just for this, so I'll have
    to revisit whether it's necessary.
    kienstra committed Oct 14, 2019
    Configuration menu
    Copy the full SHA
    fffbbbd View commit details
    Browse the repository at this point in the history
  2. Address failed PHPUnit test in Travis

    Remove a test that looks to have caused
    and undefined index error.
    kienstra committed Oct 14, 2019
    Configuration menu
    Copy the full SHA
    fe602ac View commit details
    Browse the repository at this point in the history
  3. Attempt to address failed PHPUnit test by removing a filter

    It looks like another function was running
    on the same filter, and had an error.
    So remove_remove_all_filters() for that filter.
    kienstra committed Oct 14, 2019
    Configuration menu
    Copy the full SHA
    405d30d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    39b0e2f View commit details
    Browse the repository at this point in the history
  5. Delete the remove_all_filters() calls, instead register 'wp-element'

    It looks like these didn't fix the failing
    Travis builds.
    So instead, register the 'wp-element' script.
    kienstra committed Oct 14, 2019
    Configuration menu
    Copy the full SHA
    e4be908 View commit details
    Browse the repository at this point in the history
  6. Add the remaining query vars to the submenu

    There is still much remaining,
    including adding the toggles and styling.
    kienstra committed Oct 14, 2019
    Configuration menu
    Copy the full SHA
    81be395 View commit details
    Browse the repository at this point in the history
  7. Change skip_tree_shaking to disable_tree_shaking

    Both in the name of the function
    and the query var.
    This is to stay consistent with other query vars
    that have 'disable' in them,
    like 'disable_amp'
    kienstra committed Oct 14, 2019
    Configuration menu
    Copy the full SHA
    114e5d8 View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2019

  1. Add the toggles for the query vars

    Use the <ToggleControl> from Gutenberg,
    though this still needs a lot of styling.
    kienstra committed Oct 15, 2019
    Configuration menu
    Copy the full SHA
    2bd69c3 View commit details
    Browse the repository at this point in the history
  2. Add the debug options to the admin bar even on non-AMP endpoints

    There's a 'View AMP version' link,
    so it probably makes sense to have
    these query vars available.
    kienstra committed Oct 15, 2019
    Configuration menu
    Copy the full SHA
    5f186af View commit details
    Browse the repository at this point in the history
  3. Continue with query args.

    kienstra committed Oct 15, 2019
    Configuration menu
    Copy the full SHA
    8b0c96f View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2019

  1. Remove the JS to add the admin bar debug options

    As discussed in the PR,
    these will be rendered with PHP.
    kienstra committed Oct 18, 2019
    Configuration menu
    Copy the full SHA
    7b41a0b View commit details
    Browse the repository at this point in the history
  2. Add a submenu to the admin bar for the debug options

    As Weston mentioned,
    an option has a 'check mark' emoji next to it
    if its query var is in the current URL.
    This still might need more thought,
    like whether these should always be present in the
    admin bar, even on a non-AMP URL
    where the AMP URL is blocked due to validation errors.
    kienstra committed Oct 18, 2019
    Configuration menu
    Copy the full SHA
    c5b0d3b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    00358e4 View commit details
    Browse the repository at this point in the history
  4. Remove the entry in webpack.config.js for the previous JS file

    There used to be a JS file
    for the WP Admin Bar,
    but this is now handled in PHP.
    kienstra committed Oct 18, 2019
    Configuration menu
    Copy the full SHA
    7a3733a View commit details
    Browse the repository at this point in the history
  5. Fix failing unit test for AMP_Validation_Error_Taxonomy

    test_is_validation_error_sanitized_and_get_validation_error_sanitization()
    failed in the build,
    so change the expected term_status.
    kienstra committed Oct 18, 2019
    Configuration menu
    Copy the full SHA
    687cf47 View commit details
    Browse the repository at this point in the history
  6. Use different emojis for the checkboxes

    Also, use different emojis for the checked and
    unchecked states.
    kienstra committed Oct 18, 2019
    Configuration menu
    Copy the full SHA
    ef0720c View commit details
    Browse the repository at this point in the history
  7. Fix unit test of dependent function

    add_debugging_option_nodes()
    depends on get_debugging_option_title(),
    and that function recently changed.
    So the test for add_debugging_option_nodes()
    needs to be updated.
    kienstra committed Oct 18, 2019
    Configuration menu
    Copy the full SHA
    675f875 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2019

  1. Thanks to Alain's suggestion, add AMP_Debug class

    Mainly based on Alain's code example.
    Change the individual checks for
    the query var to a call to AMP_Debug::has_flag().
    kienstra committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    996157a View commit details
    Browse the repository at this point in the history
  2. Remove 2 constants that were moved to AMP_Debug

    These aren't needed anymore in
    AMP_Validation_Error_Taxonomy.
    kienstra committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    e3bad9e View commit details
    Browse the repository at this point in the history
  3. Simplify tests and improve DocBlocks

    Minor edits, like changing:
    assertEquals( false
    to:
    assertFalse(
    Also, improve some DocBlocks.
    kienstra committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    4b6a48f View commit details
    Browse the repository at this point in the history
  4. Add a test for passing a random string as a query var

    To test the behavior with:
    &amp_flags[disable_post_processing]=random-string
    kienstra committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    d5e2b2d View commit details
    Browse the repository at this point in the history
  5. Add another assertion for a numeric string returning false

    For example,
    &amp_flags[disable_post_processing]=5555
    kienstra committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    1d40623 View commit details
    Browse the repository at this point in the history
  6. Add a little documentation for AMP_Debug::has_flag()

    This should help to
    see how to use this.
    kienstra committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    42a29d0 View commit details
    Browse the repository at this point in the history
  7. Change the behavior for the query var being present but empty

    Now, something like:
    &amp_flags[disable_amp]
    will be true.
    kienstra committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    a1929ab View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2019

  1. Merge branch 'develop' of github.com:ampproject/amp-wp into add/query…

    …-args-debugging
    
    * 'develop' of github.com:ampproject/amp-wp: (163 commits)
      Remove entries array test after completed.
      Update dependency core-js to v3.3.4 (#3624)
      Quick UX fixes (#3611)
      Fix most pressing RTL issues (#3558)
      Add test case for broken parent relationship
      Adapt broken test
      Throw a _doing_it_wrong() when an expected parent is not found
      Change template hierarchy query arguments to public
      Reuse data-set-focus to reliably match twentytwenty keyboard focus management
      Add tabindex attribute to modals
      Guess the role of a modal based on its classes
      Disable Code Editor (#3608)
      Update dependency postcss to v7.0.20 (#3613)
      Update dependency autoprefixer to v9.7.0 (#3614)
      Update dependency browserslist to v4.7.2 (#3612)
      Add rel=preconnect link for AMP CDN
      Fix block nav padding and margin (#3610)
      Adjust Gutenberg / WordPress requirement (#3609)
      Don't allow multiple CTA / attachment block to be pasted. (#3601)
      Fix page crashing when duplicating immovable blocks (#3593)
      ...
    westonruter committed Oct 25, 2019
    Configuration menu
    Copy the full SHA
    03a2395 View commit details
    Browse the repository at this point in the history