Bug 176731 - Web Inspector: Cleanup and test MIMETypeUtilities
Summary: Web Inspector: Cleanup and test MIMETypeUtilities
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-11 14:07 PDT by Joseph Pecoraro
Modified: 2017-09-27 12:34 PDT (History)
5 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (11.03 KB, patch)
2017-09-11 14:09 PDT, Joseph Pecoraro
mattbaker: review+
Details | Formatted Diff | Diff
[PATCH] For Landing (11.38 KB, patch)
2017-09-11 15:45 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2017-09-11 14:07:28 PDT
Cleanup and test MIMETypeUtilities

• fileExtensionForURL ending in "script.min.js" produces ".min.js" expected ".js"
• fileExtensionForMIMEType for "application/vnd.api+json" produces `null` expected "json"
Comment 1 Joseph Pecoraro 2017-09-11 14:09:18 PDT
Created attachment 320472 [details]
[PATCH] Proposed Fix
Comment 2 Matt Baker 2017-09-11 15:05:21 PDT
Comment on attachment 320472 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=320472&action=review

r=me

> LayoutTests/inspector/unit-tests/mimetype-utilities.html:24
> +            InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/script.min.js"), "js", `File extension for "script.min.js" should be "js".`);

Should there also be a test for filenames with a trailing period? I know it's odd but AFAIK it is allowed (on UNIX and Windows at least).

Also, WI.fileExtensionForURL("https://example.com/foo.") returns "" instead of null. This should probably return null for consistency
Comment 3 Joseph Pecoraro 2017-09-11 15:45:40 PDT
Created attachment 320491 [details]
[PATCH] For Landing
Comment 4 Joseph Pecoraro 2017-09-11 15:46:07 PDT
> Should there also be a test for filenames with a trailing period? I know
> it's odd but AFAIK it is allowed (on UNIX and Windows at least).
> 
> Also, WI.fileExtensionForURL("https://example.com/foo.") returns "" instead
> of null. This should probably return null for consistency

Sounds good. Added.
Comment 5 WebKit Commit Bot 2017-09-11 16:16:10 PDT
Comment on attachment 320491 [details]
[PATCH] For Landing

Clearing flags on attachment: 320491

Committed r221891: <http://trac.webkit.org/changeset/221891>
Comment 6 Radar WebKit Bug Importer 2017-09-27 12:34:33 PDT
<rdar://problem/34693513>