Closed Bug 1368899 Opened 3 years ago Closed 3 years ago

Switch JSON Viewer back to standards mode

Categories

(DevTools :: JSON Viewer, defect, P3)

defect

Tracking

(firefox55 fixed)

RESOLVED FIXED
Firefox 55
Tracking Status
firefox55 --- fixed

People

(Reporter: Oriol, Assigned: Oriol)

References

Details

Attachments

(1 file)

Bug 1367894 fixed various things but switched JSON Viewer to quirks mode and loaded the stylesheets at the end. This patch addresses these problems.

Now it works like this:
 1. The content type is set to text/html
 2. A doctype, the stylesheet and the script are sent at the very beginning
 3. A <plaintext> start tag switches the tokenizer to plaintext state
 4. The chunks of JSON are then directly sent unaltered to the page when they are received

To keep the HTML simple, I only linked the main stylesheet and made it import the other ones. reps.css is already imported by tree-view.css, so no need to import it from main.css

To avoid problems like bug 1260189, I moved all the initialization code to onStartRequest (previously some work was done in onStopRequest), and deferred the script.

Then onStartRequest became too cluttered so I moved code to helper functions.
Attachment #8872860 - Flags: review?(odvarko)
Comment on attachment 8872860 [details] [diff] [review]
json-stream-v2.patch

Review of attachment 8872860 [details] [diff] [review]:
-----------------------------------------------------------------

Looks reasonable.

R+ assuming Try is green.

Thanks for working on this!

Honza
Attachment #8872860 - Flags: review?(odvarko) → review+
Can you post the Try link to see if it's green?
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1d284663f05d
Refactor the JSON Viewer stream converter to avoid quirks mode. r=Honza
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/1d284663f05d
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Depends on: 1395313
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.