https://bugs.webkit.org/show_bug.cgi?id=192731
<rdar://problem/
46747728>
Reviewed by Devin Rousso.
Source/WebCore:
* inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::setResourceContent):
Don't clobber data if setting empty content on a resource that has content.
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::shouldTreatAsText):
Additional non-"text/" mime types that can be treated as text.
* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isTextMediaPlaylistMIMEType):
* platform/MIMETypeRegistry.h:
Detect media playlist mime types that are text (m3u8/m3u).
Source/WebInspectorUI:
* UserInterface/Base/MIMETypeUtilities.js:
(WI.shouldTreatMIMETypeAsText):
Support m3u8/m3u files as text.
LayoutTests:
* inspector/unit-tests/mimetype-utilities-expected.txt:
* inspector/unit-tests/mimetype-utilities.html:
Tests for shouldTreatMIMETypeAsText.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239343
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-12-18 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: m3u8 content not shown, it should be text
+ https://bugs.webkit.org/show_bug.cgi?id=192731
+ <rdar://problem/46747728>
+
+ Reviewed by Devin Rousso.
+
+ * inspector/unit-tests/mimetype-utilities-expected.txt:
+ * inspector/unit-tests/mimetype-utilities.html:
+ Tests for shouldTreatMIMETypeAsText.
+
2018-12-18 Daniel Bates <dabates@apple.com>
Remove <meta http-equiv=set-cookie> support
PASS: File extension for "image/svg+xml" should be "svg".
PASS: File extension for "text/foo+xml" should be "xml".
+-- Running test case: shouldTreatMIMETypeAsText
+PASS: null mime type should not be treated as text.
+PASS: "application/unknown" should not be treated as text.
+PASS: "text/plain" should be treated as text.
+PASS: "text/javascript" should be treated as text.
+PASS: "application/json" should be treated as text.
+PASS: "application/vnd.api+json" should be treated as text.
+PASS: "application/vnd.apple.mpegurl" should be treated as text.
+PASS: "image/svg+xml" should be treated as text.
+PASS: "text/x-coffeescript" should be treated as text.
+PASS: "image/jpeg" should not be treated as text.
+PASS: "image/png" should not be treated as text.
+PASS: "image/gif" should not be treated as text.
+PASS: "font/woff" should not be treated as text.
+PASS: "video/mpeg" should not be treated as text.
+PASS: "audio/ogg" should not be treated as text.
+PASS: "application/pdf" should not be treated as text.
+
}
});
+ suite.addTestCase({
+ name: "shouldTreatMIMETypeAsText",
+ test() {
+ function expectText(mimeType) {
+ InspectorTest.expectTrue(WI.shouldTreatMIMETypeAsText(mimeType), `"${mimeType}" should be treated as text.`);
+ }
+ function expectNotText(mimeType) {
+ InspectorTest.expectFalse(WI.shouldTreatMIMETypeAsText(mimeType), `"${mimeType}" should not be treated as text.`);
+ }
+
+ InspectorTest.expectFalse(WI.shouldTreatMIMETypeAsText(null), `null mime type should not be treated as text.`);
+ expectNotText("application/unknown");
+
+ expectText("text/plain");
+ expectText("text/javascript");
+ expectText("application/json");
+ expectText("application/vnd.api+json");
+ expectText("application/vnd.apple.mpegurl");
+ expectText("image/svg+xml");
+ expectText("text/x-coffeescript");
+
+ expectNotText("image/jpeg");
+ expectNotText("image/png");
+ expectNotText("image/gif");
+ expectNotText("font/woff");
+ expectNotText("video/mpeg");
+ expectNotText("audio/ogg");
+ expectNotText("application/pdf");
+
+ return true;
+ }
+ })
+
suite.runTestCasesAndFinish();
}
</script>
+2018-12-18 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: m3u8 content not shown, it should be text
+ https://bugs.webkit.org/show_bug.cgi?id=192731
+ <rdar://problem/46747728>
+
+ Reviewed by Devin Rousso.
+
+ * inspector/NetworkResourcesData.cpp:
+ (WebCore::NetworkResourcesData::setResourceContent):
+ Don't clobber data if setting empty content on a resource that has content.
+
+ * inspector/agents/InspectorNetworkAgent.cpp:
+ (WebCore::InspectorNetworkAgent::shouldTreatAsText):
+ Additional non-"text/" mime types that can be treated as text.
+
+ * platform/MIMETypeRegistry.cpp:
+ (WebCore::MIMETypeRegistry::isTextMediaPlaylistMIMEType):
+ * platform/MIMETypeRegistry.h:
+ Detect media playlist mime types that are text (m3u8/m3u).
+
2018-12-18 Daniel Bates <dabates@apple.com>
Remove <meta http-equiv=set-cookie> support
void NetworkResourcesData::setResourceContent(const String& requestId, const String& content, bool base64Encoded)
{
+ if (content.isNull())
+ return;
+
ResourceData* resourceData = resourceDataForRequestId(requestId);
if (!resourceData)
return;
return startsWithLettersIgnoringASCIICase(mimeType, "text/")
|| MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType)
|| MIMETypeRegistry::isSupportedJSONMIMEType(mimeType)
- || MIMETypeRegistry::isXMLMIMEType(mimeType);
+ || MIMETypeRegistry::isXMLMIMEType(mimeType)
+ || MIMETypeRegistry::isTextMediaPlaylistMIMEType(mimeType);
}
Ref<TextResourceDecoder> InspectorNetworkAgent::createTextDecoder(const String& mimeType, const String& textEncodingName)
|| equalLettersIgnoringASCIICase(subtype, "sfnt");
}
+bool MIMETypeRegistry::isTextMediaPlaylistMIMEType(const String& mimeType)
+{
+ if (startsWithLettersIgnoringASCIICase(mimeType, "application/")) {
+ static const unsigned applicationLength = 12;
+ auto subtype = StringView { mimeType }.substring(applicationLength);
+ return equalLettersIgnoringASCIICase(subtype, "vnd.apple.mpegurl")
+ || equalLettersIgnoringASCIICase(subtype, "mpegurl")
+ || equalLettersIgnoringASCIICase(subtype, "x-mpegurl");
+ }
+
+ if (startsWithLettersIgnoringASCIICase(mimeType, "audio/")) {
+ static const unsigned audioLength = 6;
+ auto subtype = StringView { mimeType }.substring(audioLength);
+ return equalLettersIgnoringASCIICase(subtype, "mpegurl")
+ || equalLettersIgnoringASCIICase(subtype, "x-mpegurl");
+ }
+
+ return false;
+}
+
bool MIMETypeRegistry::isSupportedJSONMIMEType(const String& mimeType)
{
if (mimeType.isEmpty())
// Check to see if a MIME type is suitable for being loaded as a font.
static bool isSupportedFontMIMEType(const String& mimeType);
+ // Check to see if a MIME type is a text media playlist type, such as an m3u8.
+ static bool isTextMediaPlaylistMIMEType(const String& mimeType);
+
// Check to see if a non-image MIME type is suitable for being loaded as a
// document in a frame. Does not include supported JavaScript and JSON MIME types.
WEBCORE_EXPORT static bool isSupportedNonImageMIMEType(const String& mimeType);
+2018-12-18 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: m3u8 content not shown, it should be text
+ https://bugs.webkit.org/show_bug.cgi?id=192731
+ <rdar://problem/46747728>
+
+ Reviewed by Devin Rousso.
+
+ * UserInterface/Base/MIMETypeUtilities.js:
+ (WI.shouldTreatMIMETypeAsText):
+ Support m3u8/m3u files as text.
+
2018-12-17 Devin Rousso <drousso@apple.com>
Web Inspector: Canvas: path view is misaligned
if (mimeType.endsWith("+json") || mimeType.endsWith("+xml"))
return true;
+ // Various media text mime types.
+ let extension = WI.fileExtensionForMIMEType(mimeType);
+ if (extension === "m3u8" || extension === "m3u")
+ return true;
+
// Various script and JSON mime types.
+ if (extension === "js" || extension === "json")
+ return true;
if (mimeType.startsWith("application/"))
return mimeType.endsWith("script") || mimeType.endsWith("json");
this._expect(TestHarness.ExpectationType.True, !!actual, message, actual);
}
+ expectTrue(actual, message)
+ {
+ this._expect(TestHarness.ExpectationType.True, !!actual, message, actual);
+ }
+
expectFalse(actual, message)
{
this._expect(TestHarness.ExpectationType.False, !actual, message, actual);