diff --git a/package-lock.json b/package-lock.json index e4f6372af8..513a6ee01f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,7 +52,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", @@ -6996,13 +6996,13 @@ } }, "node_modules/playwright": { - "version": "1.49.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.1.tgz", - "integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.57.0.tgz", + "integrity": "sha512-ilYQj1s8sr2ppEJ2YVadYBN0Mb3mdo9J0wQ+UuDhzYqURwSoW4n1Xs5vs7ORwgDGmyEh33tRMeS8KhdkMoLXQw==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.49.1" + "playwright-core": "1.57.0" }, "bin": { "playwright": "cli.js" @@ -7015,9 +7015,9 @@ } }, "node_modules/playwright-core": { - "version": "1.49.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.1.tgz", - "integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.57.0.tgz", + "integrity": "sha512-agTcKlMw/mjBWOnD6kFZttAAGHgi/Nw0CZ2o6JqWSbMlI219lAFLZZCyqByTsvVAJq5XA5H8cA6PrvBRpBWEuQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -7033,6 +7033,7 @@ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" diff --git a/package.json b/package.json index dcae304468..82fdd133a7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/node_modules/pouchdb-adapter-idb/src/index.js b/packages/node_modules/pouchdb-adapter-idb/src/index.js index 586ca50f03..46b7a313e4 100644 --- a/packages/node_modules/pouchdb-adapter-idb/src/index.js +++ b/packages/node_modules/pouchdb-adapter-idb/src/index.js @@ -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'); @@ -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) { diff --git a/packages/node_modules/pouchdb-adapter-utils/src/checkBlobSupport.js b/packages/node_modules/pouchdb-adapter-utils/src/checkBlobSupport.js index 233fd2877b..c97be4b3ee 100644 --- a/packages/node_modules/pouchdb-adapter-utils/src/checkBlobSupport.js +++ b/packages/node_modules/pouchdb-adapter-utils/src/checkBlobSupport.js @@ -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 });