| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/js-test.js"></script> | 2 <script src="../resources/js-test.js"></script> |
| 3 <script src="resources/compatibility.js"></script> |
| 3 <body> | 4 <body> |
| 4 <script> | 5 <script> |
| 5 description('Tests that a script processor node is not prematurely GCed'); | 6 description('Tests that a script processor node is not prematurely GCed'); |
| 6 var jsTestIsAsync = true; | 7 var jsTestIsAsync = true; |
| 7 | 8 |
| 8 if (!window.internals) { | 9 if (!window.internals) { |
| 9 testFailed('This test requires window.internals.'); | 10 testFailed('This test requires window.internals.'); |
| 10 finishJSTest(); | 11 finishJSTest(); |
| 11 } | 12 } |
| 12 | 13 |
| 13 var wasCalled, wasCollectedPrematurely, savedNode, savedCallback; | 14 var wasCalled, wasCollectedPrematurely, savedNode, savedCallback; |
| 14 | 15 |
| 15 function test(saveReference, nextStep) { | 16 function test(saveReference, nextStep) { |
| 16 debug('Testing ' + (saveReference ? 'with' : 'without') + ' explicitly ' + | 17 debug('Testing ' + (saveReference ? 'with' : 'without') + ' explicitly ' + |
| 17 'keeping a reference to the script processor node alive.'); | 18 'keeping a reference to the script processor node alive.'); |
| 18 | 19 |
| 19 // Create an audio context | 20 // Create an audio context |
| 20 var context = new webkitOfflineAudioContext( | 21 var context = new OfflineAudioContext( |
| 21 2, // channels | 22 2, // channels |
| 22 4096, // length (frames) | 23 4096, // length (frames) |
| 23 44100.0); // sample rate | 24 44100.0); // sample rate |
| 24 | 25 |
| 25 // Set up a source, reading from an empty buffer | 26 // Set up a source, reading from an empty buffer |
| 26 var source = context.createBufferSource(); | 27 var source = context.createBufferSource(); |
| 27 source.buffer = context.createBuffer( | 28 source.buffer = context.createBuffer( |
| 28 2, // source channels | 29 2, // source channels |
| 29 4096, // length (frames) | 30 4096, // length (frames) |
| 30 44100.0); // sample rate | 31 44100.0); // sample rate |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 79 } |
| 79 | 80 |
| 80 function step2() { | 81 function step2() { |
| 81 test(false, finishJSTest); | 82 test(false, finishJSTest); |
| 82 } | 83 } |
| 83 | 84 |
| 84 step1(); | 85 step1(); |
| 85 | 86 |
| 86 var successfullyParsed = true; | 87 var successfullyParsed = true; |
| 87 </script> | 88 </script> |
| OLD | NEW |