1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29

content / test / data / sync_xmlhttprequest_disallowed.html [blame]

<html>
<head>
<script>
var success = false;

function OnLoad() {
  try {
    var request = new XMLHttpRequest();
    request.open("GET", "file:///c:/foo.txt", false);
    request.send(null);
  } catch (e) {
    success = true;
  }
  document.getElementById("console").appendChild(
      document.createTextNode(success ? "SUCCESS" : "FAILURE"));
}

function DidSucceed() {
  return success;
}

</script>
</head>
<body onload="OnLoad();">
This page sends a synchronous XMLHttpRequest to fetch a local file, which
should not be allowed.
<div id="console"></div>
</body>
</html>