Bug 49497

Summary: getMIMEType(s)ForExtension should consult system mapping
Product: WebKit Reporter: Eric Carlson <eric.carlson>
Component: MediaAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, webkit-ews
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Proposed patch
sullivan: review-
Updated patch
none
Updated patch (and it compiles!) sullivan: review+

Eric Carlson
Reported 2010-11-13 12:23:15 PST
MIMETypeRegistry::getMediaMIMETypeForExtension and MIMETypeRegistry::getMediaMIMETypesForExtension only look in the hard coded mapping table, but should also include the type returned by the system specific function MIMETypeRegistry::getMIMETypeForExtension.
Attachments
Proposed patch (1.98 KB, patch)
2010-11-13 12:39 PST, Eric Carlson
sullivan: review-
Updated patch (2.93 KB, patch)
2010-11-15 21:53 PST, Eric Carlson
no flags
Updated patch (and it compiles!) (2.36 KB, patch)
2010-11-15 22:07 PST, Eric Carlson
sullivan: review+
Eric Carlson
Comment 1 2010-11-13 12:39:14 PST
Created attachment 73831 [details] Proposed patch
John Sullivan
Comment 2 2010-11-15 10:42:22 PST
Comment on attachment 73831 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=73831&action=review If the system-specific registry has priority, shouldn't it be consulted first in getMediaMIMETypesForExtension()? > WebCore/platform/MIMETypeRegistry.cpp:364 > + typeList.append(*mediaMIMETypeMap().get(ext)); Would it be faster to put the result of mediaMIMETypeMap().get() in a local variable and then test it for null, rather than calling both contains() and get()? (I realize this pattern already existed in this function.)
Darin Adler
Comment 3 2010-11-15 13:11:23 PST
Comment on attachment 73831 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=73831&action=review > WebCore/platform/MIMETypeRegistry.cpp:349 > + String type = MIMETypeRegistry::getMIMETypeForExtension(ext); No need to explicitly qualify with MIMETypeRegistry since we are already in a function member of MIMETypeRegistry. > WebCore/platform/MIMETypeRegistry.cpp:366 > + String type = MIMETypeRegistry::getMIMETypeForExtension(ext); No need to explicitly qualify with MIMETypeRegistry since we are already in a function member of MIMETypeRegistry.
Eric Carlson
Comment 4 2010-11-15 16:49:23 PST
(In reply to comment #2) > (From update of attachment 73831 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=73831&action=review > > If the system-specific registry has priority, shouldn't it be consulted first in > getMediaMIMETypesForExtension()? > The first type in the vector returned by mediaMIMETypeMap() is the system-specific type (if there is one). I will update the patch to return immediately if the type map entry exists. > > WebCore/platform/MIMETypeRegistry.cpp:364 > > + typeList.append(*mediaMIMETypeMap().get(ext)); > > Would it be faster to put the result of mediaMIMETypeMap().get() in a local variable and then test > it for null, rather than calling both contains() and get()? (I realize this pattern already existed in > this function.) > Good point, thanks. (In reply to comment #3) > (From update of attachment 73831 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=73831&action=review > > > WebCore/platform/MIMETypeRegistry.cpp:349 > > + String type = MIMETypeRegistry::getMIMETypeForExtension(ext); > > No need to explicitly qualify with MIMETypeRegistry since we are already in a function member > of MIMETypeRegistry. > > > WebCore/platform/MIMETypeRegistry.cpp:366 > > + String type = MIMETypeRegistry::getMIMETypeForExtension(ext); > > No need to explicitly qualify with MIMETypeRegistry since we are already in a function member > of MIMETypeRegistry. > Indeed, thanks!
Eric Carlson
Comment 5 2010-11-15 21:53:29 PST
Created attachment 73961 [details] Updated patch
Eric Seidel (no email)
Comment 6 2010-11-15 21:58:01 PST
Early Warning System Bot
Comment 7 2010-11-15 22:04:12 PST
Eric Carlson
Comment 8 2010-11-15 22:07:22 PST
Created attachment 73962 [details] Updated patch (and it compiles!)
Eric Carlson
Comment 9 2010-11-16 10:47:12 PST
Note You need to log in before you can comment on or make changes to this bug.