WebKit Bugzilla
Attachment 357383 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
m3u8.patch (text/plain), 6.31 KB, created by
Joseph Pecoraro
on 2018-12-14 20:12:00 PST
(
hide
)
Description:
[PATCH] Proposed Fix
Filename:
MIME Type:
Creator:
Joseph Pecoraro
Created:
2018-12-14 20:12:00 PST
Size:
6.31 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 61dd8b48b13..3e734f27ce9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-12-14 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-14 Joseph Pecoraro <pecoraro@apple.com> > > Web Inspector: Avoid creating and evaluating in the InspectorOverlay page on iOS as it is unused >diff --git a/Source/WebCore/inspector/NetworkResourcesData.cpp b/Source/WebCore/inspector/NetworkResourcesData.cpp >index 90520f3e5e3..9a77cf73c69 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.isEmpty()) >+ 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 84b773c2028..79482549958 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,15 @@ >+2018-12-14 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-13 Devin Rousso <drousso@apple.com> > > Web Inspector: remove DOM.BackendNodeId and associated commands/events >diff --git a/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js b/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js >index ed53a1f9352..32c6c3520ef 100644 >--- a/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js >+++ b/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js >@@ -315,6 +315,11 @@ 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 (mimeType.startsWith("application/")) > return mimeType.endsWith("script") || mimeType.endsWith("json");
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:
hi
:
review+
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192731
: 357383 |
357384
|
357392
|
357518