|
1 | 1 | 'use strict'; |
| 2 | + |
| 3 | +// This tests that Blob.prototype.slice() works correctly when the size of the |
| 4 | +// Blob is outside the range of 32-bit signed integers. |
2 | 5 | const common = require('../common'); |
3 | 6 | |
4 | 7 | // Buffer with size > INT32_MAX |
@@ -14,8 +17,11 @@ try {
|
14 | 17 | const slicedBlob = blob.slice(size - 1, size); |
15 | 18 | assert.strictEqual(slicedBlob.size, 1); |
16 | 19 | } catch (e) { |
17 | | -if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') { |
18 | | -throw e; |
| 20 | +if (e.code === 'ERR_MEMORY_ALLOCATION_FAILED') { |
| 21 | +common.skip('insufficient space for Buffer.allocUnsafe'); |
| 22 | +} |
| 23 | +if (/Array buffer allocation failed/.test(e.message)) { |
| 24 | +common.skip('insufficient space for Blob.prototype.slice()'); |
19 | 25 | } |
20 | | -common.skip('insufficient space for Buffer.allocUnsafe'); |
| 26 | +throw e; |
21 | 27 | } |