Commit 915d7a66 authored by Myung-jong Kim's avatar Myung-jong Kim Committed by Commit Bot

Remove redundant gc from LayoutTests

Bug: 706285
Change-Id: I19af8517f4cc561a30afb25ca3b3150a8dd41b12
Reviewed-on: https://chromium-review.googlesource.com/805515Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521371}
parent b318cc7d
function gc()
{
if (window.GCController)
return GCController.collectAll();
for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
var s = new String("");
}
}
function removeScriptElement() { function removeScriptElement() {
var s = document.getElementById('theScript'); var s = document.getElementById('theScript');
s.parentNode.removeChild(s); s.parentNode.removeChild(s);
......
<body> <body>
<p>Test that adding an event listener for an event with a unique name works correctly (this used to corrupt event listener map after GC).</p> <p>Test that adding an event listener for an event with a unique name works correctly (this used to corrupt event listener map after GC).</p>
<pre id=log></pre> <pre id=log></pre>
<script src="../../resources/gc.js"></script>
<script> <script>
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");
}
}
function log(message) function log(message)
{ {
document.getElementById("log").innerHTML += message + "<br>"; document.getElementById("log").innerHTML += message + "<br>";
......
<html> <html>
<head> <head>
<script src="../../resources/gc.js"></script>
<script> <script>
function sendXHR() function sendXHR()
{ {
...@@ -43,18 +44,6 @@ function test() ...@@ -43,18 +44,6 @@ function test()
} }
} }
function GC()
{
// Force GC.
if (window.GCController)
GCController.collect();
else {
for (var i = 0; i < 10000; ++i) {
({ });
}
}
}
/* GLOBALS */ /* GLOBALS */
var XHR = new Array(); var XHR = new Array();
var numXHRs = 0; var numXHRs = 0;
...@@ -67,7 +56,7 @@ var run = 0; ...@@ -67,7 +56,7 @@ var run = 0;
<div id="replaceMe"> <div id="replaceMe">
<div> <div>
<select id="theSelect" onblur="sendXHR();GC();"> <select id="theSelect" onblur="sendXHR();gc();">
</select> </select>
</div> </div>
......
...@@ -2,15 +2,6 @@ description( ...@@ -2,15 +2,6 @@ description(
"Tests that an event handler registered on two nodes still fires after one of the nodes has been GC'd." "Tests that an event handler registered on two nodes still fires after one of the nodes has been GC'd."
); );
function gc() {
if (window.GCController)
GCController.collect();
else {
for (var i = 0; i < 10000; ++i)
new Object;
}
}
var clickCount = 0; var clickCount = 0;
function clickHandler() { function clickHandler() {
++clickCount; ++clickCount;
......
...@@ -281,22 +281,6 @@ function shouldThrowType(_a, _e) ...@@ -281,22 +281,6 @@ function shouldThrowType(_a, _e)
testFailed(_a + " should throw an instance of " + _e.name); testFailed(_a + " should throw an instance of " + _e.name);
} }
function gc() {
if (typeof GCController !== "undefined")
GCController.collect();
else {
function gcRec(n) {
if (n < 1)
return {};
var temp = {i: "ab" + i + (i / 100000)};
temp += "foo";
gcRec(n-1);
}
for (var i = 0; i < 1000; i++)
gcRec(10)
}
}
// It's possible for an async test to call finishJSTest() before moz-test-post.js // It's possible for an async test to call finishJSTest() before moz-test-post.js
// has been parsed. // has been parsed.
function finishJSTest() function finishJSTest()
......
...@@ -2,15 +2,6 @@ description( ...@@ -2,15 +2,6 @@ description(
'Tests to make sure we do not gc the constants contained by functions defined inside eval code. To pass we need to not crash.' 'Tests to make sure we do not gc the constants contained by functions defined inside eval code. To pass we need to not crash.'
); );
function gc()
{
if (this.GCController)
GCController.collect();
else
for (var i = 0; i < 10000; ++i) // Allocate a sufficient number of objects to force a GC.
({});
}
evalStringTest = "'test'"; evalStringTest = "'test'";
evalString = "function f() { shouldBe(\"'test'\", evalStringTest) }; f()"; evalString = "function f() { shouldBe(\"'test'\", evalStringTest) }; f()";
function doTest() { function doTest() {
......
...@@ -2,15 +2,6 @@ description( ...@@ -2,15 +2,6 @@ description(
'Tests to make sure that dynamic scope objects are correctly protected from GC. To pass we need to not crash.' 'Tests to make sure that dynamic scope objects are correctly protected from GC. To pass we need to not crash.'
); );
function gc()
{
if (this.GCController)
GCController.collectAll();
else
for (var i = 0; i < 10000; ++i) // Allocate a sufficient number of objects to force a GC.
({});
}
(function() { (function() {
try { try {
// Immediate value for scope // Immediate value for scope
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<html> <html>
<title>Worklet: Worklet should report context destroyed</title> <title>Worklet: Worklet should report context destroyed</title>
<body> <body>
<script src="../../../resources/gc.js"></script>
<script> <script>
// This test was added for confirming a crash bug fix (see // This test was added for confirming a crash bug fix (see
// https://crbug.com/657450). This should not be upstreamed to WPT because of // https://crbug.com/657450). This should not be upstreamed to WPT because of
...@@ -12,16 +13,6 @@ if (window.testRunner) { ...@@ -12,16 +13,6 @@ if (window.testRunner) {
testRunner.dumpAsText(); testRunner.dumpAsText();
} }
function gc()
{
if (window.GCController) {
GCController.collect();
} else {
for (var i = 0; i < 10000; ++i)
new Object;
}
}
function tryCrash() function tryCrash()
{ {
document.frame.CSS.paintWorklet; document.frame.CSS.paintWorklet;
......
<html> <html>
<head> <head>
<script src="../../resources/gc.js"></script>
<script src="resources/database-common.js"></script> <script src="resources/database-common.js"></script>
<script src="multiple-databases-garbage-collection.js"></script> <script src="multiple-databases-garbage-collection.js"></script>
<body onload="setupAndRunTest();"> <body onload="setupAndRunTest();">
......
function GC()
{
// Force GC.
if (window.GCController)
GCController.collectAll();
else {
for (var i = 0; i < 10000; ++i) {
({ });
}
}
}
// Variable for the database that will never be forgotten // Variable for the database that will never be forgotten
var persistentDB = 0; var persistentDB = 0;
// Variable for the forgotten database // Variable for the forgotten database
...@@ -32,12 +20,12 @@ function runTest() ...@@ -32,12 +20,12 @@ function runTest()
}, function(err) { }, function(err) {
log("Forgotten Database Transaction Errored - " + err); log("Forgotten Database Transaction Errored - " + err);
forgottenDB = 0; forgottenDB = 0;
GC(); gc();
checkCompletion(); checkCompletion();
}, function() { }, function() {
log("Forgotten Database Transaction Complete"); log("Forgotten Database Transaction Complete");
forgottenDB = 0; forgottenDB = 0;
GC(); gc();
checkCompletion(); checkCompletion();
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment