Skip to content

Commit 6434fec

Browse files
Use hasOwnProperty in getterFor
This avoids the case in which 'watch' is somewhere on the prototype chain, as for instance in Firefox which includes a 'watch' method on Object.prototype.
1 parent 168c283 commit 6434fec

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
33
# Changelog
44

5+
- [v3.1.3](#v313)
56
- [v3.1.1](#v311)
67
- [v3.1.0](#v310)
78
- [v3.0.1](#v301)
@@ -16,6 +17,10 @@
1617

1718
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1819

20+
### v3.1.3
21+
* Fix a bug where extra properties on `Object.prototype` would be
22+
considered relevent to `vue-async-computed`.
23+
1924
### v3.1.1
2025
* Fix bug where `vue-async-computed` wouldn't find async computed
2126
properties that were further up the prototype chain.

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function getterFor (fn) {
7474

7575
let getter = fn.get
7676

77-
if (fn.watch) {
77+
if (fn.hasOwnProperty('watch')) {
7878
getter = function getter () {
7979
fn.watch.call(this)
8080
return fn.get(this)

0 commit comments

Comments
 (0)