summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webstorage/event_case_sensitive.js
blob: 2729a3bed3c467482f82306ad49780b8a9d36d2b (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
44
45
46
testStorages(function(storageString) {
    async_test(function(t) {
        assert_true(storageString in window, storageString + " exist");
        var storage = window[storageString];
        t.add_cleanup(function() { storage.clear() });

        clearStorage(storageString, t.step_func(step0));
        assert_equals(storage.length, 0, "storage.length");

        function step0(msg)
        {
            storage.foo = "test";
            runAfterNStorageEvents(t.step_func(step1), 1);
        }

        function step1(msg)
        {
            storageEventList = new Array();
            storage.foo = "test";

            runAfterNStorageEvents(t.step_func(step2), 0);
        }

        function step2(msg)
        {
            if(msg != undefined) {
                assert_unreached(msg);
            }
            assert_equals(storageEventList.length, 0);

            storage.foo = "TEST";

            runAfterNStorageEvents(t.step_func(step3), 1);
        }

        function step3(msg)
        {
            if(msg != undefined) {
                assert_unreached(msg);
            }
            assert_equals(storageEventList.length, 1);

            t.done();
        }
    }, storageString + " storage events fire even when only the case of the value changes.");
});