summaryrefslogtreecommitdiffstats
path: root/WebCore/manual-tests/memory/xhr-repeated-string-access.xml
blob: efb8e35fc740d3900c188555ede576164b4ae65a (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<html xmlns="http://www.w3.org/1999/xhtml">
  
  <head>
    <title>Massive Memory Leak</title>
    <script>
      <![CDATA[

        function loadVideo (videoURI) {
          var xhr = new XMLHttpRequest();
          xhr.open('GET', videoURI, true);
          xhr.onreadystatechange = function (xhrEvent) {
            if (xhr.readyState == 3) {
              var currentLength = xhr.responseText.length;
              var totalLength = parseInt(xhr.getResponseHeader('Content-Length'), 10);
              print((Math.round((currentLength / totalLength) * 10000) / 100) + '%');
            }
            else if (xhr.readyState == 4) {
              if (xhr.status == 200) {
                alert('done loading');
                alert(xhr.responseText.length);
              }
              else {
                alert('NOK');
              }
            }
          };
          xhr.send(null);
        }

        function print (message) {
          document.getElementById('outlet').textContent = message;
        }

      ]]>
    </script>
  </head>
  
  <body>
    <a onclick="loadVideo('http://streamos.atlrec.com/download/atlantic/bjork/video/bjork_itunes1.m4v');">do it!</a>
    <p id="outlet" />
  </body>
  
</html>