summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/speculation-rules/prerender/resources/shared-worker.py
blob: 48e5cd9c153eb5caf4c2b05cc4125b534f1ef93d (plain)
1
2
3
4
5
6
7
8
9
10
11
def main(request, response):
    if b"check" in request.GET:
        with request.server.stash.lock:
            result = request.server.stash.take(request.GET[b"id"])
            response.headers.set(b"Content-Type", b"text/plain")
            return result
    else:
        with request.server.stash.lock:
            request.server.stash.put(request.GET[b"id"], "ok")
            response.headers.set(b"Content-Type", b"text/javascript")
        return u"onconnect = ({ports: [port]}) => port.postMessage(performance.timeOrigin);"