8000 fix: Do not inherit app object from Object prototype by daffl · Pull Request #1153 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

fix: Do not inherit app object from Object prototype#1153

Merged
daffl merged 2 commits intomasterfrom
null-object-app
Jan 2, 2019
Merged

fix: Do not inherit app object from Object prototype#1153
daffl merged 2 commits intomasterfrom
null-object-app

Conversation

@daffl
Copy link
Member
@daffl daffl commented Jan 2, 2019

It appears that some browsers (or plugins or something) override the Object prototype, specifically the init property, which we use to call to initialize the application (causing .init is not a function errors). The best way to avoid this is to inherit from null instead of the Object prototype.

@daffl daffl merged commit ed8c2e4 into master Jan 2, 2019
@daffl daffl deleted the null-object-app branch January 2, 2019 22:26

function createApplication () {
const app = {};
const app = Object.create(baseObject);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would not be enough to do that?

const app = Object.create(null);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so, too but Uberproto tries to get the Prototype when mixing into the app object, gets null and blows up so I needed to add another one to the chain.

@daffl daffl mentioned this pull request Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0