| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 02d8c3b commit 0ef18fe
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 1 | + // Flags: --no-warnings | ||
| 2 | + 'use strict'; | ||
| 3 | + | ||
| 4 | + const common = require('../common'); | ||
| 5 | + const assert = require('assert'); | ||
| 6 | + const { Blob } = require('buffer'); | ||
| 7 | + | ||
| 8 | + if (common.isFreeBSD) | ||
| 9 | + common.skip('Oversized buffer make the FreeBSD CI runner crash'); | ||
| 10 | + | ||
| 11 | + try { | ||
| 12 | + new Blob([new Uint8Array(0xffffffff), [1]]); | ||
| 13 | + } catch (e) { | ||
| 14 | + if ( | ||
| 15 | + e.message === 'Array buffer allocation failed' || | ||
| 16 | + e.message === 'Invalid typed array length: 4294967295' | ||
| 17 | + ) { | ||
| 18 | + common.skip( | ||
| 19 | + 'Insufficient memory on this platform for oversized buffer test.' | ||
| 20 | + ); | ||
| 21 | + } else { | ||
| 22 | + assert.strictEqual(e.code, 'ERR_BUFFER_TOO_LARGE'); | ||
| 23 | + } | ||
| 24 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -198,6 +198,8 @@ assert.throws(() => new Blob({}), { | |||
| 198 | 198 | const b = new Blob(); | |
| 199 | 199 | assert.strictEqual(inspect(b, { depth: null }), | |
| 200 | 200 | 'Blob { size: 0, type: \'\' }'); | |
| 201 | + assert.strictEqual(inspect(b, { depth: 1 }), | ||
| 202 | + 'Blob { size: 0, type: \'\' }'); | ||
| 201 | 203 | assert.strictEqual(inspect(b, { depth: -1 }), '[Blob]'); | |
| 202 | 204 | } | |
| 203 | 205 | ||
@@ -230,6 +232,30 @@ assert.throws(() => new Blob({}), { | |||
| 230 | 232 | }); | |
| 231 | 233 | } | |
| 232 | 234 | ||
| 235 | + { | ||
| 236 | + assert.throws(() => Reflect.get(Blob.prototype, 'type', {}), { | ||
| 237 | + code: 'ERR_INVALID_THIS', | ||
| 238 | + }); | ||
| 239 | + assert.throws(() => Reflect.get(Blob.prototype, 'size', {}), { | ||
| 240 | + code: 'ERR_INVALID_THIS', | ||
| 241 | + }); | ||
| 242 | + assert.throws(() => Blob.prototype.slice(Blob.prototype, 0, 1), { | ||
| 243 | + code: 'ERR_INVALID_THIS', | ||
| 244 | + }); | ||
| 245 | + assert.throws(() => Blob.prototype.stream.call(), { | ||
| 246 | + code: 'ERR_INVALID_THIS', | ||
| 247 | + }); | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + (async () => { | ||
| 251 | + assert.rejects(async () => Blob.prototype.arrayBuffer.call(), { | ||
| 252 | + code: 'ERR_INVALID_THIS', | ||
| 253 | + }); | ||
| 254 | + assert.rejects(async () => Blob.prototype.text.call(), { | ||
| 255 | + code: 'ERR_INVALID_THIS', | ||
| 256 | + }); | ||
| 257 | + })().then(common.mustCall()); | ||
| 258 | + | ||
| 233 | 259 | (async () => { | |
| 234 | 260 | const blob = new Blob([ | |
| 235 | 261 | new Uint8Array([0x50, 0x41, 0x53, 0x53]), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments