Skip to content

Commit d534e57

Browse files
committed
Wrap host objects passes through prepareStackTrace
1 parent e541782 commit d534e57

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

lib/setup-sandbox.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,30 @@ if (typeof OriginalCallSite === 'function') {
276276
return;
277277
}
278278
const newWrapped = (error, sst) => {
279+
const sandboxSst = ensureThis(sst);
279280
if (localArrayIsArray(sst)) {
280-
for (let i=0; i < sst.length; i++) {
281-
const cs = sst[i];
282-
if (typeof cs === 'object' && localReflectGetPrototypeOf(cs) === OriginalCallSite.prototype) {
283-
sst[i] = new CallSite(cs);
281+
if (sst === sandboxSst) {
282+
for (let i=0; i < sst.length; i++) {
283+
const cs = sst[i];
284+
if (typeof cs === 'object' && localReflectGetPrototypeOf(cs) === OriginalCallSite.prototype) {
285+
sst[i] = new CallSite(cs);
286+
}
287+
}
288+
} else {
289+
sst = [];
290+
for (let i=0; i < sandboxSst.length; i++) {
291+
const cs = sandboxSst[i];
292+
localReflectDefineProperty(sst, i, {
293+
__proto__: null,
294+
value: new CallSite(cs),
295+
enumerable: true,
296+
configurable: true,
297+
writable: true
298+
});
284299
}
285300
}
301+
} else {
302+
sst = sandboxSst;
286303
}
287304
return value(error, sst);
288305
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy