Skip to content

Firefox JSON viewer not loading content scripts #51

@sudoqux

Description

@sudoqux

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.
<anonymous> 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions