mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
70 lines
1.9 KiB
HTML
70 lines
1.9 KiB
HTML
<!--
|
|
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 READ_WRITE = IDBTransaction.READ_WRITE;
|
|
const DEFAULT_QUOTA_MB = 50;
|
|
|
|
const name = window.location.pathname;
|
|
|
|
const objectStoreName = "Blobs";
|
|
|
|
const testData = { key: 0, value: {} };
|
|
const fileData = { key: 1, file: null };
|
|
|
|
let request = indexedDB.open(name, 1);
|
|
request.onerror = errorHandler;
|
|
request.onupgradeneeded = grabEventAndContinueHandler;
|
|
request.onsuccess = grabEventAndContinueHandler;
|
|
let event = yield;
|
|
|
|
is(event.type, "upgradeneeded", "Got correct event type");
|
|
|
|
let db = event.target.result;
|
|
|
|
let objectStore = db.createObjectStore(objectStoreName, { });
|
|
objectStore.add(testData.value, testData.key);
|
|
|
|
let size = (DEFAULT_QUOTA_MB + 1) * 1024 * 1024 - getUsageSync();
|
|
fileData.file = getNullFile("random.bin", size);
|
|
|
|
event = yield;
|
|
|
|
is(event.type, "success", "Got correct event type");
|
|
|
|
trans = db.transaction([objectStoreName], READ_WRITE);
|
|
objectStore = trans.objectStore(objectStoreName);
|
|
|
|
request = objectStore.add(fileData.file, fileData.key);
|
|
request.onerror = new ExpectError("UnknownError");
|
|
request.onsuccess = unexpectedSuccessHandler;
|
|
event = yield;
|
|
|
|
trans.oncomplete = grabEventAndContinueHandler;
|
|
event = yield;
|
|
|
|
is(event.type, "complete", "Got correct event type");
|
|
|
|
finishTest();
|
|
yield;
|
|
}
|
|
</script>
|
|
<script type="text/javascript;version=1.7" src="file.js"></script>
|
|
<script type="text/javascript;version=1.7" src="helpers.js"></script>
|
|
|
|
</head>
|
|
|
|
<body onload="runTest(true);"></body>
|
|
|
|
</html>
|