Closed Bug 1358133 Opened 7 years ago Closed 6 years ago

Integrated JSON Viewer shows a blank page

Categories

(DevTools :: JSON Viewer, defect)

53 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1366239

People

(Reporter: spam, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20170413192749

Steps to reproduce:

Loaded a 52 KiB long page returning JSON content with application/json Content-Type header


Actual results:

Firefox displays a blank page when devtools.jsonview.enabled is true
going to page source with Ctrl + U displays the full json text
disabling devtools.jsonview.enabled and using an alternate add-on like JSONView or JSON Lite show correctly formatted JSON content


Expected results:

I expected to see formatted JSON like from add-ons JSONView or JSON Lite

Cannot attach the file for privacy reasons, but checked it as well-formed JSON with several tools.

reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1243951#c21
Component: Untriaged → Developer Tools: JSON Viewer
I have also noticed this intermittently, sometimes the JSON Viewer fails to start, or you must wait A LOT until it shows the JSON. It does not seem to depend on the actual JSON contents. I blame react.js, I don't understand what's the point in using these libraries instead of fast native JavaScript.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(In reply to Oriol from comment #1)
> I have also noticed this intermittently, sometimes the JSON Viewer fails to
> start, or you must wait A LOT until it shows the JSON. It does not seem to
> depend on the actual JSON contents. I blame react.js, I don't understand
> what's the point in using these libraries instead of fast native JavaScript.

Are they really using a third party library for this? Mozilla? Seriously? I would be shocked to hear such a thing.
(In reply to Anselmo Canfora from comment #2)
> Are they really using a third party library for this? Mozilla? Seriously? I
> would be shocked to hear such a thing.

See for yourself:
resource://devtools/client/jsonview/viewer-config.js
resource://devtools/client/shared/vendor/react.js

Various devtools use react too, I suspect this is also the reason Inspector sometimes takes so much time to initialize.
(In reply to Oriol from comment #3)
> (In reply to Anselmo Canfora from comment #2)
> > Are they really using a third party library for this? Mozilla? Seriously? I
> > would be shocked to hear such a thing.
> 
> See for yourself:
> resource://devtools/client/jsonview/viewer-config.js
> resource://devtools/client/shared/vendor/react.js
> 
> Various devtools use react too, I suspect this is also the reason Inspector
> sometimes takes so much time to initialize.

Thanks for then info, I didn't figured this out. My opinion is that this is unacceptable, React of course isn't on par with native Javascript, and devtools should be as fast as possible.

http://stefankrause.net/js-frameworks-benchmark4/webdriver-ts/table.html
I just tried to load data:application/json,"a"
Only 3 characters. But the JSON Viewer failed with this error:

Error: Load timeout for modules: devtools/client/shared/vendor/react
http://requirejs.org/docs/errors.html#timeout
resource://devtools/client/jsonview/lib/require.js:166:17
Stack:
  makeError                          (resource://devtools/client/jsonview/lib/require.js:166:17)
  checkLoaded                        (resource://devtools/client/jsonview/lib/require.js:692:23)
  checkLoaded/checkLoadedTimeoutId<  (resource://devtools/client/jsonview/lib/require.js:713:25)

As I said in comment 1, this kind of things only occur from time to time, I cannot consistently reproduce.
Bug 1366239 mitigates this. Even if the JSON Viewer does not load, you should see the raw JSON text.
Best workaround is to set devtools.jsonview.enabled to false and install JSON Lite (performs better than JSONView:

https://addons.mozilla.org/en-US/firefox/addon/json-lite/?src=search
Closing as dupe of bug 1366239 because the JSON Viewer should no longer show a blank page. What sometimes happens is that it does not load and you only see the raw text, I filed bug 1424372 for this.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.