Browse Source

fix(source-map-debugger): Don't show debugger when 'Minified' is checked (#57659)

Luca Forstner 1 year ago
parent
commit
2ce382bb54

+ 1 - 0
static/app/components/events/interfaces/crashContent/exception/content.tsx

@@ -204,6 +204,7 @@ export function Content({
           meta={meta?.[excIdx]?.stacktrace}
           threadId={threadId}
           frameSourceMapDebuggerData={frameSourceMapDebuggerData}
+          stackType={type}
         />
       </div>
     );

+ 2 - 1
static/app/components/events/interfaces/crashContent/exception/stackTrace.spec.tsx

@@ -2,7 +2,7 @@ import {render, screen} from 'sentry-test/reactTestingLibrary';
 import {textWithMarkupMatcher} from 'sentry-test/utils';
 
 import ExceptionStacktraceContent from 'sentry/components/events/interfaces/crashContent/exception/stackTrace';
-import {StackView} from 'sentry/types/stacktrace';
+import {StackType, StackView} from 'sentry/types/stacktrace';
 
 const frames = [
   {
@@ -58,6 +58,7 @@ const props: React.ComponentProps<typeof ExceptionStacktraceContent> = {
   expandFirstFrame: true,
   newestFirst: true,
   chainedException: false,
+  stackType: StackType.ORIGINAL,
   event: {
     ...TestStubs.Event(),
     entries: [],

+ 4 - 1
static/app/components/events/interfaces/crashContent/exception/stackTrace.tsx

@@ -5,7 +5,7 @@ import {IconWarning} from 'sentry/icons';
 import {t} from 'sentry/locale';
 import {ExceptionValue, Group, PlatformKey} from 'sentry/types';
 import {Event} from 'sentry/types/event';
-import {StackView} from 'sentry/types/stacktrace';
+import {StackType, StackView} from 'sentry/types/stacktrace';
 import {defined} from 'sentry/utils';
 import {isNativePlatform} from 'sentry/utils/platform';
 
@@ -19,6 +19,7 @@ type Props = {
   event: Event;
   hasHierarchicalGrouping: boolean;
   platform: PlatformKey;
+  stackType: StackType;
   stacktrace: ExceptionValue['stacktrace'];
   expandFirstFrame?: boolean;
   frameSourceMapDebuggerData?: FrameSourceMapDebuggerData[];
@@ -43,6 +44,7 @@ function StackTrace({
   meta,
   threadId,
   frameSourceMapDebuggerData,
+  stackType,
 }: Props) {
   if (!defined(stacktrace)) {
     return null;
@@ -125,6 +127,7 @@ function StackTrace({
       meta={meta}
       threadId={threadId}
       frameSourceMapDebuggerData={frameSourceMapDebuggerData}
+      hideSourceMapDebugger={stackType === StackType.MINIFIED}
     />
   );
 }

+ 3 - 0
static/app/components/events/interfaces/crashContent/stackTrace/content.tsx

@@ -35,6 +35,7 @@ type Props = {
   className?: string;
   frameSourceMapDebuggerData?: FrameSourceMapDebuggerData[];
   hideIcon?: boolean;
+  hideSourceMapDebugger?: boolean;
   isHoverPreviewed?: boolean;
   lockAddress?: string;
   maxDepth?: number;
@@ -61,6 +62,7 @@ function Content({
   lockAddress,
   organization,
   frameSourceMapDebuggerData,
+  hideSourceMapDebugger,
 }: Props) {
   const [showingAbsoluteAddresses, setShowingAbsoluteAddresses] = useState(false);
   const [showCompleteFunctionName, setShowCompleteFunctionName] = useState(false);
@@ -248,6 +250,7 @@ function Content({
           hiddenFrameCount: frameCountMap[frameIndex],
           organization,
           frameSourceResolutionResults: frameSourceMapDebuggerData?.[frameIndex],
+          hideSourceMapDebugger,
         };
 
         nRepeats = 0;

+ 2 - 0
static/app/components/events/interfaces/frame/deprecatedLine.tsx

@@ -58,6 +58,7 @@ export interface DeprecatedLineProps {
   frameMeta?: Record<any, any>;
   frameSourceResolutionResults?: FrameSourceMapDebuggerData;
   hiddenFrameCount?: number;
+  hideSourceMapDebugger?: boolean;
   image?: React.ComponentProps<typeof DebugImage>['image'];
   includeSystemFrames?: boolean;
   isANR?: boolean;
@@ -316,6 +317,7 @@ export class DeprecatedLine extends Component<Props, State> {
       );
 
     const shouldShowSourceMapDebuggerToggle =
+      !this.props.hideSourceMapDebugger &&
       data.inApp &&
       this.props.frameSourceResolutionResults &&
       (!this.props.frameSourceResolutionResults.frameIsResolved ||