diff --git a/src/lib/byte-length-queuing-strategy.ts b/src/lib/byte-length-queuing-strategy.ts index 6ac607e..dddf5a4 100644 --- a/src/lib/byte-length-queuing-strategy.ts +++ b/src/lib/byte-length-queuing-strategy.ts @@ -7,10 +7,13 @@ import { convertQueuingStrategyInit } from './validators/queuing-strategy-init'; const byteLengthSizeFunction = (chunk: ArrayBufferView): number => { return chunk.byteLength; }; -Object.defineProperty(byteLengthSizeFunction, 'name', { - value: 'size', - configurable: true -}); + +try { + Object.defineProperty(byteLengthSizeFunction, 'name', { + value: 'size', + configurable: true + }); +} catch {} /** * A queuing strategy that counts the number of bytes in each chunk. diff --git a/src/lib/count-queuing-strategy.ts b/src/lib/count-queuing-strategy.ts index 01f4c1f..079f5dd 100644 --- a/src/lib/count-queuing-strategy.ts +++ b/src/lib/count-queuing-strategy.ts @@ -7,10 +7,14 @@ import { convertQueuingStrategyInit } from './validators/queuing-strategy-init'; const countSizeFunction = (): 1 => { return 1; }; -Object.defineProperty(countSizeFunction, 'name', { - value: 'size', - configurable: true -}); + +try { + // To avoid exception thrown by PhantomJS + Object.defineProperty(countSizeFunction, 'name', { + value: 'size', + configurable: true + }); +} catch {} /** * A queuing strategy that counts the number of chunks.