Skip to content

Commit d07263e

Browse files
committed
Let it rip
tv off
1 parent da0e07c commit d07263e

File tree

1 file changed

+16
-50
lines changed

1 file changed

+16
-50
lines changed

packages/react/src/jsx/ReactJSXElement.js

Lines changed: 16 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,6 @@ function getOwner() {
6464
// The higher the limit, the slower Error() is when not inspecting with a debugger.
6565
// When inspecting with a debugger, Error.stackTraceLimit has no impact on Error() performance (in v8).
6666
const ownerStackTraceLimit = 10;
67-
let supportsSettingStackTraceLimit = false;
68-
if (__DEV__) {
69-
const descriptor = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit');
70-
if (descriptor !== undefined) {
71-
if (typeof descriptor.set === 'function') {
72-
const previousStackTraceLimit = Error.stackTraceLimit;
73-
Error.stackTraceLimit = 1;
74-
Error.stackTraceLimit = previousStackTraceLimit;
75-
supportsSettingStackTraceLimit = true;
76-
} else {
77-
supportsSettingStackTraceLimit = descriptor.writable;
78-
}
79-
}
80-
}
8167

8268
/** @noinline */
8369
function UnknownOwner() {
@@ -377,15 +363,10 @@ export function jsxProdSignatureRunningInDevWithDynamicChildren(
377363
let debugStackDEV = false;
378364
if (__DEV__) {
379365
if (trackActualOwner) {
380-
if (supportsSettingStackTraceLimit) {
381-
const previousStackTraceLimit = Error.stackTraceLimit;
382-
Error.stackTraceLimit = ownerStackTraceLimit;
383-
debugStackDEV = Error('react-stack-top-frame');
384-
Error.stackTraceLimit = previousStackTraceLimit;
385-
}
386-
if (!debugStackDEV) {
387-
debugStackDEV = Error('react-stack-top-frame');
388-
}
366+
const previousStackTraceLimit = Error.stackTraceLimit;
367+
Error.stackTraceLimit = ownerStackTraceLimit;
368+
debugStackDEV = Error('react-stack-top-frame');
369+
Error.stackTraceLimit = previousStackTraceLimit;
389370
} else {
390371
debugStackDEV = unknownOwnerDebugStack;
391372
}
@@ -418,15 +399,10 @@ export function jsxProdSignatureRunningInDevWithStaticChildren(
418399
let debugStackDEV = false;
419400
if (__DEV__) {
420401
if (trackActualOwner) {
421-
if (supportsSettingStackTraceLimit) {
422-
const previousStackTraceLimit = Error.stackTraceLimit;
423-
Error.stackTraceLimit = ownerStackTraceLimit;
424-
debugStackDEV = Error('react-stack-top-frame');
425-
Error.stackTraceLimit = previousStackTraceLimit;
426-
}
427-
if (!debugStackDEV) {
428-
debugStackDEV = Error('react-stack-top-frame');
429-
}
402+
const previousStackTraceLimit = Error.stackTraceLimit;
403+
Error.stackTraceLimit = ownerStackTraceLimit;
404+
debugStackDEV = Error('react-stack-top-frame');
405+
Error.stackTraceLimit = previousStackTraceLimit;
430406
} else {
431407
debugStackDEV = unknownOwnerDebugStack;
432408
}
@@ -460,15 +436,10 @@ export function jsxDEV(type, config, maybeKey, isStaticChildren) {
460436
let debugStackDEV = false;
461437
if (__DEV__) {
462438
if (trackActualOwner) {
463-
if (supportsSettingStackTraceLimit) {
464-
const previousStackTraceLimit = Error.stackTraceLimit;
465-
Error.stackTraceLimit = ownerStackTraceLimit;
466-
debugStackDEV = Error('react-stack-top-frame');
467-
Error.stackTraceLimit = previousStackTraceLimit;
468-
}
469-
if (!debugStackDEV) {
470-
debugStackDEV = Error('react-stack-top-frame');
471-
}
439+
const previousStackTraceLimit = Error.stackTraceLimit;
440+
Error.stackTraceLimit = ownerStackTraceLimit;
441+
debugStackDEV = Error('react-stack-top-frame');
442+
Error.stackTraceLimit = previousStackTraceLimit;
472443
} else {
473444
debugStackDEV = unknownOwnerDebugStack;
474445
}
@@ -732,15 +703,10 @@ export function createElement(type, config, children) {
732703
let debugStackDEV = false;
733704
if (__DEV__) {
734705
if (trackActualOwner) {
735-
if (supportsSettingStackTraceLimit) {
736-
const previousStackTraceLimit = Error.stackTraceLimit;
737-
Error.stackTraceLimit = ownerStackTraceLimit;
738-
debugStackDEV = Error('react-stack-top-frame');
739-
Error.stackTraceLimit = previousStackTraceLimit;
740-
}
741-
if (!debugStackDEV) {
742-
debugStackDEV = Error('react-stack-top-frame');
743-
}
706+
const previousStackTraceLimit = Error.stackTraceLimit;
707+
Error.stackTraceLimit = ownerStackTraceLimit;
708+
debugStackDEV = Error('react-stack-top-frame');
709+
Error.stackTraceLimit = previousStackTraceLimit;
744710
} else {
745711
debugStackDEV = unknownOwnerDebugStack;
746712
}

0 commit comments

Comments
 (0)