Index: LayoutTests/fast/workers/worker-supplement-gc.html |
diff --git a/LayoutTests/fast/workers/worker-supplement-gc.html b/LayoutTests/fast/workers/worker-supplement-gc.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ea5cebef70b8a437cfdccfd0c7d4339623bfdfd4 |
--- /dev/null |
+++ b/LayoutTests/fast/workers/worker-supplement-gc.html |
@@ -0,0 +1,38 @@ |
+<!DOCTYPE HTML> |
+<script src="../../resources/js-test.js"></script> |
+<script src="resources/worker-create-common.js"></script> |
+<script> |
+description("Test GCing of WorkerGlobalScope supplementable"); |
+window.jsTestIsAsync = true; |
+if (window.testRunner) { |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
+} |
+function gc() |
+{ |
+ if (window.GCController) |
+ return GCController.collect(); |
+ |
+ for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect) |
+ var s = new String("abc"); |
+ } |
+} |
+ |
+// Test that garbage collection of 'supplements' that extend the |
+// WorkerGlobalScope object is well behaved. |
+var worker = createWorker(); |
+var count = 0; |
+ |
+function ping() |
+{ |
+ worker.postMessage("eval gc(); self.performance && self.performance.now()"); |
+} |
+worker.onmessage = function (e) { |
+ if (count++ > 4) |
+ finishJSTest(); |
+ else |
+ ping(); |
+ gc(); |
+} |
+ping(); |
+</script> |