Njs: Object.freeze(new Uint8Array([1,2,3]))

Created on 19 Sep 2020  路  4Comments  路  Source: nginx/njs

The above should throw a TypeError:

node:

> Object.freeze(new Uint8Array([1,2,3]))
Uncaught TypeError: Cannot freeze array buffer views with elements
    at Function.freeze (<anonymous>)

firefox:

Object.freeze(new Uint8Array([1,2,3]))
Uncaught TypeError: can't redefine non-configurable property 0
    <anonymous> debugger eval code:1
bug

All 4 comments

here is the patch:
https://gist.github.com/drsm/be8f32f9217d10cb87cebfd4a3018acf
implies #375
fixes also #374

Actually, needs more work.

>> var x = Object.freeze([1,,3]); x[1] = 2 // also seal()
2

will do.

~

@drsm Thanks for the patch, committed after some style tidying.

Was this page helpful?
0 / 5 - 0 ratings