mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 15:57:31 +09:00
Issue #1693 - Use scoped enums for IDBTransaction.
Based on a patch from Mozilla bug 1598164. Needed due to identifier collision between NSS and IDBTransaction. Co-authored by: Simon Giesecke <simon.giesecke@gmail.com> Co-authored by: Matt A. Tobin <email@mattatobin.com>
This commit is contained in:
parent
89dd425fd2
commit
c920f32df3
25 changed files with 175 additions and 182 deletions
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const databaseInfo = [
|
||||
{ name: window.location.pathname + "1" },
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
for (let i = 1; i < databases.length; i++) {
|
||||
let db = databases[i];
|
||||
|
||||
let objectStore = db.transaction([objectStoreName], READ_WRITE)
|
||||
let objectStore = db.transaction([objectStoreName], Mode::ReadWrite)
|
||||
.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.add(refResult, 2);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const name = window.location.pathname;
|
||||
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
is(event.type, "success", "Got correct event type");
|
||||
|
||||
let trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
let trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
trans.objectStore(objectStoreName).delete(fileData1.key);
|
||||
trans.oncomplete = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
|
@ -80,7 +80,7 @@
|
|||
let db = event.target.result;
|
||||
db.onerror = errorHandler;
|
||||
|
||||
trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.get(fileData2.key);
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
is(getFileDBRefCount(name, 2), 0, "Correct db ref count");
|
||||
|
||||
|
||||
trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
objectStore.delete(fileData3.key);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const name = window.location.pathname;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
is(usage, startUsage + fileData1.obj.file.size + fileData2.obj.file.size,
|
||||
"Correct file usage");
|
||||
|
||||
let trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
let trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
trans.objectStore(objectStoreName).delete(fileData1.key);
|
||||
trans.oncomplete = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const databaseInfo = [
|
||||
{ name: window.location.pathname + "1", source: true },
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
for (let i = 1; i < databases.length; i++) {
|
||||
let db = databases[i];
|
||||
|
||||
let trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
let trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
let objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.add(fileBackedFile, 2);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const name = window.location.pathname;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const name = window.location.pathname;
|
||||
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
is(event.type, "success", "Got correct event type");
|
||||
|
||||
let objectStore = db.transaction([objectStoreName], READ_WRITE)
|
||||
let objectStore = db.transaction([objectStoreName], Mode::ReadWrite)
|
||||
.objectStore(objectStoreName);
|
||||
request = objectStore.add(blobData.blob, blobData.key);
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
verifyBlob(event.target.result, blobData.blob, 1);
|
||||
yield undefined;
|
||||
|
||||
objectStore = db.transaction([objectStoreName], READ_WRITE)
|
||||
objectStore = db.transaction([objectStoreName], Mode::ReadWrite)
|
||||
.objectStore(objectStoreName);
|
||||
request = objectStore.add(fileData.file, fileData.key);
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const name = window.location.pathname;
|
||||
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
is(event.type, "success", "Got correct event type");
|
||||
|
||||
let trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
let trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
objectStore.delete(fileData.key);
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
is(getFileDBRefCount(name, 1), 0, "Correct db ref count");
|
||||
|
||||
trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.add(fileData.file, fileData.key);
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
let db = event.target.result;
|
||||
db.onerror = errorHandler;
|
||||
|
||||
let trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
let trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.get(fileData.key);
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
|
||||
is(getFileDBRefCount(name, 1), 0, "Correct db ref count");
|
||||
|
||||
trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.add(result, fileData.key);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const name = window.location.pathname;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
is(event.type, "success", "Got correct event type");
|
||||
|
||||
let trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
let trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.add(fileData.file, fileData.key);
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
is(getFileDBRefCount(name, 1), 0, "Correct db ref count");
|
||||
|
||||
trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.add(result, fileData.key);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const name = window.location.pathname;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
for (let i = 1; i < objectStoreInfo.length; i++) {
|
||||
let info = objectStoreInfo[i];
|
||||
|
||||
let objectStore = db.transaction([info.name], READ_WRITE)
|
||||
let objectStore = db.transaction([info.name], Mode::ReadWrite)
|
||||
.objectStore(info.name);
|
||||
|
||||
request = objectStore.add(refResult, 2);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const name = window.location.pathname;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
is(event.type, "success", "Got correct event type");
|
||||
|
||||
let trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
let trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.add(fileData.file, fileData.key);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const databaseInfo = [
|
||||
{ name: window.location.pathname + "1" },
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
is(mutableFile.name, "random.bin", "Correct name");
|
||||
is(mutableFile.type, "binary/random", "Correct type");
|
||||
|
||||
let trans = db1.transaction([objectStoreName], READ_WRITE);
|
||||
let trans = db1.transaction([objectStoreName], Mode::ReadWrite);
|
||||
let objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.add(mutableFile, 42);
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
let db2 = databases[1];
|
||||
|
||||
trans = db2.transaction([objectStoreName], READ_WRITE);
|
||||
trans = db2.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript;version=1.7">
|
||||
function testSteps()
|
||||
{
|
||||
const READ_WRITE = "readwrite";
|
||||
const Mode::ReadWrite = "readwrite";
|
||||
|
||||
const name = window.location.pathname;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
let file = event.target.result;
|
||||
|
||||
let trans = db.transaction([objectStoreName], READ_WRITE);
|
||||
let trans = db.transaction([objectStoreName], Mode::ReadWrite);
|
||||
objectStore = trans.objectStore(objectStoreName);
|
||||
|
||||
request = objectStore.add(file, 42);
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ function testSteps()
|
|||
|
||||
try {
|
||||
db.transaction("foo").objectStore("foo").clear();
|
||||
ok(false, "clear should throw on READ_ONLY transactions");
|
||||
ok(false, "clear should throw on Mode::ReadOnly transactions");
|
||||
}
|
||||
catch (e) {
|
||||
ok(true, "clear should throw on READ_ONLY transactions");
|
||||
ok(true, "clear should throw on Mode::ReadOnly transactions");
|
||||
}
|
||||
|
||||
request = db.transaction("foo", "readwriteflush")
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function testSteps()
|
|||
is(db.version, 1, "Database has correct version");
|
||||
|
||||
db.onupgradeneeded = function() {
|
||||
ok(false, "our ongoing VERSION_CHANGE transaction should exclude any others!");
|
||||
ok(false, "our ongoing Mode::VersionChange transaction should exclude any others!");
|
||||
}
|
||||
|
||||
db.createObjectStore("foo");
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ function testSteps()
|
|||
abortEventCount = 0;
|
||||
let expectedAbortEventCount = 0;
|
||||
|
||||
// During INITIAL
|
||||
// During ReadyState::Initial
|
||||
transaction = db.transaction("foo");
|
||||
transaction.abort();
|
||||
try {
|
||||
|
|
@ -269,7 +269,7 @@ function testSteps()
|
|||
ok(true, "second abort should throw an error");
|
||||
}
|
||||
|
||||
// During LOADING
|
||||
// During ReadyState::Loading
|
||||
transaction = db.transaction("foo");
|
||||
transaction.objectStore("foo").get(1).onerror = abortErrorHandler;
|
||||
expectedAbortEventCount++;
|
||||
|
|
@ -282,7 +282,7 @@ function testSteps()
|
|||
ok(true, "second abort should throw an error");
|
||||
}
|
||||
|
||||
// During LOADING from callback
|
||||
// During ReadyState::Loading from callback
|
||||
transaction = db.transaction("foo");
|
||||
transaction.objectStore("foo").get(1).onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
|
@ -297,7 +297,7 @@ function testSteps()
|
|||
ok(true, "second abort should throw an error");
|
||||
}
|
||||
|
||||
// During LOADING from error callback
|
||||
// During ReadyState::Loading from error callback
|
||||
transaction = db.transaction("foo", "readwrite");
|
||||
transaction.objectStore("foo").add({}, 1).onerror = function(event) {
|
||||
event.preventDefault();
|
||||
|
|
@ -327,7 +327,7 @@ function testSteps()
|
|||
};
|
||||
yield undefined;
|
||||
|
||||
// During COMMITTING
|
||||
// During ReadyState::Committing
|
||||
transaction = db.transaction("foo", "readwrite");
|
||||
transaction.objectStore("foo").put({hello: "world"}, 1).onsuccess = function(event) {
|
||||
continueToNextStep();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue