OLD | NEW |
| (Empty) |
1 <!-- | |
2 var err = new Error('foo'); | |
3 var date = new Date(); | |
4 // commented out bits are either tested elsewhere or not supported yet. or unclo
neable. | |
5 var tests = [undefined, null, false, true, 1, NaN, Infinity, 'foo', date, /foo/,
/* ImageData, File, FileData, FileList,*/ null/*self*/, | |
6 [undefined, null, false, true, 1, NaN, Infinity, 'foo', /*date, /f
oo/,*/ null/*self*/, /*[], {},*/ null/*err*/], | |
7 {a:undefined, b:null, c:false, d:true, e:1, f:NaN, g:Infinity, h:'
foo', /*i:date, j:/foo/,*/ k:null/*self*/, /*l:[], m:{},*/ n:null/*err*/}, | |
8 null/*err*/]; | |
9 for (var i = 0; i < tests.length; ++i) { | |
10 try { | |
11 postMessage(tests[i]); | |
12 } catch(e) { | |
13 postMessage(''+e); | |
14 } | |
15 } | |
16 /* | |
17 --> | |
18 <!doctype html> | |
19 <title>structured clone of message</title> | |
20 <script src="/resources/testharness.js"></script> | |
21 <script src="/resources/testharnessreport.js"></script> | |
22 <div id="log"></div> | |
23 <script> | |
24 var wrapper_test = async_test(); | |
25 var tests = [ | |
26 {test:async_test('undefined'), check:function(e) { assert_equals(e.data, u
ndefined); }}, | |
27 {test:async_test('null'), check:function(e) { assert_equals(e.data, null);
}}, | |
28 {test:async_test('false'), check:function(e) { assert_false(e.data); }}, | |
29 {test:async_test('true'), check:function(e) { assert_true(e.data); }}, | |
30 {test:async_test('1'), check:function(e) { assert_equals(e.data, 1); }}, | |
31 {test:async_test('NaN'), check:function(e) { assert_equals(e.data, NaN); }
}, | |
32 {test:async_test('Infinity'), check:function(e) { assert_equals(e.data, In
finity); }}, | |
33 {test:async_test('string'), check:function(e) { assert_equals(e.data, 'foo
'); }}, | |
34 {test:async_test('date'), check:function(e) { assert_equals(e.data instanc
eof Date, true); }}, | |
35 {test:async_test('regexp'), check:function(e) { assert_equals('' + e.data,
'/foo/'); assert_equals(e.data instanceof RegExp, true, 'e.data instanceof RegE
xp'); }}, | |
36 {test:async_test('self'), check:function(e) { assert_equals(e.data, null);
}}, | |
37 {test:async_test('array'), check:function(e) { assert_array_equals(e.data,
[undefined, null, false, true, 1, NaN, Infinity, 'foo', null, null]); }}, | |
38 {test:async_test('object'), check:function(e) { assert_object_equals(e.dat
a, {a:undefined, b:null, c:false, d:true, e:1, f:NaN, g:Infinity, h:'foo', k:nul
l, n:null}); }}, | |
39 {test:async_test('error'), check:function(e) { assert_equals(e.data, null,
'new Error()'); }}, | |
40 {test:wrapper_test, check:function(e) { assert_unreached(); }} | |
41 ]; | |
42 // make wrapper_test pass after 500ms | |
43 setTimeout(tests[tests.length-1].test.step_func(function() { | |
44 this.done(); | |
45 }), 500); | |
46 | |
47 wrapper_test.step(function() { | |
48 var worker = new Worker('#'); | |
49 var i = 0; | |
50 worker.onmessage = function(e) { | |
51 tests[i].test.step(function() { tests[i].check(e); this.done(); }); | |
52 i++; | |
53 }; | |
54 }); | |
55 </script> | |
56 <!-- | |
57 */ | |
58 //--> | |
OLD | NEW |