Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(browser): Parse frames-only safari(-web)-extension stack #3929

Merged
merged 3 commits into from Sep 2, 2021

Conversation

kamilogorek
Copy link
Contributor

Fixes #3313

Copy link
Member

@lobsterkatie lobsterkatie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell this looks fine, but without knowing much of the context (even having read that issue), it's a little hard to tell. Would you mind adding just a sentence or two to the PR description saying specifically what was wrong/got changed here? I know from the issue that the stack was getting parsed wrong, but why? How does this fix it?

@github-actions
Copy link
Contributor

github-actions bot commented Aug 27, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 21.65 KB (-0.01% 🔽)
@sentry/browser - Webpack 22.66 KB (0%)
@sentry/react - Webpack 22.7 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 29.08 KB (-0.01% 🔽)

let func = parts[1] || UNKNOWN_FUNCTION;

if (isSafariExtension(func) || isSafariWebExtension(func)) {
[func, url] = extractSafariExtensionDetails(func, url);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if extractSafariExtensionDetails() is always called with the isSafariExtension(func) || isSafariWebExtension(func) check, can we move the boolean check into the function?

Can possibly save on some bytes as well.

const extractSafariExtensionDetails = (func: string, url: string): [string, string] => {
  const isSafariExtension = func.indexOf('safari-extension') !== -1;
  const isSafariWebExtension = func.indexOf('safari-web-extension') !== -1;
  if (isSafariExtension || isSafariWebExtension) {
    return [
      func.indexOf('@') !== -1 ? func.split('@')[0] : UNKNOWN_FUNCTION,
      isSafariExtension ? `safari-extension:${url}` : `safari-web-extension:${url}`,
    ];
  }
  return [func, url];
};

@kamilogorek
Copy link
Contributor Author

@lobsterkatie added appropriate comment
@AbhiPrasad fixed

@kamilogorek kamilogorek force-pushed the parse-framesonly-safari-extensions branch from d4ea2a7 to 2466221 Compare September 2, 2021 12:04
@kamilogorek kamilogorek merged commit 45508c0 into master Sep 2, 2021
@kamilogorek kamilogorek deleted the parse-framesonly-safari-extensions branch September 2, 2021 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to filter safari extensions
3 participants