|
1 onmessage = function(event) { |
|
2 if (event.data != 0) { |
|
3 var worker = new Worker('jsm_url_worker.js'); |
|
4 worker.onmessage = function(event) { |
|
5 postMessage(event.data); |
|
6 } |
|
7 |
|
8 worker.postMessage(event.data - 1); |
|
9 return; |
|
10 } |
|
11 |
|
12 status = false; |
|
13 try { |
|
14 if ((URL instanceof Object)) { |
|
15 status = true; |
|
16 } |
|
17 } catch(e) { |
|
18 } |
|
19 |
|
20 postMessage({type: 'status', status: status, msg: 'URL object:' + URL}); |
|
21 |
|
22 status = false; |
|
23 var blob = null; |
|
24 try { |
|
25 blob = new Blob([]); |
|
26 status = true; |
|
27 } catch(e) { |
|
28 } |
|
29 |
|
30 postMessage({type: 'status', status: status, msg: 'Blob:' + blob}); |
|
31 |
|
32 status = false; |
|
33 var url = null; |
|
34 try { |
|
35 url = URL.createObjectURL(blob); |
|
36 status = true; |
|
37 } catch(e) { |
|
38 } |
|
39 |
|
40 postMessage({type: 'status', status: status, msg: 'Blob URL:' + url}); |
|
41 |
|
42 status = false; |
|
43 try { |
|
44 URL.revokeObjectURL(url); |
|
45 status = true; |
|
46 } catch(e) { |
|
47 } |
|
48 |
|
49 postMessage({type: 'status', status: status, msg: 'Blob Revoke URL'}); |
|
50 |
|
51 status = false; |
|
52 var url = null; |
|
53 try { |
|
54 url = URL.createObjectURL(true); |
|
55 } catch(e) { |
|
56 status = true; |
|
57 } |
|
58 |
|
59 postMessage({type: 'status', status: status, msg: 'CreateObjectURL should fail if the arg is not a blob'}); |
|
60 |
|
61 status = false; |
|
62 var url = null; |
|
63 try { |
|
64 url = URL.createObjectURL(blob); |
|
65 status = true; |
|
66 } catch(e) { |
|
67 } |
|
68 |
|
69 postMessage({type: 'status', status: status, msg: 'Blob URL2:' + url}); |
|
70 postMessage({type: 'url', url: url}); |
|
71 |
|
72 status = false; |
|
73 try { |
|
74 URL.createObjectURL(new Object()); |
|
75 } catch(e) { |
|
76 status = true; |
|
77 } |
|
78 |
|
79 postMessage({type: 'status', status: status, msg: 'Exception wanted' }); |
|
80 |
|
81 postMessage({type: 'finish' }); |
|
82 } |