indexeddbshim 19.0.6 → 19.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /*! indexeddbshim - v19.0.6 - 9/22/2026 */
1
+ /*! indexeddbshim - v19.0.7 - 9/23/2026 */
2
2
 
3
3
  (function (factory) {
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -4085,6 +4085,33 @@
4085
4085
  return convertValueToKeyValueDecoded(input, null, true, true);
4086
4086
  }
4087
4087
 
4088
+ /**
4089
+ * @param {BufferSource|ArrayBufferLike} buffer
4090
+ * @returns {boolean}
4091
+ */
4092
+ function isBufferDetached(buffer) {
4093
+ // Use the standard property if available
4094
+ // @ts-expect-error - More recent API
4095
+ if (typeof buffer.detached === 'boolean') {
4096
+ // @ts-expect-error - More recent API
4097
+ return buffer.detached;
4098
+ }
4099
+ /* c8 ignore next 14 -- Older browsers */
4100
+
4101
+ // Fallback check via byteLength and constructor test
4102
+ if (buffer.byteLength !== 0) {
4103
+ return false;
4104
+ }
4105
+ try {
4106
+ // @ts-expect-error Ok
4107
+ // eslint-disable-next-line no-new -- Throwaway
4108
+ new Uint8Array(buffer);
4109
+ return false;
4110
+ } catch (_unused) {
4111
+ return true;
4112
+ }
4113
+ }
4114
+
4088
4115
  /**
4089
4116
  *
4090
4117
  * @param {BufferSource} O
@@ -4097,15 +4124,16 @@
4097
4124
  var length;
4098
4125
  if (ArrayBuffer.isView(O)) {
4099
4126
  // Has [[ViewedArrayBuffer]] internal slot
4100
- var arrayBuffer = O.buffer;
4101
- if (arrayBuffer === undefined) {
4102
- throw new TypeError('Could not copy the bytes held by a buffer source as the buffer was undefined.');
4103
- }
4104
4127
  offset = O.byteOffset; // [[ByteOffset]] (will also throw as desired if detached)
4105
4128
  length = O.byteLength; // [[ByteLength]] (will also throw as desired if detached)
4106
4129
  } else {
4107
4130
  length = O.byteLength; // [[ArrayBufferByteLength]] on ArrayBuffer (will also throw as desired if detached)
4108
4131
  }
4132
+ var arrayBuffer = ArrayBuffer.isView(O) ? O.buffer : O;
4133
+ if (isBufferDetached(arrayBuffer)) {
4134
+ throw new TypeError('Could not copy the bytes held by a buffer source as the buffer was detached.');
4135
+ }
4136
+
4109
4137
  // const octets = new Uint8Array(input);
4110
4138
  // const octets = types.binary.decode(types.binary.encode(input));
4111
4139
  return new Uint8Array(
@@ -4177,7 +4205,7 @@
4177
4205
  var octets;
4178
4206
  try {
4179
4207
  octets = getCopyBytesHeldByBufferSource(/** @type {BufferSource} */input);
4180
- } catch (_unused) {
4208
+ } catch (_unused2) {
4181
4209
  return {
4182
4210
  type: type,
4183
4211
  invalid: true,