Skip to content
Merged
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
37 changes: 10 additions & 27 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 @@ -83,7 +83,7 @@
"median": "0.0.2",
"mocha": "10.8.2",
"ncp": "2.0.0",
"playwright": "1.49.1",
"playwright": "1.65.1",
"pouchdb-express-router": "0.0.11",
"prismjs": "1.30.0",
"replace": "1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/node_modules/pouchdb-adapter-idb/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,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(idb, null, DETECT_BLOB_SUPPORT_STORE, 'key');
}

blobSupportPromise.then(function (val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function openDatabase(openDatabases, api, opts, resolve, reject) {

const createBlobDoc = blob => ({ id:'blob-support', blob });

checkBlobSupport(txn, META_LOCAL_STORE, createBlobDoc).then(blobSupport => {
checkBlobSupport(null, txn, META_LOCAL_STORE, createBlobDoc).then(blobSupport => {
// Unfortunate that we have to track this in both the metadata and on
// api, but sometimes we have access to one, sometimes the other (and
// sometimes both). We could change function signatures in index.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { blob as createBlob } from 'pouchdb-binary-utils';

//
// Blobs are not supported in all versions of IndexedDB, notably
// Chrome <37, Android <5 and (some?) webkit-based browsers.
// In those versions, storing a blob will throw.
// Chrome <37, Android <5, (some?) webkit-based browsers, and some
// private contexts. In those versions, storing a blob will throw.
//
// Example Webkit error:
// > DataCloneError: Failed to store record in an IDBObjectStore: BlobURLs are not yet supported.
Expand All @@ -16,10 +16,16 @@ import { blob as createBlob } from 'pouchdb-binary-utils';
// 404 bug: https://code.google.com/p/chromium/issues/detail?id=447916
// FileReader bug: https://code.google.com/p/chromium/issues/detail?id=447836
//
function checkBlobSupport(txn, store, docIdOrCreateDoc) {
function checkBlobSupport(db, txn, store, docIdOrCreateDoc) {
return new Promise(function (resolve) {
var blob = createBlob(['']);

if (!txn) {
txn = db.transaction(store, 'readwrite');
txn.onerror = () => resolve(false);
txn.onabort = () => resolve(false);
}

let req;
if (typeof docIdOrCreateDoc === 'function') {
// Store may require a specific key path, in which case we can't store the
Expand Down
Loading