Bug 1170746 - Getting mutable files over a cursor crashes the browser; r=bent

This commit is contained in:
Jan Varga 2015-06-10 22:48:06 +02:00
parent dccd0184dd
commit e9f7834cd4
3 changed files with 81 additions and 0 deletions

View File

@ -2518,6 +2518,7 @@ BackgroundCursorChild::HandleResponse(
auto& response = const_cast<ObjectStoreCursorResponse&>(aResponse);
StructuredCloneReadInfo cloneReadInfo(Move(response.cloneInfo()));
cloneReadInfo.mDatabase = mTransaction->Database();
ConvertActorsToBlobs(mTransaction->Database(),
response.cloneInfo(),
@ -2579,6 +2580,7 @@ BackgroundCursorChild::HandleResponse(const IndexCursorResponse& aResponse)
auto& response = const_cast<IndexCursorResponse&>(aResponse);
StructuredCloneReadInfo cloneReadInfo(Move(response.cloneInfo()));
cloneReadInfo.mDatabase = mTransaction->Database();
ConvertActorsToBlobs(mTransaction->Database(),
aResponse.cloneInfo(),

View File

@ -195,6 +195,8 @@ skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s
skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s
[test_filehandle_getFile.html]
# FileHandle is not supported in child processes.
[test_filehandle_iteration.html]
# FileHandle is not supported in child processes.
skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s
[test_filehandle_lifetimes.html]
# FileHandle is not supported in child processes.

View File

@ -0,0 +1,77 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Indexed Database Property Test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript;version=1.7">
function testSteps()
{
const dbName = window.location.pathname;
const dbVersion = 1;
const objectStoreName = "foo";
const entryCount = 10;
let request = indexedDB.open(dbName, dbVersion);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;
let event = yield undefined;
is(event.type, "upgradeneeded", "Got correct event type");
let db = event.target.result;
db.onerror = errorHandler;
db.createObjectStore(objectStoreName, { autoIncrement: true });
request.onupgradeneeded = unexpectedSuccessHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.type, "success", "Got correct event type");
request = db.createMutableFile("bar");
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
let mutableFile = event.target.result;
let trans = db.transaction(objectStoreName, "readwrite");
let objectStore = trans.objectStore(objectStoreName);
for (let i = 0; i < entryCount; i++) {
request = objectStore.add(mutableFile);
}
let seenEntryCount = 0;
request = objectStore.openCursor().onsuccess = event => {
let cursor = event.target.result;
if (cursor) {
seenEntryCount++;
cursor.continue();
} else {
continueToNextStep();
}
}
yield undefined;
is(seenEntryCount, entryCount, "Correct entry count");
finishTest();
yield undefined;
}
</script>
<script type="text/javascript;version=1.7" src="helpers.js"></script>
</head>
<body onload="runTest();"></body>
</html>