summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/pic/cached-array-length-access.html
blob: 7743e6a78998f178e508d4eceecc15c4796b16eb (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
<p>
This page tests cached access to properties of dictionary objects and objects
with changing prototypes. If the test passes, you'll see a series of PASS messages
below.
</p>

<pre id="console"></pre>

<script>
(function() {
    if (window.testRunner)
        testRunner.dumpAsText();

    function log(s)
    {
        if (this.document)
            document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
        else
            print(s + "\n");
    }
    
    function shouldBe(a, aDescription, b)
    {
        if (a === b) {
            log("PASS: " + aDescription + " should be " + b + " and is.\n");
        } else {
            log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + ".\n");
        }
    }
    
    (function() {
        var largestInteger = 4294967295;
        var array = new Array();
        array[largestInteger - 1] = "test";
        var len = -1;
        for (var i=0; i<10; ++i) len = array.length;
        
        shouldBe(len, "len", largestInteger);
    })();

})();
</script>