Changeset 239343 in webkit
- Timestamp:
- Dec 18, 2018 11:18:44 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r239342 r239343 1 2018-12-18 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: m3u8 content not shown, it should be text 4 https://bugs.webkit.org/show_bug.cgi?id=192731 5 <rdar://problem/46747728> 6 7 Reviewed by Devin Rousso. 8 9 * inspector/unit-tests/mimetype-utilities-expected.txt: 10 * inspector/unit-tests/mimetype-utilities.html: 11 Tests for shouldTreatMIMETypeAsText. 12 1 13 2018-12-18 Daniel Bates <dabates@apple.com> 2 14 -
trunk/LayoutTests/inspector/unit-tests/mimetype-utilities-expected.txt
r224507 r239343 29 29 PASS: File extension for "text/foo+xml" should be "xml". 30 30 31 -- Running test case: shouldTreatMIMETypeAsText 32 PASS: null mime type should not be treated as text. 33 PASS: "application/unknown" should not be treated as text. 34 PASS: "text/plain" should be treated as text. 35 PASS: "text/javascript" should be treated as text. 36 PASS: "application/json" should be treated as text. 37 PASS: "application/vnd.api+json" should be treated as text. 38 PASS: "application/vnd.apple.mpegurl" should be treated as text. 39 PASS: "image/svg+xml" should be treated as text. 40 PASS: "text/x-coffeescript" should be treated as text. 41 PASS: "image/jpeg" should not be treated as text. 42 PASS: "image/png" should not be treated as text. 43 PASS: "image/gif" should not be treated as text. 44 PASS: "font/woff" should not be treated as text. 45 PASS: "video/mpeg" should not be treated as text. 46 PASS: "audio/ogg" should not be treated as text. 47 PASS: "application/pdf" should not be treated as text. 48 -
trunk/LayoutTests/inspector/unit-tests/mimetype-utilities.html
r224507 r239343 52 52 }); 53 53 54 suite.addTestCase({ 55 name: "shouldTreatMIMETypeAsText", 56 test() { 57 function expectText(mimeType) { 58 InspectorTest.expectTrue(WI.shouldTreatMIMETypeAsText(mimeType), `"${mimeType}" should be treated as text.`); 59 } 60 function expectNotText(mimeType) { 61 InspectorTest.expectFalse(WI.shouldTreatMIMETypeAsText(mimeType), `"${mimeType}" should not be treated as text.`); 62 } 63 64 InspectorTest.expectFalse(WI.shouldTreatMIMETypeAsText(null), `null mime type should not be treated as text.`); 65 expectNotText("application/unknown"); 66 67 expectText("text/plain"); 68 expectText("text/javascript"); 69 expectText("application/json"); 70 expectText("application/vnd.api+json"); 71 expectText("application/vnd.apple.mpegurl"); 72 expectText("image/svg+xml"); 73 expectText("text/x-coffeescript"); 74 75 expectNotText("image/jpeg"); 76 expectNotText("image/png"); 77 expectNotText("image/gif"); 78 expectNotText("font/woff"); 79 expectNotText("video/mpeg"); 80 expectNotText("audio/ogg"); 81 expectNotText("application/pdf"); 82 83 return true; 84 } 85 }) 86 54 87 suite.runTestCasesAndFinish(); 55 88 } -
trunk/Source/WebCore/ChangeLog
r239342 r239343 1 2018-12-18 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: m3u8 content not shown, it should be text 4 https://bugs.webkit.org/show_bug.cgi?id=192731 5 <rdar://problem/46747728> 6 7 Reviewed by Devin Rousso. 8 9 * inspector/NetworkResourcesData.cpp: 10 (WebCore::NetworkResourcesData::setResourceContent): 11 Don't clobber data if setting empty content on a resource that has content. 12 13 * inspector/agents/InspectorNetworkAgent.cpp: 14 (WebCore::InspectorNetworkAgent::shouldTreatAsText): 15 Additional non-"text/" mime types that can be treated as text. 16 17 * platform/MIMETypeRegistry.cpp: 18 (WebCore::MIMETypeRegistry::isTextMediaPlaylistMIMEType): 19 * platform/MIMETypeRegistry.h: 20 Detect media playlist mime types that are text (m3u8/m3u). 21 1 22 2018-12-18 Daniel Bates <dabates@apple.com> 2 23 -
trunk/Source/WebCore/inspector/NetworkResourcesData.cpp
r238122 r239343 188 188 void NetworkResourcesData::setResourceContent(const String& requestId, const String& content, bool base64Encoded) 189 189 { 190 if (content.isNull()) 191 return; 192 190 193 ResourceData* resourceData = resourceDataForRequestId(requestId); 191 194 if (!resourceData) -
trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
r238771 r239343 979 979 || MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) 980 980 || MIMETypeRegistry::isSupportedJSONMIMEType(mimeType) 981 || MIMETypeRegistry::isXMLMIMEType(mimeType); 981 || MIMETypeRegistry::isXMLMIMEType(mimeType) 982 || MIMETypeRegistry::isTextMediaPlaylistMIMEType(mimeType); 982 983 } 983 984 -
trunk/Source/WebCore/platform/MIMETypeRegistry.cpp
r238015 r239343 498 498 || equalLettersIgnoringASCIICase(subtype, "ttf") 499 499 || equalLettersIgnoringASCIICase(subtype, "sfnt"); 500 } 501 502 bool MIMETypeRegistry::isTextMediaPlaylistMIMEType(const String& mimeType) 503 { 504 if (startsWithLettersIgnoringASCIICase(mimeType, "application/")) { 505 static const unsigned applicationLength = 12; 506 auto subtype = StringView { mimeType }.substring(applicationLength); 507 return equalLettersIgnoringASCIICase(subtype, "vnd.apple.mpegurl") 508 || equalLettersIgnoringASCIICase(subtype, "mpegurl") 509 || equalLettersIgnoringASCIICase(subtype, "x-mpegurl"); 510 } 511 512 if (startsWithLettersIgnoringASCIICase(mimeType, "audio/")) { 513 static const unsigned audioLength = 6; 514 auto subtype = StringView { mimeType }.substring(audioLength); 515 return equalLettersIgnoringASCIICase(subtype, "mpegurl") 516 || equalLettersIgnoringASCIICase(subtype, "x-mpegurl"); 517 } 518 519 return false; 500 520 } 501 521 -
trunk/Source/WebCore/platform/MIMETypeRegistry.h
r238015 r239343 63 63 // Check to see if a MIME type is suitable for being loaded as a font. 64 64 static bool isSupportedFontMIMEType(const String& mimeType); 65 66 // Check to see if a MIME type is a text media playlist type, such as an m3u8. 67 static bool isTextMediaPlaylistMIMEType(const String& mimeType); 65 68 66 69 // Check to see if a non-image MIME type is suitable for being loaded as a -
trunk/Source/WebInspectorUI/ChangeLog
r239312 r239343 1 2018-12-18 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: m3u8 content not shown, it should be text 4 https://bugs.webkit.org/show_bug.cgi?id=192731 5 <rdar://problem/46747728> 6 7 Reviewed by Devin Rousso. 8 9 * UserInterface/Base/MIMETypeUtilities.js: 10 (WI.shouldTreatMIMETypeAsText): 11 Support m3u8/m3u files as text. 12 1 13 2018-12-17 Devin Rousso <drousso@apple.com> 2 14 -
trunk/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js
r239037 r239343 316 316 return true; 317 317 318 // Various media text mime types. 319 let extension = WI.fileExtensionForMIMEType(mimeType); 320 if (extension === "m3u8" || extension === "m3u") 321 return true; 322 318 323 // Various script and JSON mime types. 324 if (extension === "js" || extension === "json") 325 return true; 319 326 if (mimeType.startsWith("application/")) 320 327 return mimeType.endsWith("script") || mimeType.endsWith("json"); -
trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js
r226153 r239343 113 113 114 114 expectThat(actual, message) 115 { 116 this._expect(TestHarness.ExpectationType.True, !!actual, message, actual); 117 } 118 119 expectTrue(actual, message) 115 120 { 116 121 this._expect(TestHarness.ExpectationType.True, !!actual, message, actual);
Note: See TracChangeset
for help on using the changeset viewer.