summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/fetching/support/echo-helper.js
blob: 15bec650333d7c65b87cec797e9c168488a28546 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function get_resource_echo_url(uid, url) {
    return `/css/fetching/support/echo-headers.py?token=${uid}&location=${url}`
}

function wait_for_resource(url) {
    return new Promise(resolve => {
        const po = new PerformanceObserver(list => {
            const entries = list.getEntries();
            if (entries.find(e => e.name.includes(url)))
                resolve();
        })
        po.observe({type: "resource", buffered: true});
    });
}

async function get_headers(uid) {
    return await (await fetch(`/css/fetching/support/echo-headers.py?token=${uid}&location=echo`)).json()
}