Skip to content

Commit 4198060

Browse files
authored
Merge pull request #372 from XmiliaH/fix-371
Fix if CallSite does not have all properties
2 parents 4f0db94 + 469958d commit 4198060

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/contextify.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,14 +1076,15 @@ if (typeof OriginalCallSite === 'function') {
10761076
(function setupCallSite() {
10771077
for (let i=0; i<callSiteGetters.length; i++) {
10781078
const name = callSiteGetters[i].name;
1079+
const funcProp = Object.getOwnPropertyDescriptor(OriginalCallSite.prototype, name);
1080+
if (funcProp === undefined) continue;
10791081
const propertyName = callSiteGetters[i].propName;
10801082
const func = {func() {
10811083
return this[propertyName];
10821084
}}.func;
10831085
const nameProp = Object.getOwnPropertyDescriptor(func, 'name');
10841086
nameProp.value = name;
10851087
Object.defineProperty(func, 'name', nameProp);
1086-
const funcProp = Object.getOwnPropertyDescriptor(OriginalCallSite.prototype, name);
10871088
funcProp.value = func;
10881089
Object.defineProperty(CallSite.prototype, name, funcProp);
10891090
}

0 commit comments

Comments
 (0)