Bug 223234 - [LayoutTests] Convert http/tests/referrer-policy convert PHP to Python
Summary: [LayoutTests] Convert http/tests/referrer-policy convert PHP to Python
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Gambrell
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-15 20:00 PDT by Chris Gambrell
Modified: 2021-04-02 11:35 PDT (History)
7 users (show)

See Also:


Attachments
Patch (59.89 KB, patch)
2021-03-15 20:04 PDT, Chris Gambrell
no flags Details | Formatted Diff | Diff
Patch (58.95 KB, patch)
2021-03-31 11:59 PDT, Chris Gambrell
no flags Details | Formatted Diff | Diff
Patch (72.38 KB, patch)
2021-03-31 14:07 PDT, Chris Gambrell
no flags Details | Formatted Diff | Diff
Patch (72.27 KB, patch)
2021-04-01 19:27 PDT, Chris Gambrell
jbedard: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Gambrell 2021-03-15 20:00:35 PDT
Replacing PHP with equivalent Python CGI scripts
Comment 1 Radar WebKit Bug Importer 2021-03-15 20:01:01 PDT
<rdar://problem/75460136>
Comment 2 Chris Gambrell 2021-03-15 20:04:00 PDT
Created attachment 423286 [details]
Patch
Comment 3 Chris Gambrell 2021-03-31 11:59:58 PDT
Created attachment 424797 [details]
Patch
Comment 4 Chris Gambrell 2021-03-31 12:00:52 PDT
Comment on attachment 424797 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=424797&action=review

> LayoutTests/ChangeLog:69
> +        * http/tests/referrer-policy/resources/script.php: Removed.

File not used by any tests
Comment 5 Chris Gambrell 2021-03-31 14:07:28 PDT
Created attachment 424819 [details]
Patch
Comment 6 Chris Gambrell 2021-03-31 16:07:26 PDT
Comment on attachment 424819 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=424819&action=review

> LayoutTests/http/tests/navigation/ping-attribute/resources/utilities.js:-29
> -    xhr.open("GET", "../../resources/delete-ping.php", true /* async */);

Referred to http/tests/resources/delete-ping.php instead of http/tests/navigation/resources/delete-ping.php
Comment 7 Jonathan Bedard 2021-04-01 08:35:07 PDT
Comment on attachment 424819 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=424819&action=review

> LayoutTests/http/tests/css/resources/webfont-request.py:9
> +http_root = os.path.dirname(os.path.dirname(os.path.abspath(os.path.dirname(file))))

I don't see us using this path

> LayoutTests/http/tests/referrer-policy/resources/image.py:17
> +with open(os.path.join('/'.join(__file__.split('/')[0:-1]), '../../security/contentSecurityPolicy/block-all-mixed-content/resources/red-square.png'), 'rb') as file:

Should use os.path.abspath(...) after os.path.join(...)

> LayoutTests/http/tests/websocket/tests/hybi/contentextensions/block-cookies-worker.py.json:16
> +]''')

I would do this instead:
print(json.dumps([{
    'action': {'type': 'block-cookies'},
    'trigger': {'url-filter': '8880'},
}], indent=4)

That way you don't have to worry about encoding JSON correctly

> LayoutTests/http/tests/websocket/tests/hybi/contentextensions/block-cookies.py.json:16
> +]''')

Ditto on manually encoding json
Comment 8 Chris Gambrell 2021-04-01 19:27:20 PDT
Created attachment 424975 [details]
Patch
Comment 9 Jonathan Bedard 2021-04-02 09:20:22 PDT
Comment on attachment 424975 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=424975&action=review

> LayoutTests/http/tests/css/resources/webfont-request.py:8
> +file = __file__.split(':/cygwin')[-1]

Doesn't look like we're using this
Comment 10 Chris Gambrell 2021-04-02 11:35:27 PDT
Committed r275427 (236090@main): <https://commits.webkit.org/236090@main>