Web Inspector: CSP request payload on medium.com is unreadable, should be pretty...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2018 19:27:27 +0000 (19:27 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2018 19:27:27 +0000 (19:27 +0000)
commit9c9e65d9953094549c36f0f233ca2c87850097a6
treee09d79d86252f1a842798f629edd7e968f11c1a3
parent0709602ed87b8085d02587ccda14b59ca322d608
Web Inspector: CSP request payload on medium.com is unreadable, should be pretty-printed
https://bugs.webkit.org/show_bug.cgi?id=190354
<rdar://problem/45090894>

Reviewed by Joseph Pecoraro.

* UserInterface/Views/TextEditor.js:
(WI.TextEditor.prototype.set string.update):
(WI.TextEditor.prototype._attemptToDetermineMIMEType): Added.
If the content doesn't already have a MIME type, attempt to determine one by trying to
format it as "javascript" (e.g. request JSON that is simply missing a MIME type).

* UserInterface/Views/TextContentView.js:
(WI.TextContentView):
(WI.TextContentView.prototype._handleTextEditorMIMETypeChanged): Added.
* UserInterface/Views/TextResourceContentView.js:
(WI.TextResourceContentView):
(WI.TextResourceContentView.prototype._handleTextEditorMIMETypeChanged): Added.
* UserInterface/Views/ScriptContentView.js:
(WI.ScriptContentView):
(WI.ScriptContentView.prototype._handleTextEditorMIMETypeChanged): Added.
Enable the "Pretty Print" navigation button if the MIME type changes to something that is
able to be formatted.
Drive-by: reorder the creation of the "Pretty Print" button so that it exists if
`_attemptToDetermineMIMEType` finishes synchronously.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js
Source/WebInspectorUI/UserInterface/Views/TextContentView.js
Source/WebInspectorUI/UserInterface/Views/TextEditor.js
Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js