Skip to content

Don't stringify JSON again in fetchUrlResponse#5570

Merged
mstange merged 2 commits intofirefox-devtools:mainfrom
eqrion:post-stringify
Aug 26, 2025
Merged

Don't stringify JSON again in fetchUrlResponse#5570
mstange merged 2 commits intofirefox-devtools:mainfrom
eqrion:post-stringify

Conversation

@eqrion
Copy link
Contributor

@eqrion eqrion commented Aug 25, 2025

fetchUrlResponse is called from queryApiWithFallback and is given stringified JSON data, but then stringifies the string again. This leads to errors when trying to view source files with a local samply server.

This is a regression from the production branch. I'm not entirely sure this is the right fix, but from the type signature of fetchUrlResponse, it seems to be the intended behavior.

fetchUrlResponse is called from queryApiWithFallback and is given stringified
JSON data, but then stringifies the string again. This leads to errors when
trying to view source files with a local samply server.
@codecov
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.84%. Comparing base (6444d1f) to head (8c2572f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5570   +/-   ##
=======================================
  Coverage   85.84%   85.84%           
=======================================
  Files         309      309           
  Lines       30338    30338           
  Branches     8346     8346           
=======================================
  Hits        26045    26045           
  Misses       3873     3873           
  Partials      420      420           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mstange
Copy link
Contributor

mstange commented Aug 26, 2025

Oops, thanks for catching this! I must have broken it in the typescript conversation, I remember moving some stuff related to this around. Will look in more detail tomorrow.

@mstange mstange self-requested a review August 26, 2025 03:17
@mstange
Copy link
Contributor

mstange commented Aug 26, 2025

I'll also check why we didn't have tests that would have caught this.

@mstange
Copy link
Contributor

mstange commented Aug 26, 2025

Yes I indeed broke this in ed02f3f . And it looks like I never wrote tests for source fetching :(
I originally created this file in ef12d27 and there's even a comment in there saying "which simplifies writing tests". Though if those tests with a different ExternalCommunicationDelegate implementation existed, they wouldn't actually have caught this bug. Oh well.

Copy link
Contributor

@mstange mstange left a comment

Choose a reason for hiding this comment

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

Thanks!

@mstange mstange merged commit 142890d into firefox-devtools:main Aug 26, 2025
12 of 13 checks passed
@eqrion eqrion deleted the post-stringify branch August 26, 2025 16:11
mstange added a commit that referenced this pull request Aug 27, 2025
The new `RegularExternalCommunicationDelegate/fetchUrlResponse/makes
POST request with verbatim post data` test would have caught #5570.
@canova canova mentioned this pull request Sep 2, 2025
canova added a commit that referenced this pull request Sep 2, 2025
Changes:

[Nazım Can Altınova] Display the marker description at the top inside
the marker tooltips (#5534)
[Florian Quèze] Change the 'JavaScript' radio button label to 'Script'
(#5530)
[Markus Stange] Implement profile logic and some selectors for the
function list (#5525)
[Markus Stange] Some small type fixes (#5538)
[Markus Stange] Simplify return type of the callback we pass to
setState. (#5540)
[Markus Stange] Pass the correct value to the reducer's action argument
(#5543)
[Markus Stange] Change withSize to accept PropsWithoutSize as its type
parameter (#5541)
[Nazım Can Altınova] Make sure that the test-debug command runs the
tests properly (#5545)
[Markus Stange] Improve type coverage involving network phases (#5539)
[Markus Stange] Change implementation of withChartViewport (#5542)
[Florian Quèze] A new permalink should be generated and shown after
using the re-upload feature. (#5547)
[Florian Quèze] Show the vertical ruler in the timeline when hovering
the network chart (#5548)
[Markus Stange] Convert the entire codebase to TypeScript (#5549)
[Nazım Can Altınova] Update the yarn.lock file after recent changes
(#5557)
[Markus Stange] Add proper TypeScript coverage for window-navigation.ts
(#5559)
[Markus Stange] Remove leftover $FlowExpectError comments (#5560)
[Markus Stange] Fix Iterator / Iterable confusion (#5561)
[Nazım Can Altınova] Remove the unneeded test-all:ci script (#5566)
[Nazım Can Altınova] Fix a type case inconsistency (#5569)
[Florian Quèze] Make 'yarn lint --fix' work as an alias to 'yarn
lint-fix'. (#5563)
[Ryan Hunt] Don't stringify JSON again in fetchUrlResponse (#5570)
[Nazım Can Altınova] Upgrade ESLint to version 9 (#5567)
[Markus Stange] Simplify Worker setup, and support .json.gz inputs in
symbolicator-cli (#5556)
[Nazım Can Altınova] Add TypeScript coverage to the intersection
observer mock (#5574)
[Markus Stange] Set the preview selection to null when there is no
selection (#5568)
[Markus Stange] Add tests for query-api.ts (#5571)
[Markus Stange] Enable noUnusedParameters and
@typescript-eslint/no-unused-vars and clean up a few more things (#5576)
[Ryan Hunt] Embed iongraph-web and use for iongraph.json source files
(#5577)
[Markus Stange] Remove recursion in filterThreadToSearchString (#5572)


And thanks to our localizers:

be: Mikalai Udodau
de: Michael Köhler
el: Jim Spentzos
en-CA: chutten
en-GB: Paul
es-CL: ravmn
fr: Théo Chevalier
fur: Fabio Tomat
fy-NL: Fjoerfoks
ia: Melo46
it: Francesco Lodolo [:flod]
nl: Mark Heijl
pt-BR: Marcelo Ghelman
ru: Valery Ledovskoy
sv-SE: Luna Jernberg
tr: Rua
tr: Selim Şumlu
uk: Іhor Hordiichuk
zh-CN: Olvcpr423
zh-TW: Pin-guang Chen
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.

2 participants