Closed Bug 1709395 Opened 5 years ago Closed 5 years ago

Network monitor shows HTTP response details while Fetch API prevents access to the data

Categories

(DevTools :: Netmonitor, defect)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1671147

People

(Reporter: whimboo, Unassigned)

Details

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0 ID:20210503094544

I noticed a situation with the Fetch API when the Network tab shows HTTP response data while the call to fetch() actually doesn't contain any data. This behavior is a bit irritating and maybe might need some investigation.

Steps to reproduce:

  1. Start a second Firefox with the --remote-debugging-port command line argument set
  2. Open the DevTools console in your regular Firefox instance
  3. Execute the following code:
var response = await fetch("http://localhost:9222/json/list", {
  method: "GET",
  mode: 'no-cors',
  headers: {
    'Content-Type': 'application/json',
  },
});
alert(await response.text());

The alert shows no text, and I assume this is due to the cross-origin request and by disabling CORS. Running the same code in the Browser Toolbox will show no all the text.

So should the network monitor maybe also hide information that usually is not accessible from within content processes?

Flags: needinfo?(hmanilla)

Thanks for filing Henrik. There is some related work been done in Bug 1671147.
We are looking at showing a notification in these cases. Please feel free to look up the details
and contribute suggestions there.
I'll close this a a dupe.
Thanks

Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(hmanilla)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.