hgserver: explicitly test for <script> content (bug 1333615); r?glob draft
authorGregory Szorc <gps@mozilla.com>
Wed, 05 Apr 2017 18:22:54 -0700
changeset 10766 69f9132f9d41fc54004157540f4a3f93fc3980ae
parent 10765 95244da7e42c29e54737595f27573c95892606a8
child 10767 c2ef0ae01407eb6305a5100a0fcc02f2b870811f
push id1619
push userbmo:gps@mozilla.com
push dateTue, 11 Apr 2017 21:40:13 +0000
reviewersglob
bugs1333615
hgserver: explicitly test for <script> content (bug 1333615); r?glob In preparation for adding a nonce, let's tweak the test so we can demonstrate change in behavior. MozReview-Commit-ID: 5f3C2cTH1av
hgserver/tests/test-csp.t
--- a/hgserver/tests/test-csp.t
+++ b/hgserver/tests/test-csp.t
@@ -3,19 +3,21 @@
   $ . $TESTDIR/hgserver/tests/helpers.sh
   $ hgmoenv
 
   $ hgmo create-repo mozilla-central scm_level_3
   (recorded repository creation in replication log)
 
 CSP header should be present on normal HTTP requests
 
-  $ http ${HGWEB_0_URL}mozilla-central --no-body --header content-security-policy
-  200
+  $ http ${HGWEB_0_URL}mozilla-central/shortlog --header content-security-policy | grep script
   content-security-policy: default-src 'none'; connect-src 'self' https://bugzilla.mozilla.org/; img-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'
+  <script type="text/javascript" src="/mozilla-central/static/mercurial.js"></script>
+  <script type="text/javascript">
+  </script>
 
 CSP header absent on protocol requests
 
   $ http ${HGWEB_0_URL}mozilla-central?cmd=capabilities --no-body --header content-security-policy
   200
 
 CSP header absent from Mercurial user agents