summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/malformed-worker.py
blob: 501521ff3e37dfc75bc61f3213c8282410f91fbe (plain)
1
2
3
4
5
6
7
8
9
10
def main(request, response):
    headers = [("Content-Type", "application/javascript")]

    body = {'parse-error': 'var foo = function() {;',
            'undefined-error': 'foo.bar = 42;',
            'uncaught-exception': 'throw new DOMException("AbortError");',
            'caught-exception': 'try { throw new Error; } catch(e) {}',
            'import-malformed-script': 'importScripts("malformed-worker.py?parse-error");',
            'import-no-such-script': 'importScripts("no-such-script.js");'}[request.url_parts.query]
    return headers, body