Diff
Modified: trunk/LayoutTests/ChangeLog (239342 => 239343)
--- trunk/LayoutTests/ChangeLog 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/LayoutTests/ChangeLog 2018-12-18 19:18:44 UTC (rev 239343)
@@ -1,3 +1,15 @@
+2018-12-18 Joseph Pecoraro <[email protected]>
+
+ 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 <[email protected]>
Remove <meta http-equiv=set-cookie> support
Modified: trunk/LayoutTests/inspector/unit-tests/mimetype-utilities-expected.txt (239342 => 239343)
--- trunk/LayoutTests/inspector/unit-tests/mimetype-utilities-expected.txt 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/LayoutTests/inspector/unit-tests/mimetype-utilities-expected.txt 2018-12-18 19:18:44 UTC (rev 239343)
@@ -28,3 +28,21 @@
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.
+
Modified: trunk/LayoutTests/inspector/unit-tests/mimetype-utilities.html (239342 => 239343)
--- trunk/LayoutTests/inspector/unit-tests/mimetype-utilities.html 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/LayoutTests/inspector/unit-tests/mimetype-utilities.html 2018-12-18 19:18:44 UTC (rev 239343)
@@ -51,6 +51,39 @@
}
});
+ 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>
Modified: trunk/Source/WebCore/ChangeLog (239342 => 239343)
--- trunk/Source/WebCore/ChangeLog 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/Source/WebCore/ChangeLog 2018-12-18 19:18:44 UTC (rev 239343)
@@ -1,3 +1,24 @@
+2018-12-18 Joseph Pecoraro <[email protected]>
+
+ 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 <[email protected]>
Remove <meta http-equiv=set-cookie> support
Modified: trunk/Source/WebCore/inspector/NetworkResourcesData.cpp (239342 => 239343)
--- trunk/Source/WebCore/inspector/NetworkResourcesData.cpp 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/Source/WebCore/inspector/NetworkResourcesData.cpp 2018-12-18 19:18:44 UTC (rev 239343)
@@ -187,6 +187,9 @@
void NetworkResourcesData::setResourceContent(const String& requestId, const String& content, bool base64Encoded)
{
+ if (content.isNull())
+ return;
+
ResourceData* resourceData = resourceDataForRequestId(requestId);
if (!resourceData)
return;
Modified: trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp (239342 => 239343)
--- trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp 2018-12-18 19:18:44 UTC (rev 239343)
@@ -978,7 +978,8 @@
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)
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (239342 => 239343)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2018-12-18 19:18:44 UTC (rev 239343)
@@ -499,6 +499,26 @@
|| 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())
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.h (239342 => 239343)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.h 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.h 2018-12-18 19:18:44 UTC (rev 239343)
@@ -63,6 +63,9 @@
// 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);
Modified: trunk/Source/WebInspectorUI/ChangeLog (239342 => 239343)
--- trunk/Source/WebInspectorUI/ChangeLog 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/Source/WebInspectorUI/ChangeLog 2018-12-18 19:18:44 UTC (rev 239343)
@@ -1,3 +1,15 @@
+2018-12-18 Joseph Pecoraro <[email protected]>
+
+ 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 <[email protected]>
Web Inspector: Canvas: path view is misaligned
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js (239342 => 239343)
--- trunk/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js 2018-12-18 19:18:44 UTC (rev 239343)
@@ -315,7 +315,14 @@
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");
Modified: trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js (239342 => 239343)
--- trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js 2018-12-18 19:17:15 UTC (rev 239342)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js 2018-12-18 19:18:44 UTC (rev 239343)
@@ -116,6 +116,11 @@
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);