Skip to content
Myr

Use object with null prototype for various app properties

Before adoption: this commit came in with the history the project adopted, so no landing records it.

`app.cache`, `app.engines`, and `app.settings` are now created with `Object.create(null)` instead of `{}`. This also updates a test to ensure that `app.locals` is created the same way.

authored by Evan Hahn · committed by Wes Todd · parent cd7d79f · Browse files · 2 files+5 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−4 removed

  • tests:+2 added−1 removed
  • other:+3 added−3 removed

2 files+5 added−4 removed

modified:lib/application.js+3 added-3 removed
59 unmodified lines
6061app.init = function init() {62 var router = null;6364 this.cache = {};65 this.engines = {};66 this.settings = {};64 this.cache = Object.create(null);65 this.engines = Object.create(null);66 this.settings = Object.create(null);6768 this.defaultConfiguration();6970 // Setup getting to lazily add base router
577 unmodified lines
modified:test/app.locals.js+2 added-1 removed