Skip to content

Commit 9bc91c5

Browse files
author
Elevista
committed
Exclude not enumerable keys of inject object
1 parent c628103 commit 9bc91c5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: src/core/instance/inject.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export function resolveInject (inject: any, vm: Component): ?Object {
4141
// inject is :any because flow is not smart enough to figure out cached
4242
const result = Object.create(null)
4343
const keys = hasSymbol
44-
? Reflect.ownKeys(inject)
44+
? Reflect.ownKeys(inject).filter(function (key) {
45+
return Reflect.getOwnPropertyDescriptor(inject, key).enumerable
46+
})
4547
: Object.keys(inject)
4648

4749
for (let i = 0; i < keys.length; i++) {

Diff for: src/core/util/env.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function isNative (Ctor: any): boolean {
6161

6262
export const hasSymbol =
6363
typeof Symbol !== 'undefined' && isNative(Symbol) &&
64-
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys)
64+
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys) && isNative(Reflect.getOwnPropertyDescriptor)
6565

6666
/**
6767
* Defer a task to execute it asynchronously.

0 commit comments

Comments
 (0)