WebKit Bugzilla
Attachment 357518 Details for
Bug 192731
: Web Inspector: m3u8 content not shown, it should be text
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] Proposed Fix
for-landing-2.patch (text/plain), 10.84 KB, created by
Joseph Pecoraro
on 2018-12-17 19:29:00 PST
(
hide
)
Description:
[PATCH] Proposed Fix
Filename:
MIME Type:
Creator:
Joseph Pecoraro
Created:
2018-12-17 19:29:00 PST
Size:
10.84 KB
patch
obsolete
>diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 09e1a8e49e3..b9396278aca 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,15 @@ >+2018-12-17 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 NOBODY (OOPS!). >+ >+ * inspector/unit-tests/mimetype-utilities-expected.txt: >+ * inspector/unit-tests/mimetype-utilities.html: >+ Tests for shouldTreatMIMETypeAsText. >+ > 2018-12-17 Justin Fan <justin_fan@apple.com> > > [WebGPU] Implement WebGPUBindGroupLayoutDescriptor and its supporting dictionaries >diff --git a/LayoutTests/inspector/unit-tests/mimetype-utilities-expected.txt b/LayoutTests/inspector/unit-tests/mimetype-utilities-expected.txt >index acce625c476..fe1c7de49bc 100644 >--- a/LayoutTests/inspector/unit-tests/mimetype-utilities-expected.txt >+++ b/LayoutTests/inspector/unit-tests/mimetype-utilities-expected.txt >@@ -28,3 +28,21 @@ PASS: File extension for "application/xhtml+xml" should be "xhtml". > 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. >+ >diff --git a/LayoutTests/inspector/unit-tests/mimetype-utilities.html b/LayoutTests/inspector/unit-tests/mimetype-utilities.html >index 3f28ca6a262..ce954d90177 100644 >--- a/LayoutTests/inspector/unit-tests/mimetype-utilities.html >+++ b/LayoutTests/inspector/unit-tests/mimetype-utilities.html >@@ -51,6 +51,39 @@ function test() > } > }); > >+ 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> >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 90a22655ded..ecf115e0307 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-12-17 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 NOBODY (OOPS!). >+ >+ * 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-17 Justin Fan <justin_fan@apple.com> > > [WebGPU] Implement WebGPUBindGroupLayoutDescriptor and its supporting dictionaries >diff --git a/Source/WebCore/inspector/NetworkResourcesData.cpp b/Source/WebCore/inspector/NetworkResourcesData.cpp >index 90520f3e5e3..df4c628f74a 100644 >--- a/Source/WebCore/inspector/NetworkResourcesData.cpp >+++ b/Source/WebCore/inspector/NetworkResourcesData.cpp >@@ -187,6 +187,9 @@ InspectorPageAgent::ResourceType NetworkResourcesData::resourceType(const String > > void NetworkResourcesData::setResourceContent(const String& requestId, const String& content, bool base64Encoded) > { >+ if (content.isNull()) >+ return; >+ > ResourceData* resourceData = resourceDataForRequestId(requestId); > if (!resourceData) > return; >diff --git a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp >index 2230993d232..b662b6832a9 100644 >--- a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp >@@ -978,7 +978,8 @@ bool InspectorNetworkAgent::shouldTreatAsText(const String& mimeType) > 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) >diff --git a/Source/WebCore/platform/MIMETypeRegistry.cpp b/Source/WebCore/platform/MIMETypeRegistry.cpp >index c6bb70381f3..15d30286113 100644 >--- a/Source/WebCore/platform/MIMETypeRegistry.cpp >+++ b/Source/WebCore/platform/MIMETypeRegistry.cpp >@@ -499,6 +499,26 @@ bool MIMETypeRegistry::isSupportedFontMIMEType(const String& mimeType) > || 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()) >diff --git a/Source/WebCore/platform/MIMETypeRegistry.h b/Source/WebCore/platform/MIMETypeRegistry.h >index 7c929be2eb2..19331ba0720 100644 >--- a/Source/WebCore/platform/MIMETypeRegistry.h >+++ b/Source/WebCore/platform/MIMETypeRegistry.h >@@ -63,6 +63,9 @@ public: > // 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); >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index d1657831261..e1701194ecb 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,15 @@ >+2018-12-17 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 NOBODY (OOPS!). >+ >+ * UserInterface/Base/MIMETypeUtilities.js: >+ (WI.shouldTreatMIMETypeAsText): >+ Support m3u8/m3u files as text. >+ > 2018-12-17 Devin Rousso <drousso@apple.com> > > Web Inspector: Audit: add plural result strings >diff --git a/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js b/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js >index ed53a1f9352..b2837aa6c0d 100644 >--- a/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js >+++ b/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js >@@ -315,7 +315,14 @@ WI.shouldTreatMIMETypeAsText = function(mimeType) > 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"); > >diff --git a/Source/WebInspectorUI/UserInterface/Test/TestHarness.js b/Source/WebInspectorUI/UserInterface/Test/TestHarness.js >index ff66acab7b7..64534d621bb 100644 >--- a/Source/WebInspectorUI/UserInterface/Test/TestHarness.js >+++ b/Source/WebInspectorUI/UserInterface/Test/TestHarness.js >@@ -116,6 +116,11 @@ TestHarness = class TestHarness extends WI.Object > 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);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
commit-queue
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192731
:
357383
|
357384
|
357392
| 357518