diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html')
-rw-r--r-- | tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html b/tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html index 742309ab4d2..47de0da7790 100644 --- a/tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html +++ b/tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html @@ -2,16 +2,24 @@ <html> <meta charset="utf-8"> <script src="/common/utils.js"></script> +<script src="/common/get-host-info.sub.js"></script> <script> -const uuid = token(); -const URL = - `../resources/redirect.py?` + - `delay=100&` + - `location=../resources/stash-put.py?key=${uuid}%26value=on`; +const SEARCH_PARAMS = new URL(location.href).searchParams; +const ORIGIN1 = SEARCH_PARAMS.get('origin1') || ''; +const ORIGIN2 = SEARCH_PARAMS.get('origin2') || ''; +const WITH_HEADERS = !!SEARCH_PARAMS.has('with-headers'); +const TOKEN = token(); + +const url = + `${ORIGIN1}/fetch/api/resources/redirect.py?` + + `delay=500&` + + `allow_headers=foo&` + + `location=${ORIGIN2}/fetch/api/resources/stash-put.py?key=${TOKEN}%26value=on`; addEventListener('load', () => { - let p = fetch(URL, {keepalive: true}); - window.parent.postMessage(uuid, '*'); + const headers = WITH_HEADERS ? {'foo': 'bar'} : undefined; + let p = fetch(url, {keepalive: true, headers}); + window.parent.postMessage(TOKEN, '*'); }); </script> </html> |