JetBrains / JetBrains/xdebug-extension

Firefox JSON viewer not loading content scripts

Open
#51 0 comments 1 reaction 0 assignees View on GitHub
help wanted
Dominant language
JavaScript
Stars
137
Forks
15
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
When viewing a URL with JSON content (application/json), Firefox uses a built in JSON viewer.

The debug mode cannot be changed, for pages/responses handled by the JSON viewer.

This seems to be due to the extension's content script not being loaded, when the JSON viewer handles rendering.

Error in Browser Console:

> Error during tab update: Error: Could not establish connection. Receiving end does not exist.
> \ moz-extension://159b81ff-8130-489b-9e32-07b9cc23f742/service_worker.js:46

**To Reproduce**
Steps to reproduce the behavior:
1. With xDebug extension installed in Firefox
2. Open the Browser Console (CTRL + SHIFT + J) - _not DevTools_
3. Go to a url where raw JSON is returned, e.g. https://jsonplaceholder.cypress.io/todos/14
4. See error in the browser console window, when navigating to the page
5. Click the xDebug button and try to switch mode
6. See same error in the Browser Console
7. The debug mode is not toggled. Not for the domain and not in the interface. E.g. the button does not turn green when clicking _Debug_

**Expected behavior**
- When navigating to the url returning JSON, I expect to see the current debug state for the domain
- When clicking e.g. _Debug_ I expect debug mode to be enabled

**Screenshots**
None

**Desktop (please complete the following information):**
- OS: Windows 11
- Browser: Firefox 151.0

**Smartphone (please complete the following information):**
None

**Additional context**

Disabling the JSON viewer (enabled by default in Firefox, `devtools.jsonview.enabled`) results in the extension working correctly, when toggling the button.

I couldn't reproduce the issue for the JSON viewer in Chrome, where it works as expected.

Toggling debug mode for the example domain, can be done by visiting a url not returning JSON, e.g. the main website: https://jsonplaceholder.cypress.io
Which is a simple workaround, but slightly annoying for an otherwise happy user of the extension like me.

Another workaround is using a JSON viewer that is not the default, built-in viewer.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.