litejs / json-lite

Fast non-blocking JSON viewer for Chrome and Firefox
196 stars 17 forks source link

api.github.com pages aren't rendered #5

Closed mherger closed 7 years ago

mherger commented 7 years ago

github.com commit lists like eg. https://api.github.com/repos/lauriro/json-lite/commits are not rendered as JSON. Expected?

lauriro commented 7 years ago

In firefox:

Content Security Policy: The page’s settings blocked the loading of a resource

Works in Chrome and Opera, need to find some work around

lauriro commented 7 years ago

Playing on console

document.head.appendChild(document.createElement("style"))

Chrome gives warning but style element is appended, so this is a bug on chrome that it works

Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'".

document.body.setAttribute("style","color:red")

Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'".

Currently I have no idea how to make it work with Content-Security-Policy: default-src 'none' header from backend.

lauriro commented 7 years ago

Injecting css from backgroud will work but adds disturbing delay before formatting. You can test this by installing git version of extension.

I am not sure is it ready for release. Probably needs a greater rewrite by moving all code to background.

lauriro commented 7 years ago

Fixed in v0.20

mherger commented 7 years ago

How would I install v0.20?

lauriro commented 7 years ago

The easiest way is to wait till addon awaiting review from mozilla.

For testing purpose you could clone this repo and "Load Temporary Add-on" on Firefox "Debug Add-ons" page.

lauriro commented 7 years ago

Your add-on, JSON Lite 0.20, has been approved and is now available for download

lauriro commented 7 years ago

This bug still exist in Safari, I have no idea how to fix it, waiting for inspiration