Closed Bug 1282105 Opened 8 years ago Closed 7 years ago

NoScript extension blocks display of JSON data

Categories

(DevTools :: JSON Viewer, defect, P4)

42 Branch
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: whimboo, Unassigned)

Details

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.
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
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
After bug 1366239 you should at least see the raw JSON.
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
Closed: 7 years ago
Resolution: --- → FIXED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.