1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Enable "strict" mode for NodeJS

Summary:
In particular, this changes the behavior of NodeJS in the following ways:

- Any attempt to get or modify the global object will result in an error.
- `null` values of `this` will no longer be evaluated to the global object and primitive values of this will not be converted to wrapper objects.
- Writing or deleting properties which have there writeable or configurable attributes set to false will now throw an error instead of failing silently.
- Adding a property to an object whose extensible attribute is false will also throw an error now.
- A functions arguments are not writeable so attempting to change them will now throw an error `arguments = [...]`.
- `with(){}` statements are gone.
- Use of `eval` is effectively banned.
- `eval` and `arguments` are not allowed as variable or function identifiers in any scope.
- The identifiers `implements`, `interface`, `let`, `package`, `private`, `protected`, `public`, `static` and `yield` are all now reserved for future use (roll on ES6).

Test Plan: Verified that Aphlict was still functional.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11430
This commit is contained in:
Joshua Spence 2015-01-20 07:41:46 +11:00
parent 00faa2b2f7
commit 53834d1471
7 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,5 @@
'use strict';
var JX = require('./lib/javelin').JX; var JX = require('./lib/javelin').JX;
var http = require('http'); var http = require('http');
var https = require('https'); var https = require('https');

View file

@ -1,3 +1,5 @@
'use strict';
var JX = require('./javelin').JX; var JX = require('./javelin').JX;
require('./AphlictListenerList'); require('./AphlictListenerList');

View file

@ -1,3 +1,5 @@
'use strict';
var JX = require('./javelin').JX; var JX = require('./javelin').JX;
require('./AphlictListenerList'); require('./AphlictListenerList');

View file

@ -1,3 +1,5 @@
'use strict';
var JX = require('./javelin').JX; var JX = require('./javelin').JX;
JX.install('AphlictListener', { JX.install('AphlictListener', {

View file

@ -1,3 +1,5 @@
'use strict';
var JX = require('./javelin').JX; var JX = require('./javelin').JX;
require('./AphlictListener'); require('./AphlictListener');

View file

@ -1,3 +1,5 @@
'use strict';
var JX = require('./javelin').JX; var JX = require('./javelin').JX;
var fs = require('fs'); var fs = require('fs');
@ -22,7 +24,7 @@ JX.install('AphlictLog', {
this._logs.push(fs.createWriteStream(path, { this._logs.push(fs.createWriteStream(path, {
flags: 'a', flags: 'a',
encoding: 'utf8', encoding: 'utf8',
mode: 0664, mode: '0664',
})); }));
return this; return this;
}, },

View file

@ -12,6 +12,7 @@
"expr": true, "expr": true,
"loopfunc": true, "loopfunc": true,
"strict": true,
"sub": true, "sub": true,
"globals": { "globals": {