tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

load-error-events.py (527B)


      1 import re
      2 
      3 def main(request, response):
      4    headers = [(b"Content-Type", b"text/javascript")]
      5    test = request.GET.first(b'test')
      6    assert(re.match(b'^[a-zA-Z0-9_]+$', test))
      7 
      8    status = 200
      9    if test.find(b'_load') >= 0:
     10      content = b'import "./module.json" with { type: "json"}; %s.executed = true;' % test
     11    else:
     12      content = b'import "./not_found.json" with { type: "json"}; %s.test.step(function() { assert_unreached("404 script should not be executed"); });' % test
     13 
     14    return status, headers, content