Bug 223234

Summary: [LayoutTests] Convert http/tests/referrer-policy convert PHP to Python
Product: WebKit Reporter: Chris Gambrell <cgambrell>
Component: Tools / TestsAssignee: Chris Gambrell <cgambrell>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, drousso, ews-watchlist, jbedard, mkwst, ryanhaddad, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=220749
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch jbedard: review+, ews-feeder: commit-queue-

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>