Branch: refs/heads/safari-7615.1.12-branch
  Home:   https://github.com/WebKit/WebKit
  Commit: 8b5749079faf2206cc0473da7f564aaddab2fcce
      
https://github.com/WebKit/WebKit/commit/8b5749079faf2206cc0473da7f564aaddab2fcce
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2022-11-09 (Wed, 09 Nov 2022)

  Changed paths:
    M Source/WebCore/contentextensions/ContentExtensionActions.cpp
    M Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp

  Log Message:
  -----------
  Cherry-pick b60c1a321a03. rdar://problem/101887185

    [Content Extensions] QueryTransforms should not unconditionally redirect to 
form-encoded URLs
    https://bugs.webkit.org/show_bug.cgi?id=247365

    Reviewed by Tim Horton and Timothy Hatcher.

    Refactor `QueryTransform::applyToURL`, so that it doesn't unconditionally 
call into
    `parseURLEncodedForm()`, and set the query to this URL-encoded form. 
Currently, this causes query
    parameters and values in the input URL to become percent-encoded, 
regardless of whether or not any
    of the query transformation rules matched.

    Instead, we change this behavior to leave query parameters intact, in the 
case where they don't
    match any of the query transformation rules. This means that if a URL query 
contains `"x+y=z"` and
    it doesn't match any transformation rules, the final result will remain 
as-is, rather than
    `"x%20y=z"`.

    Test: ContentExtensionTest.QueryTransformActions

    * Source/WebCore/contentextensions/ContentExtensionActions.cpp:

    Also, add an early return in the case where the URL has no query parameters 
at all, so that we can
    avoid spending any time checking against rules. We also avoid calling 
`setQuery` at all in the case
    where no actions were applied, so that we don't need to unnecessarily 
re-parse the URL if nothing
    changed.

    
(WebCore::ContentExtensions::RedirectAction::URLTransformAction::QueryTransform::applyToURL
 const):
    * Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:

    Add an API test to exercise the bug.

    Canonical link: https://commits.webkit.org/256260@main

Canonical link: https://commits.webkit.org/256138.22@safari-7615.1.12-branch


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to