Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"median": "0.0.2",
"mocha": "10.8.2",
"ncp": "2.0.0",
"playwright": "1.49.1",
"playwright": "1.57.0",
"pouchdb-express-router": "0.0.11",
"replace": "1.2.1",
"rimraf": "2.7.1",
Expand Down
17 changes: 11 additions & 6 deletions packages/node_modules/pouchdb-adapter-idb/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,16 +712,21 @@ function init(api, opts, callback) {
cachedDBs.delete(dbName);
};

// First, check blob support. If this is attempted within a shared
// transaction, then on some browsers failure in the blob support
// check may break other requests made in the same transaction.
var blobSupportTx = idb.transaction([
DETECT_BLOB_SUPPORT_STORE,
], 'readwrite');

// Do a few setup operations (in parallel as much as possible):
// 1. Fetch meta doc
// 2. Check blob support
// 3. Calculate docCount
// 4. Generate an instanceId if necessary
// 5. Store docCount and instanceId on meta doc
// 2. Calculate docCount
// 3. Generate an instanceId if necessary
// 4. Store docCount and instanceId on meta doc

var txn = idb.transaction([
META_STORE,
DETECT_BLOB_SUPPORT_STORE,
DOC_STORE
], 'readwrite');

Expand Down Expand Up @@ -783,7 +788,7 @@ function init(api, opts, callback) {
//
if (!blobSupportPromise) {
// make sure blob support is only checked once
blobSupportPromise = checkBlobSupport(txn, DETECT_BLOB_SUPPORT_STORE, 'key');
blobSupportPromise = checkBlobSupport(blobSupportTx, DETECT_BLOB_SUPPORT_STORE, 'key');
}

blobSupportPromise.then(function (val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,22 @@ function checkBlobSupport(txn, store, docIdOrCreateDoc) {
parseInt(matchedChrome[1], 10) >= 43);
};

req.onerror = txn.onabort = function (e) {
// If the transaction aborts now its due to not being able to
// write to the database, likely due to the disk being full
txn.onabort = function (e) {
// Historically, if the transaction aborts now its due to not being
// able to write to the database, likely due to the disk being full.
//
// It can also abort due to a change in behaviour on:
//
// * WebKitGTK 2.51.0 (Playwright 1.56.1/webkit-2215)
// * WebKitGTK 2.51.1 (Playwright 1.57.0/webkit-2227)
e.preventDefault();
e.stopPropagation();
resolve(false);
};

req.onerror = function () {
resolve(false);
};
}).catch(function () {
return false; // error, so assume unsupported
});
Expand Down
Loading