Open Bug 1791316 Opened 3 years ago Updated 3 years ago

Can't set cookies inside DevTools for json sites

Categories

(DevTools :: Storage Inspector, defect, P3)

Firefox 104
defect

Tracking

(Not tracked)

People

(Reporter: marcel.3ff8, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0

Steps to reproduce:

I am not able to create new cookies inside DevTools on application/json sites.
plain or html sites are just working fine.

You could test it on this example:

https://cookies.xairoo.workers.dev/json
https://cookies.xairoo.workers.dev/plain
https://cookies.xairoo.workers.dev/html

Tested with:

  • 106.0a1 (2022-09-18) (64-Bit)
  • 104.0.2 (64-Bit)

It works with chrome. But I prefer not to use Chrome.

Just a note, but I haven't tested it fully:
Looks like cookies set from an API within a CORS request won't be submitted if you try to access the API directly in Firefox. Also it's not able to remove this cookies with Firefox because you can't see it anywhere in the GUI. I had to clear the complete browser cache to get rid of this cookie(s). Maybe I have done something wrong with the CORS request, not sure about that right now.

Expected results:

It should be able to create cookies on JSON sites, just like on text/plain sites.

The Bugbug bot thinks this bug should belong to the 'Core::Networking: Cookies' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Networking: Cookies
Product: Firefox → Core
Component: Networking: Cookies → Netmonitor
Product: Core → DevTools

Thanks for filing. Disabling the devtools JSON viewer with devtools.jsonview.enabled set to false allows to set cookies on the very same page.
This might either be a bug on JSON View or in the Storage Inspector

Severity: -- → S3
Status: UNCONFIRMED → NEW
Component: Netmonitor → Storage Inspector
Ever confirmed: true
Priority: -- → P3

I suspect something wrong is going on around these lines:
https://searchfox.org/mozilla-central/rev/cefb4bc274c71aa4badbec09da9c056fd8ca4472/devtools/server/actors/storage.js#808-810
The window or principal might be wrong and might refer to the JSON viewer document instead of the debugged document.

You need to log in before you can comment on or make changes to this bug.