1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
|
20 | Modernizr.addAsyncTest(function() {
|
21 | try {
|
22 | var data = 'Modernizr',
|
23 | worker = new Worker('data:text/javascript;base64,dGhpcy5vbm1lc3NhZ2U9ZnVuY3Rpb24oZSl7cG9zdE1lc3NhZ2UoZS5kYXRhKX0=');
|
24 |
|
25 | worker.onmessage = function(e) {
|
26 | worker.terminate();
|
27 | addTest('dataworkers', data === e.data);
|
28 | worker = null;
|
29 | };
|
30 |
|
31 |
|
32 | worker.onerror = function() {
|
33 | addTest('dataworkers', false);
|
34 | worker = null;
|
35 | };
|
36 |
|
37 | setTimeout(function() {
|
38 | addTest('dataworkers', false);
|
39 | }, 200);
|
40 |
|
41 | worker.postMessage(data);
|
42 | } catch (e) {
|
43 | setTimeout(function() {
|
44 | addTest('dataworkers', false);
|
45 | }, 0);
|
46 | }
|
47 | });
|
48 | });
|