forked from mirrors/gecko-dev
This is split from the previous changeset since if we include dom/ the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27457 --HG-- extra : moz-landing-system : lando
76 lines
2 KiB
HTML
76 lines
2 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 src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
<script type="text/javascript">
|
|
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();
|
|
}
|
|
</script>
|
|
<script type="text/javascript" src="helpers.js"></script>
|
|
|
|
</head>
|
|
|
|
<body onload="runTest();"></body>
|
|
|
|
</html>
|