Commit 9cca324e authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[unified-heap] Fix indexdb liveness layout tests

Replace direct GC calls that expect objects to die with asyncGC calls
that are guaranteed to run without stack.

Bug: chromium:843903
Change-Id: Ie708567fae153d0f1a20109fe170025afdc1715b
Reviewed-on: https://chromium-review.googlesource.com/1238451Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593551}
parent 3883a348
...@@ -25,7 +25,6 @@ db = request.result ...@@ -25,7 +25,6 @@ db = request.result
db = null db = null
request = null request = null
Run GC outside of request's callback via setTimeout() Run GC outside of request's callback via setTimeout()
window.gc()
doThirdOpen(): doThirdOpen():
request = indexedDB.open(dbname, 2) request = indexedDB.open(dbname, 2)
......
...@@ -48,10 +48,9 @@ function doSecondOpen() ...@@ -48,10 +48,9 @@ function doSecondOpen()
evalAndLog("request = null"); evalAndLog("request = null");
debug("Run GC outside of request's callback via setTimeout()"); debug("Run GC outside of request's callback via setTimeout()");
setTimeout( function() { asyncGC(function () {
evalAndLog("window.gc()");
doThirdOpen(); doThirdOpen();
}, 0); });
}; };
} }
......
...@@ -49,10 +49,10 @@ function onOpen(evt) ...@@ -49,10 +49,10 @@ function onOpen(evt)
cursorRequest = null; cursorRequest = null;
cursor = null; cursor = null;
gc(); asyncGC(function () {
shouldBeTrue("cursorObserver.wasCollected");
shouldBeTrue("cursorObserver.wasCollected"); finishJSTest();
finishJSTest(); });
}; };
} }
......
...@@ -9,7 +9,6 @@ indexedDB.open(dbname) ...@@ -9,7 +9,6 @@ indexedDB.open(dbname)
db.close() db.close()
indexedDB.open(dbname) indexedDB.open(dbname)
Dropping references to new connection. Dropping references to new connection.
gc()
Open request should not receive a blocked event: Open request should not receive a blocked event:
indexedDB.open(dbname, 2) indexedDB.open(dbname, 2)
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -10,6 +10,15 @@ function prepareDatabase() ...@@ -10,6 +10,15 @@ function prepareDatabase()
{ {
} }
function setVersion()
{
debug("Open request should not receive a blocked event:");
var request = evalAndLog("indexedDB.open(dbname, 2)");
request.onerror = unexpectedErrorCallback;
request.onblocked = unexpectedBlockedCallback;
request.onsuccess = finishJSTest;
}
function openSuccess() function openSuccess()
{ {
db = event.target.result; db = event.target.result;
...@@ -23,16 +32,8 @@ function openSuccess() ...@@ -23,16 +32,8 @@ function openSuccess()
debug("Dropping references to new connection."); debug("Dropping references to new connection.");
// After leaving this function, there are no remaining references to the // After leaving this function, there are no remaining references to the
// db, so it should get deleted. // db, so it should get deleted.
setTimeout(setVersion, 2); setTimeout(function () {
asyncGC(setVersion);
}, 2);
}; };
} }
function setVersion()
{
evalAndLog("gc()");
debug("Open request should not receive a blocked event:");
var request = evalAndLog("indexedDB.open(dbname, 2)");
request.onerror = unexpectedErrorCallback;
request.onblocked = unexpectedBlockedCallback;
request.onsuccess = finishJSTest;
}
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