Saving a json request is not saving the current object
Categories
(DevTools :: JSON Viewer, defect, P2)
Tracking
(Not tracked)
People
(Reporter: andro.marian.v94, Unassigned)
Details
Attachments
(1 file)
|
8.55 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0
Steps to reproduce:
I request a GET json from:
scheme http
host localhost
filename /json
GET /json HTTP/1.1
Host: 192.168.1.237
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Priority: u=0, i
Pragma: no-cache
Actual results:
Save the file by click on save of press CTRL+S.
The save is like: {"state":{"on":false}}
Change to show the on to true.
On the page is showing the {"state":{"on":true}}
Click on Save and the output on the file is FALSE : {"state":{"on":false}}
Even on the RAW is showing the ON is TRUE, but is saving and old data.
Expected results:
To save the good data, not a cached or what it is.
I need to close the Private windows and reopen a new one to save the current data that is showed.
For some reason is stored the first saved object. The windows shows the changed object but when saving it's saving the first stored object.
Comment 4•1 month ago
•
|
||
I can reproduce this on Firefox 146:
- Start https://gist.github.com/LeoMcA/28f19c9c7c3276534afda0b4a355b955 with
node index.jsonwhich returns a incrementing counter on each load - Open a fresh profile in Firefox
- Load
http://localhost:3005/jsonin Firefox - Firefox displays
{ counter: 0 } - Click "Save"
- Load the saved file, it displays
{ counter: 1 } - Reload
http://localhost:3005/json - Firefox displays
{ counter: 2 } - Click "Save"
- Load the saved file, it still displays
{ counter: 1 }
Every subsequent time saving this page appears to save the originally saved value of { counter: 1 }, even across restarts, new tabs, etc.
Expected result:
At the least, the second save should show { counter: 3 }.
However, ideally, saving the file would show exactly what is in the JSON viewer, and not trigger a fresh fetch.
Comment 5•1 month ago
|
||
Thanks for the example! Another interesting thing to note, if you disable the jsonviewer via devtools.jsonview.enabled = false in about:config, using save (CmdOrCtrl+S) always seems to save exactly the same as what is displayed in the page (it remains in sync and it doesn't increase just by doing save).
But then if you reenable json viewer and save again, you go back to save again the first version that was ever saved with json viewer.
Updated•1 month ago
|
Comment 6•1 month ago
|
||
It may be worth looking at what is going on in those methods:
https://searchfox.org/firefox-main/rev/f37efeb9fd346125bfc98d132ae0dea48a1e2584/devtools/client/jsonview/json-viewer.mjs#152-159
and what content type is being applied over there:
https://searchfox.org/firefox-main/rev/f37efeb9fd346125bfc98d132ae0dea48a1e2584/devtools/client/jsonview/converter-child.js#184,207
But given comment 5 and that it also happens without jsonviewer, I suspect it comes from this chrome.internalSave method:
https://searchfox.org/firefox-main/rev/f37efeb9fd346125bfc98d132ae0dea48a1e2584/devtools/startup/DevToolsStartup.sys.mjs#1410-1455
which is implemented over there:
https://searchfox.org/firefox-main/rev/f37efeb9fd346125bfc98d132ae0dea48a1e2584/toolkit/content/contentAreaUtils.js#279
which ultimately calls C++ code from there:
https://searchfox.org/firefox-main/rev/f37efeb9fd346125bfc98d132ae0dea48a1e2584/toolkit/content/contentAreaUtils.js#502-550
May be the cache keys are null/invalid?
Comment 7•17 days ago
|
||
I was able to reproduce this issue on Firefox 146.0.1 using macOS 15 with a fresh profile following the STR from Comment 4. Marking this as NEW.
Description
•