summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-iframe.py
blob: 0281b6c2755e2ab63e4d00baf4969d57935d9f3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os.path

from wptserve.utils import isomorphic_decode

def main(request, response):
  header = [(b'Content-Type', b'text/html')]
  if b'test' in request.GET:
    with open(os.path.join(os.path.dirname(isomorphic_decode(__file__)), u'sample.js'), u'r') as f:
      body = f.read()
    return (header, body)

  if b'sandbox' in request.GET:
    header.append((b'Content-Security-Policy',
                   b'sandbox %s' % request.GET[b'sandbox']))
  with open(os.path.join(os.path.dirname(isomorphic_decode(__file__)),
                         u'sandboxed-iframe-fetch-event-iframe.html'), u'r') as f:
    body = f.read()
  return (header, body)