When loading a URL with MIME type application/json, Firefox should display it as plain text instead of offering to download the file.
Steps to Reproduce:
Load a URL containing JSON data served with application/json MIME type.
Firefox offers to download the file.
Firefox displays the JSON as plain text.
A patch to fix this in in bug #606488
Created attachment 549818 [details] [diff] [review]
This is the same patch as in bug 606488, but also contains a test. I'm only requesting review on the test. I'm not sure that I'm not making any wrong assumptions there. For example, is it safe to assume that plain text documents have a document and a body?
Comment on attachment 549818 [details] [diff] [review]
Yeah, it's safe to assume that. The web depends on it, and the HTML5 spec requires that behavior.
Created attachment 549828 [details] [diff] [review]
with commit msg
Is there some central way of detecting whether a MIME type is text based rather than patching all over the place (e.g. bug 882995 was recently filed to "catch up")?
My best idea is to look at the document - if it's a MediaDocument then you probably don't want to allow View Source on it, while if it's XUL or SVG then you probably don't want to FAYT either.