Skip to content

Commit

Permalink
fix(Injection with Symbol polyfill): hasOwn instead of 'in'
Browse files Browse the repository at this point in the history
Symbol polyfill adds a setter on the Object prototype so the 'in' check evaluated to true on every
object

fix vuejs#7284
  • Loading branch information
Hiroki Osame committed Jan 16, 2018
1 parent f2b476d commit 9d4b0c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/instance/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { warn } from '../util/index'
import { hasSymbol } from 'core/util/env'
import { defineReactive, observerState } from '../observer/index'
import { hasOwn } from 'shared/util'

export function initProvide (vm: Component) {
const provide = vm.$options.provide
Expand Down Expand Up @@ -52,7 +53,7 @@ export function resolveInject (inject: any, vm: Component): ?Object {
const provideKey = inject[key].from
let source = vm
while (source) {
if (source._provided && provideKey in source._provided) {
if (source._provided && hasOwn(source._provided, provideKey)) {
result[key] = source._provided[provideKey]
break
}
Expand Down

0 comments on commit 9d4b0c3

Please sign in to comment.