NoScript extension blocks display of JSON data

RESOLVED FIXED

Status

()

Firefox
Developer Tools: JSON Viewer
P4
normal
RESOLVED FIXED
2 years ago
8 months ago

People

(Reporter: whimboo, Unassigned)

Tracking

42 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
I have NoScript 2.9.0.11 installed and whenever I open a URL which returns JSON data the page is displayed as white. Once NoScript gets disabled the json viewer works correctly.

I'm not exactly sure what exactly is causing this misbehavior. If its NoScript or the internal json viewer.

Comment 1

2 years ago
Reporter, can you provide an example URL?
Flags: needinfo?(hskupin)
(In reply to Henrik Skupin (:whimboo) from comment #0)
> I have NoScript 2.9.0.11 installed and whenever I open a URL which returns
> JSON data the page is displayed as white. Once NoScript gets disabled the
> json viewer works correctly.
JSON Viewer is using JavaScript to render the page so, blocking JS breaks it.
There is no plan currently that would allow running JSON Viewer without JS.

Honza
Priority: -- → P4

Comment 4

2 years ago
I'm gonna work around by checking whether the content type changed from JSON to text/html just before blocking scripts, like this:

<snippet>
let channel = docShell.currentDocumentChannel;
if (channel instanceof Ci.nsIHttpChannel) {
  let originalContentType = channel.getResponseHeader("Content-Type");
  if (/\/json(?:;|^)/i.test(originalContentType) && channel.contentType === "text/html") {
    blockJS = false;
  }
}
</snippet>

Of course I'd really prefer something less hackish and working also on non-HTTP channels, e.g. you might set some flag / property on the channel in your jsonview-converter at https://dxr.mozilla.org/mozilla-central/rev/4c05938a64a7fde3ac2d7f4493aee1c5f2ad8a0a/devtools/client/jsonview/converter-child.js#98

Comment 5

9 months ago
After bug 1366239 you should at least see the raw JSON.

Comment 6

8 months ago
NoScript fixed this in version 5.0.4
https://addons.mozilla.org/firefox/addon/noscript/versions/5.0.4

> Fixed JSON viewer working only on JavaScript-enabled URLs
Status: NEW → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.