Skip to content

Commit

Permalink
fix(runtime-core): set appContext.provides to Object.create(null) (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangying000 committed Feb 26, 2020
1 parent 59393dd commit 04f83fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/runtime-core/__tests__/apiCreateApp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ describe('api: createApp', () => {
setup() {
const foo = inject('foo')
const bar = inject('bar')
try {
inject('__proto__')
} catch (e) {}
return () => `${foo},${bar}`
}
}
Expand All @@ -90,6 +93,7 @@ describe('api: createApp', () => {
const root = nodeOps.createElement('div')
app.mount(root)
expect(serializeInner(root)).toBe(`3,2`)
expect('[Vue warn]: injection "__proto__" not found.').toHaveBeenWarned()
})

test('component', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/apiCreateApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function createAppContext(): AppContext {
mixins: [],
components: {},
directives: {},
provides: {}
provides: Object.create(null)
}
}

Expand Down

0 comments on commit 04f83fa

Please sign in to comment.