summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/IndexedDB/idb_webworkers.htm
blob: dba3a93f120a3805fc4afe84029975f6ed462394 (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
<!DOCTYPE html>
<title>IndexedDB inside of a WebWorker </title>
<link rel="author" title="Microsoft" href="http://www.microsoft.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>

<script>
    var db, count = 0,
      t = async_test();

    t.step(function() {
        var worker = new Worker("idbworker.js");
        worker.onmessage = t.step_func(function (e) {
            switch(count) {
                case 0:
                    assert_equals(e.data, true, 'worker has idb object')
                    break

                case 1:
                    assert_equals(e.data, "test", "get(1) in worker")
                    t.done()
            }

            count++
        });

        worker.postMessage(1);
    })

</script>

<div id="log"></div>