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) :
@@ -4072,6 +4072,33 @@
4072
4072
  return convertValueToKeyValueDecoded(input, null, true, true);
4073
4073
  }
4074
4074
 
4075
+ /**
4076
+ * @param {BufferSource|ArrayBufferLike} buffer
4077
+ * @returns {boolean}
4078
+ */
4079
+ function isBufferDetached(buffer) {
4080
+ // Use the standard property if available
4081
+ // @ts-expect-error - More recent API
4082
+ if (typeof buffer.detached === 'boolean') {
4083
+ // @ts-expect-error - More recent API
4084
+ return buffer.detached;
4085
+ }
4086
+ /* c8 ignore next 14 -- Older browsers */
4087
+
4088
+ // Fallback check via byteLength and constructor test
4089
+ if (buffer.byteLength !== 0) {
4090
+ return false;
4091
+ }
4092
+ try {
4093
+ // @ts-expect-error Ok
4094
+ // eslint-disable-next-line no-new -- Throwaway
4095
+ new Uint8Array(buffer);
4096
+ return false;
4097
+ } catch (_unused) {
4098
+ return true;
4099
+ }
4100
+ }
4101
+
4075
4102
  /**
4076
4103
  *
4077
4104
  * @param {BufferSource} O
@@ -4084,15 +4111,16 @@
4084
4111
  var length;
4085
4112
  if (ArrayBuffer.isView(O)) {
4086
4113
  // Has [[ViewedArrayBuffer]] internal slot
4087
- var arrayBuffer = O.buffer;
4088
- if (arrayBuffer === undefined) {
4089
- throw new TypeError('Could not copy the bytes held by a buffer source as the buffer was undefined.');
4090
- }
4091
4114
  offset = O.byteOffset; // [[ByteOffset]] (will also throw as desired if detached)
4092
4115
  length = O.byteLength; // [[ByteLength]] (will also throw as desired if detached)
4093
4116
  } else {
4094
4117
  length = O.byteLength; // [[ArrayBufferByteLength]] on ArrayBuffer (will also throw as desired if detached)
4095
4118
  }
4119
+ var arrayBuffer = ArrayBuffer.isView(O) ? O.buffer : O;
4120
+ if (isBufferDetached(arrayBuffer)) {
4121
+ throw new TypeError('Could not copy the bytes held by a buffer source as the buffer was detached.');
4122
+ }
4123
+
4096
4124
  // const octets = new Uint8Array(input);
4097
4125
  // const octets = types.binary.decode(types.binary.encode(input));
4098
4126
  return new Uint8Array(
@@ -4164,7 +4192,7 @@
4164
4192
  var octets;
4165
4193
  try {
4166
4194
  octets = getCopyBytesHeldByBufferSource(/** @type {BufferSource} */input);
4167
- } catch (_unused) {
4195
+ } catch (_unused2) {
4168
4196
  return {
4169
4197
  type: type,
4170
4198
  invalid: true,