зеркало из https://github.com/mozilla/gecko-dev.git
Bug 945813 - Paper over cycle collection problem in IndexedDB. r=mccr8, r=khuey
This commit is contained in:
Родитель
aef4e1d147
Коммит
5d9420d02c
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var testGenerator = testSteps();
|
||||
|
||||
function testSteps()
|
||||
{
|
||||
const Bob = { ss: "237-23-7732", name: "Bob" };
|
||||
|
||||
let request = indexedDB.open(this.window ? window.location.pathname : "Splendid Test", 1);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
let event = yield undefined;
|
||||
|
||||
let db = event.target.result;
|
||||
event.target.onsuccess = continueToNextStep;
|
||||
|
||||
let objectStore = db.createObjectStore("foo", { keyPath: "ss" });
|
||||
objectStore.createIndex("name", "name", { unique: true });
|
||||
objectStore.add(Bob);
|
||||
yield undefined;
|
||||
|
||||
// This direct eval causes locals to be aliased, and thus allocated on
|
||||
// the scope chain. Comment it out (and the workarounds below) and
|
||||
// the test passes. Bug 943409.
|
||||
eval('');
|
||||
|
||||
db.transaction("foo", "readwrite").objectStore("foo")
|
||||
.index("name").openCursor().onsuccess = function(event) {
|
||||
event.target.transaction.oncomplete = continueToNextStep;
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
let objectStore = event.target.transaction.objectStore("foo");
|
||||
objectStore.delete(Bob.ss)
|
||||
.onsuccess = function(event) { cursor.continue(); };
|
||||
}
|
||||
};
|
||||
yield undefined;
|
||||
finishTest();
|
||||
|
||||
objectStore = null; // Bug 943409 workaround.
|
||||
|
||||
yield undefined;
|
||||
}
|
|
@ -35,6 +35,11 @@ function testSteps()
|
|||
let objectStore = db.createObjectStore("foo", { keyPath: "ss" });
|
||||
objectStore.createIndex("name", "name", { unique: true });
|
||||
|
||||
// This direct eval causes locals to be aliased, and thus allocated on
|
||||
// the scope chain. Comment it out (and the workarounds below) and
|
||||
// the test passes. Bug 943409.
|
||||
eval('');
|
||||
|
||||
for (let i = 0; i < objectStoreData.length - 1; i++) {
|
||||
objectStore.add(objectStoreData[i]);
|
||||
}
|
||||
|
@ -111,5 +116,8 @@ function testSteps()
|
|||
is(sawRemoved, false, "Didn't see item that was removed");
|
||||
|
||||
finishTest();
|
||||
|
||||
objectStore = null; // Bug 943409 workaround.
|
||||
|
||||
yield undefined;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ function testSteps()
|
|||
|
||||
event.target.onsuccess = continueToNextStep;
|
||||
|
||||
// Bug 943409.
|
||||
eval('');
|
||||
|
||||
for (let objectStoreIndex in objectStoreData) {
|
||||
const objectStoreInfo = objectStoreData[objectStoreIndex];
|
||||
let objectStore = db.createObjectStore(objectStoreInfo.name,
|
||||
|
@ -137,6 +140,8 @@ function testSteps()
|
|||
.objectStore(objectStoreName).clear()
|
||||
.onsuccess = continueToNextStep;
|
||||
yield undefined;
|
||||
|
||||
objectStore = index = null; // Bug 943409 workaround.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ function testSteps()
|
|||
let db = event.target.result;
|
||||
db.onerror = errorHandler;
|
||||
|
||||
// Bug 943409.
|
||||
eval('');
|
||||
|
||||
for each (let autoIncrement in [false, true]) {
|
||||
let objectStore =
|
||||
db.createObjectStore(autoIncrement, { keyPath: "id",
|
||||
|
@ -159,9 +162,13 @@ function testSteps()
|
|||
|
||||
is(event.target.result, indexCount,
|
||||
"Correct number of entries in index");
|
||||
|
||||
index = event = null; // Bug 943409 workaround.
|
||||
}
|
||||
objectStore = event = null; // Bug 943409 workaround.
|
||||
}
|
||||
|
||||
finishTest();
|
||||
event = db = request = null; // Bug 943409 workaround.
|
||||
yield undefined;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ support-files =
|
|||
[test_create_index.js]
|
||||
[test_create_index_with_integer_keys.js]
|
||||
[test_create_objectStore.js]
|
||||
[test_cursor_cycle.js]
|
||||
[test_cursor_mutation.js]
|
||||
[test_cursor_update_updates_indexes.js]
|
||||
[test_cursors.js]
|
||||
|
|
|
@ -2723,8 +2723,8 @@ void
|
|||
nsCycleCollector::ShutdownCollect()
|
||||
{
|
||||
SliceBudget unlimitedBudget;
|
||||
for (uint32_t i = 0; i < DEFAULT_SHUTDOWN_COLLECTIONS; ++i) {
|
||||
NS_ASSERTION(i < NORMAL_SHUTDOWN_COLLECTIONS, "Extra shutdown CC");
|
||||
uint32_t i;
|
||||
for (i = 0; i < DEFAULT_SHUTDOWN_COLLECTIONS; ++i) {
|
||||
if (!Collect(ShutdownCC, unlimitedBudget, nullptr)) {
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче