Index: LayoutTests/resources/js-test.js |
diff --git a/LayoutTests/resources/js-test.js b/LayoutTests/resources/js-test.js |
index 791b728108f45d6ac91bd9866ee353671718505a..47387d0ce562c32034d2118fbd7e58516b24cc53 100644 |
--- a/LayoutTests/resources/js-test.js |
+++ b/LayoutTests/resources/js-test.js |
@@ -649,6 +649,26 @@ function shouldHaveHadError(message) |
testFailed("expectError() not called before shouldHaveHadError()"); |
} |
+// With Oilpan tests that rely on garbage collection need to go through |
+// the event loop in order to get precise garbage collections. Oilpan |
+// uses conservative stack scanning when not at the event loop and that |
+// can artificially keep objects alive. Therfore, test that need to check |
wibling-chromium
2014/04/01 13:26:09
NIT: Therfore -> Therefore
test -> tests
Mads Ager (chromium)
2014/04/01 13:45:38
Done.
|
+// that something is dead need to use this asynchronous collectGarbage |
+// function. |
+function collectGarbage(callback) { |
+ GCController.collect(); |
wibling-chromium
2014/04/01 13:26:09
Consider adding a comment explaining why we do sev
Mads Ager (chromium)
2014/04/01 13:45:38
Yes, done.
|
+ setTimeout(function() { |
+ GCController.collect(); |
+ setTimeout(function() { |
+ GCController.collect(); |
+ setTimeout(function() { |
+ GCController.collect(); |
+ setTimeout(callback, 0); |
+ }, 0); |
+ }, 0); |
+ }, 0); |
+} |
+ |
function gc() { |
if (typeof GCController !== "undefined") |
GCController.collectAll(); |