| Index: LayoutTests/resources/leak-check.js
|
| diff --git a/LayoutTests/resources/leak-check.js b/LayoutTests/resources/leak-check.js
|
| index da041f5f5103b8d36c310f9207fd2590a0a6bd7f..5e4f708dd1fb3761426aab8952cb024800c49262 100644
|
| --- a/LayoutTests/resources/leak-check.js
|
| +++ b/LayoutTests/resources/leak-check.js
|
| @@ -1,19 +1,31 @@
|
| // include resources/js-test.js before this file.
|
|
|
| -function doLeakTest(src, tolerance) {
|
| - function getCounterValues() {
|
| - testRunner.resetTestHelperControllers();
|
| - gc();
|
| +function getCounterValues() {
|
| + testRunner.resetTestHelperControllers();
|
| + gc();
|
| +
|
| + 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];
|
| + return ret;
|
| +}
|
|
|
| - return ret;
|
| +function compareValues(countersBefore, countersAfter, tolerance) {
|
| + for (type in tolerance) {
|
| + var before = countersBefore[type];
|
| + var after = countersAfter[type];
|
| +
|
| + if (after - before <= tolerance[type])
|
| + testPassed('The difference of counter "'+type+'" before and after the cycle is under the threshold of '+tolerance[type]+'.');
|
| + else
|
| + testFailed('counter "'+type+'" was '+before+' before and now '+after+' after the cycle. This exceeds the threshold of '+tolerance[type]+'.');
|
| }
|
| +}
|
|
|
| +function doLeakTest(src, tolerance) {
|
| var frame = document.createElement('iframe');
|
| document.body.appendChild(frame);
|
| function loadSourceIntoIframe(src, callback) {
|
| @@ -29,18 +41,6 @@ function doLeakTest(src, tolerance) {
|
| frame.src = src;
|
| }
|
|
|
| - function compareValues(countersBefore, countersAfter, tolerance) {
|
| - for (type in tolerance) {
|
| - var before = countersBefore[type];
|
| - var after = countersAfter[type];
|
| -
|
| - if (after - before <= tolerance[type])
|
| - testPassed('The difference of counter "'+type+'" before and after the cycle is under the threshold of '+tolerance[type]+'.');
|
| - else
|
| - testFailed('counter "'+type+'" was '+before+' before and now '+after+' after the cycle. This exceeds the threshold of '+tolerance[type]+'.');
|
| - }
|
| - }
|
| -
|
| jsTestIsAsync = true;
|
| if (!window.internals) {
|
| debug("This test only runs on DumpRenderTree, as it requires existence of window.internals and cross-domain resource access check disabled.");
|
|
|