| OLD | NEW |
| 1 // include fast/js/resources/js-test-pre.js before this file. | 1 // include fast/js/resources/js-test-pre.js before this file. |
| 2 | 2 |
| 3 function doLeakTest(src, tolerance) { | 3 function doLeakTest(src, tolerance) { |
| 4 function getCounterValues() { | 4 function getCounterValues() { |
| 5 testRunner.resetTestHelperControllers(); | 5 testRunner.resetTestHelperControllers(); |
| 6 gc(); | 6 gc(); |
| 7 return {'numberOfLiveDocuments': window.internals.numberOfLiveDocuments(
)}; | 7 return {'numberOfLiveDocuments': window.internals.numberOfLiveDocuments(
)}; |
| 8 } | 8 } |
| 9 | 9 |
| 10 var frame = document.createElement('iframe'); | 10 var frame = document.createElement('iframe'); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 loadSourceIntoIframe('about:blank', function() { | 43 loadSourceIntoIframe('about:blank', function() { |
| 44 // blank document loaded... | 44 // blank document loaded... |
| 45 var countersBefore = getCounterValues(); | 45 var countersBefore = getCounterValues(); |
| 46 | 46 |
| 47 loadSourceIntoIframe(src, function() { | 47 loadSourceIntoIframe(src, function() { |
| 48 // target document loaded... | 48 // target document loaded... |
| 49 | 49 |
| 50 loadSourceIntoIframe('about:blank', function() { | 50 loadSourceIntoIframe('about:blank', function() { |
| 51 // target document unloaded... | 51 // target document unloaded... |
| 52 | 52 |
| 53 var countersAfter = getCounterValues(); | 53 // Measure counter values on next timer event. This is needed |
| 54 compareValues(countersBefore, countersAfter, tolerance); | 54 // to correctly handle deref cycles for some ActiveDOMObjects |
| 55 finishJSTest(); | 55 // such as XMLHttpRequest. |
| 56 setTimeout(function() { |
| 57 var countersAfter = getCounterValues(); |
| 58 compareValues(countersBefore, countersAfter, tolerance); |
| 59 finishJSTest(); |
| 60 }, 100); |
| 56 }); | 61 }); |
| 57 }); | 62 }); |
| 58 }); | 63 }); |
| 59 } | 64 } |
| 60 | 65 |
| 61 function htmlToUrl(html) { | 66 function htmlToUrl(html) { |
| 62 return 'data:text/html;charset=utf-8,' + html; | 67 return 'data:text/html;charset=utf-8,' + html; |
| 63 } | 68 } |
| 64 | 69 |
| 65 function grabScriptText(id) { | 70 function grabScriptText(id) { |
| 66 return document.getElementById(id).innerText; | 71 return document.getElementById(id).innerText; |
| 67 } | 72 } |
| 68 | 73 |
| 69 // include fast/js/resources/js-test-post.js after this file. | 74 // include fast/js/resources/js-test-post.js after this file. |
| OLD | NEW |