Skip to content

Commit

Permalink
fix: make sure global state is restored in the case of an exception i…
Browse files Browse the repository at this point in the history
…n macrotask callback (#9093)
  • Loading branch information
mitar authored and yyx990803 committed Dec 1, 2018
1 parent 33e669b commit b111de4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/util/next-tick.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
export function withMacroTask (fn: Function): Function {
return fn._withTask || (fn._withTask = function () {
useMacroTask = true
const res = fn.apply(null, arguments)
useMacroTask = false
return res
try {
return fn.apply(null, arguments)
} finally {
useMacroTask = false
}
})
}

Expand Down

0 comments on commit b111de4

Please sign in to comment.