-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In zlib module, a dozen constants were exported to user land, If user change the constant, maybe lead unexcepted error. Make them readonly and freezon. PR-URL: #1361 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
- Loading branch information
1 parent
d726a17
commit 372bf83
Showing
2 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
|
||
var zlib = require('zlib'); | ||
|
||
assert.equal(zlib.Z_OK, 0, 'Z_OK should be 0'); | ||
zlib.Z_OK = 1; | ||
assert.equal(zlib.Z_OK, 0, 'Z_OK should be 0'); | ||
|
||
assert.equal(zlib.codes.Z_OK, 0, 'Z_OK should be 0'); | ||
zlib.codes.Z_OK = 1; | ||
assert.equal(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0'); | ||
zlib.codes = {Z_OK: 1}; | ||
assert.equal(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0'); | ||
|
||
assert.ok(Object.isFrozen(zlib.codes), 'zlib.codes should be frozen'); |