Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Jan Odvarko
On Thu, Apr 16, 2015 at 4:36 PM, Boris Zbarsky wrote: > On 4/16/15 4:37 AM, Jan Odvarko wrote: > >> We are obviously trying to avoid C++ code in devtools >> > > Sure. We can add scriptable APIs as needed. For example, we already have > one for adding anonymous content, right?. > Yes, and it's p

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Gijs Kruitbosch
On 16/04/2015 15:30, Boris Zbarsky wrote: On 4/16/15 4:52 AM, Gijs Kruitbosch wrote: but that would still require that application/json loads as text in the browser, which I think it currently doesn't? Totally does ever since https://bugzilla.mozilla.org/show_bug.cgi?id=667533 (so about 3.5 ye

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Boris Zbarsky
On 4/16/15 4:37 AM, Jan Odvarko wrote: We are obviously trying to avoid C++ code in devtools Sure. We can add scriptable APIs as needed. For example, we already have one for adding anonymous content, right?. Not sure if there is yet another way how to manipulate content with a script that

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Boris Zbarsky
On 4/16/15 4:30 AM, Frederik Braun wrote: Running our code in someone else's origin sounds undesired indeed. Not only because of CSP: What if someone puts this in a frame (or a popup) and interacts with this JSON viewer? So the way the XML viewer handles this is basically the following: 1) It

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Boris Zbarsky
On 4/16/15 4:52 AM, Gijs Kruitbosch wrote: but that would still require that application/json loads as text in the browser, which I think it currently doesn't? Totally does ever since https://bugzilla.mozilla.org/show_bug.cgi?id=667533 (so about 3.5 years ago). ;) -Boris _

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Frederik Braun
On 16.04.2015 11:04, Jan Odvarko wrote: > On Thu, Apr 16, 2015 at 10:30 AM, Frederik Braun > wrote: > > > Running our code in someone else's origin sounds undesired indeed. Not > only because of CSP: What if someone puts this in a frame (or a popup) > and i

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Jan Odvarko
On Thu, Apr 16, 2015 at 10:30 AM, Frederik Braun wrote: > > Running our code in someone else's origin sounds undesired indeed. Not > only because of CSP: What if someone puts this in a frame (or a popup) > and interacts with this JSON viewer? Why iteration with a frame with the viewer could be a

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Gijs Kruitbosch
On 16/04/2015 09:37, Jan Odvarko wrote: If not, can you take the same approach here? We are obviously trying to avoid C++ code in devtools, but also XUL/XBL in favor of pure JS/HTML/CSS stack. Not sure if there is yet another way how to manipulate content with a script that is living outside t

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Jan Odvarko
Thanks for the link, looks interesting indeed! Honza On Thu, Apr 16, 2015 at 3:23 AM, Karl Dubost wrote: > Jan, > > Le 16 avr. 2015 à 01:54, Jan Odvarko a écrit : > > One of the new features we'd like to have in DevEdition 40 is related to > > JSON rendering. > > Prettifying JSON is a good idea

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Jan Odvarko
On Wed, Apr 15, 2015 at 8:01 PM, Boris Zbarsky wrote: > How does our XML prettyprinter manage this? I seem to recall it > force-loads an XBL binding that provides all the scriptability. Yes, there is XBL [1] that implements expand/collapse and XSLT [2] transforming the document. All wired toget

Re: New Developer Tools Feature: prettifying JSON

2015-04-16 Thread Frederik Braun
On 15.04.2015 18:54, Jan Odvarko wrote: > … > This approach has one security implication, if the page uses "default-src > 'none'" (or other security restrictions?) - injecting JS into it generates > warnings: "Content Security Policy: The page's settings blocked the loading > of a resource at self

Re: New Developer Tools Feature: prettifying JSON

2015-04-15 Thread Karl Dubost
Jan, Le 16 avr. 2015 à 01:54, Jan Odvarko a écrit : > One of the new features we'd like to have in DevEdition 40 is related to > JSON rendering. Prettifying JSON is a good idea. Did you check/play with jq? https://stedolan.github.io/jq/ https://jqplay.org/ They do a really good job at showing

Re: New Developer Tools Feature: prettifying JSON

2015-04-15 Thread Boris Zbarsky
On 4/15/15 12:54 PM, Jan Odvarko wrote: This approach has one security implication, if the page uses "default-src 'none'" (or other security restrictions?) - injecting JS into it generates warnings: "Content Security Policy: The page's settings blocked the loading of a resource at self ("default-

New Developer Tools Feature: prettifying JSON

2015-04-15 Thread Jan Odvarko
One of the new features we'd like to have in DevEdition 40 is related to JSON rendering. Dev folks deal with JSON a lot these days and we want to make the work easier by rendering JSON as an expandable tree that allows easy inspection and filter/search. One option to make this is implementing a st