Index: LayoutTests/resources/leak-check.js |
diff --git a/LayoutTests/resources/leak-check.js b/LayoutTests/resources/leak-check.js |
index 5e4f708dd1fb3761426aab8952cb024800c49262..6c39679488df381260c298e2e60386ba840c2b45 100644 |
--- a/LayoutTests/resources/leak-check.js |
+++ b/LayoutTests/resources/leak-check.js |
@@ -1,16 +1,17 @@ |
// include resources/js-test.js before this file. |
-function getCounterValues() { |
+function getCounterValues(callback) { |
testRunner.resetTestHelperControllers(); |
- gc(); |
+ asyncGC(function() { |
+ var ret = {'numberOfLiveDocuments': window.internals.numberOfLiveDocuments()}; |
- var ret = {'numberOfLiveDocuments': window.internals.numberOfLiveDocuments()}; |
+ var refCountedInstances = JSON.parse(window.internals.dumpRefCountedInstanceCounts()); |
+ for (typename in refCountedInstances) |
+ ret['numberOfInstances-'+typename] = refCountedInstances[typename]; |
- var refCountedInstances = JSON.parse(window.internals.dumpRefCountedInstanceCounts()); |
- for (typename in refCountedInstances) |
- ret['numberOfInstances-'+typename] = refCountedInstances[typename]; |
+ callback(ret); |
+ }); |
- return ret; |
} |
function compareValues(countersBefore, countersAfter, tolerance) { |
@@ -49,22 +50,23 @@ function doLeakTest(src, tolerance) { |
loadSourceIntoIframe('about:blank', function() { |
// blank document loaded... |
- var countersBefore = getCounterValues(); |
- |
- loadSourceIntoIframe(src, function() { |
- // target document loaded... |
- |
- loadSourceIntoIframe('about:blank', function() { |
- // target document unloaded... |
- |
- // Measure counter values on next timer event. This is needed |
- // to correctly handle deref cycles for some ActiveDOMObjects |
- // such as XMLHttpRequest. |
- setTimeout(function() { |
- var countersAfter = getCounterValues(); |
- compareValues(countersBefore, countersAfter, tolerance); |
- finishJSTest(); |
- }, 0); |
+ getCounterValues(function(countersBefore) { |
+ loadSourceIntoIframe(src, function() { |
+ // target document loaded... |
+ |
+ loadSourceIntoIframe('about:blank', function() { |
+ // target document unloaded... |
+ |
+ // Measure counter values on next timer event. This is needed |
+ // to correctly handle deref cycles for some ActiveDOMObjects |
+ // such as XMLHttpRequest. |
+ setTimeout(function() { |
+ getCounterValues(function(countersAfter) { |
+ compareValues(countersBefore, countersAfter, tolerance); |
+ finishJSTest(); |
+ }); |
+ }, 0); |
+ }); |
}); |
}); |
}); |