Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use object with null prototype for various app properties #4861

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ var trustProxyDefaultSymbol = '@@symbol:trust_proxy_default';
app.init = function init() {
var router = null;

this.cache = {};
this.engines = {};
this.settings = {};
this.cache = Object.create(null);
this.engines = Object.create(null);
this.settings = Object.create(null);
dougwilson marked this conversation as resolved.
Show resolved Hide resolved

this.defaultConfiguration();

Expand Down
3 changes: 2 additions & 1 deletion test/app.locals.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ var express = require('../')

describe('app', function(){
describe('.locals', function () {
it('should default object', function () {
it('should default object with null prototype', function () {
var app = express()
assert.ok(app.locals)
assert.strictEqual(typeof app.locals, 'object')
assert.strictEqual(Object.getPrototypeOf(app.locals), null)
})

describe('.settings', function () {
Expand Down
Loading