<!doctype html>
<title>Set location.protocol from an HTTP URL</title>
<!-- In particular, valid non-broken schemes that are nevertheless not going to work -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<script>
self.onload = () => {
  [
    'x',
    'data',
    'file',
    'ftp',
    'http+x'
  ].forEach((val, index) => {
    async_test((t) => {
      self[index].location.protocol = val
      t.step_timeout(() => {
        assert_equals(self[index].location.protocol, location.protocol)
        assert_equals(self[index].location.host, location.host)
        assert_equals(self[index].location.port, location.port)
        t.done()
        // Experimentally, 4 seconds is long enough for the navigation to
        // complete, if it happens.
      }, 4000)
    }, "Set location.protocol to " + val)
  })
}
</script>
