mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
2ebf302bab
Automatic update from web-platform-tests Add initial document policy tests Bug: 993790 Change-Id: Id1c780e43964ac0e8e2cc0abf49a19fb04c780ed Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1934780 Commit-Queue: Ian Clelland <iclelland@chromium.org> Reviewed-by: Jason Chase <chasej@chromium.org> Auto-Submit: Ian Clelland <iclelland@chromium.org> Cr-Commit-Position: refs/heads/master@{#720224} -- wpt-commits: 59244bef36dd4445d9ad6cbb4425e3c6a7e99741 wpt-pr: 20490
29 lines
746 B
Python
29 lines
746 B
Python
# This will echo the 'Sec-Required-Document-Policy' request header in the body
|
|
# of the response, as well as in the 'Document-Policy' response header (to
|
|
# ensure the response is loaded by a user agent which is implementing document
|
|
# policy.)
|
|
import json
|
|
|
|
def main(request, response):
|
|
msg = {}
|
|
headers = [('Content-Type', 'text/html')]
|
|
|
|
srdp = request.headers.get('Sec-Required-Document-Policy')
|
|
if srdp:
|
|
msg['requiredPolicy'] = srdp
|
|
headers.append(('Document-Policy', srdp))
|
|
|
|
frameId = request.GET.first('id',None)
|
|
if frameId:
|
|
msg['id'] = frameId
|
|
|
|
content = """<!DOCTYPE html>
|
|
<script>
|
|
top.postMessage(%s, "*");
|
|
</script>
|
|
%s
|
|
""" % (json.dumps(msg), srdp)
|
|
|
|
return (200, 'OK'), headers, content
|
|
|