Skip to content

Commit

Permalink
Simplify sandbox fix by reusing the fix for stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Mar 9, 2020
1 parent 1fe433e commit 25311e4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/sinon/sandbox.js
Expand Up @@ -189,10 +189,9 @@ function Sandbox() {

function getFakeRestorer(object, property) {
var descriptor = getPropertyDescriptor(object, property);
var shadowsPrototypeProp = typeof Object.getOwnPropertyDescriptor(object, property) === "undefined";

function restorer() {
if (!shadowsPrototypeProp) {
if (descriptor.isOwn) {
Object.defineProperty(object, property, descriptor);
} else {
delete object[property];
Expand Down

0 comments on commit 25311e4

Please sign in to comment.