Closed
Bug 1362504
Opened 7 years ago
Closed 7 years ago
JSON Viewer should save using the original mime type
Categories
(DevTools :: JSON Viewer, defect)
DevTools
JSON Viewer
Tracking
(firefox55 fixed)
RESOLVED
FIXED
Firefox 55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: Oriol, Assigned: Oriol)
References
Details
Attachments
(1 file, 2 obsolete files)
1.98 KB,
patch
|
Honza
:
review+
|
Details | Diff | Splinter Review |
Bug 1349437 enabled saving the JSON contents via Ctrl+S in the JSON Viewer. The problem is that it downloads with the application/json mime type, which forces a .json extension, even if the original type was application/manifest+json or application/vnd.mozilla.json.view. The original type is available in the chrome process, but it's needed in the content one (see bug 1349437 comment 9).
Assignee | ||
Comment 1•7 years ago
|
||
I noticed converter-child.js has access to the HTTP headers, this can be used to obtain the content type. For data URIs I use a regexp. And application/json is the fallback value if I missed some other case.
Assignee: nobody → oriol-bugzilla
Status: NEW → ASSIGNED
Attachment #8865028 -
Flags: review?(odvarko)
Assignee | ||
Comment 2•7 years ago
|
||
Adding a try..catch in case getResponseHeader throws (e.g. if you enable the JSON Viewer for "application/x-unknown-content-type", and the server doesn't send the Content-Type header).
Attachment #8865028 -
Attachment is obsolete: true
Attachment #8865028 -
Flags: review?(odvarko)
Attachment #8865056 -
Flags: review?(odvarko)
Comment 3•7 years ago
|
||
Comment on attachment 8865056 [details] [diff] [review] json-save-with-type-v2.patch Review of attachment 8865056 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me. Please see one inline comment R+ assuming try is green Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=0d6d9298f14c5d708ea80a88743fb799c30d5eae Honza ::: devtools/client/jsonview/converter-child.js @@ +101,5 @@ > + // which has been replaced by application/vnd.mozilla.json.view > + let originalType; > + if (request instanceof Ci.nsIHttpChannel) { > + try { > + originalType = request.getResponseHeader('Content-Type'); nit: use quotes for strings => "Content-Type"
Attachment #8865056 -
Flags: review?(odvarko) → review+
Assignee | ||
Comment 4•7 years ago
|
||
Fixed, but I don't see why simple quotes are considered bad. Now I hope the linter stops complaining. How to run linter tests locally?
Attachment #8865056 -
Attachment is obsolete: true
Attachment #8865454 -
Flags: review?(odvarko)
Updated•7 years ago
|
Attachment #8865454 -
Flags: review?(odvarko) → review+
Comment 5•7 years ago
|
||
(In reply to Oriol from comment #4) > Fixed, but I don't see why simple quotes are considered bad. It's just part of our code style rules. > Now I hope the linter stops complaining. How to run linter tests locally? See this MDN page https://developer.mozilla.org/en-US/docs/ESLint Honza
Assignee | ||
Updated•7 years ago
|
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/a5a5759c9547 Let JSON Viewer save with original content type. r=Honza
Keywords: checkin-needed
Comment 7•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a5a5759c9547
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•