RESOLVED FIXED 34686
[Haiku] Improve MIME type data base implementation on Haiku
https://bugs.webkit.org/show_bug.cgi?id=34686
Summary [Haiku] Improve MIME type data base implementation on Haiku
Stephan Aßmus
Reported 2010-02-06 14:42:05 PST
Patch implements using the Haiku MIME type data base as a fall back for unknown file extensions. The hard-coded MIME types have been sorted to resolve more frequenly used extensions quicker.
Attachments
Patch makes MIMETypeRegistry fall back to use system data base on Haiku (3.14 KB, patch)
2010-02-06 14:44 PST, Stephan Aßmus
eric: review-
[Haiku] Fall back to the system MIME database, return correct string for unknown types. (3.16 KB, patch)
2010-04-11 14:35 PDT, Stephan Aßmus
levin: review-
[Haiku] Fall back to the system MIME database, return correct string for unknown types. (3.16 KB, patch)
2010-04-13 02:00 PDT, Stephan Aßmus
no flags
Stephan Aßmus
Comment 1 2010-02-06 14:44:47 PST
Created attachment 48299 [details] Patch makes MIMETypeRegistry fall back to use system data base on Haiku Patch against r54275.
Eric Seidel (no email)
Comment 2 2010-02-10 13:33:13 PST
Comment on attachment 48299 [details] Patch makes MIMETypeRegistry fall back to use system data base on Haiku The mime type lines used to be sorted alphabetically. Why change that? There is no performance benefit to your change. The CPU on my cellphone can execute a billion comparisons a second, so shortening the array walk by a few places is no perf savings. :)
Ryan Leavengood
Comment 3 2010-02-14 10:59:39 PST
Hi Eric, Would you accept this patch if the ordering/optimization of the list was changed back to how it was? Though I think you are being pretty strict here. Don't ports get some leeway in defining how their platform code works? Either way I think falling back to the Haiku MIME database is a very valid platform-specific feature we should make use of in our port. So I would hope you would accept a patch with those changes at least.
Stephan Aßmus
Comment 4 2010-04-11 14:35:04 PDT
Created attachment 53112 [details] [Haiku] Fall back to the system MIME database, return correct string for unknown types. Revised patch, also fixes string returned for unknown types, which other code relies on.
David Levin
Comment 5 2010-04-12 23:27:54 PDT
Comment on attachment 53112 [details] [Haiku] Fall back to the system MIME database, return correct string for unknown types. r- for struct name change (and the fact that I can't get you to change it on landing). > 2010-04-10 Adam Barth <abarth@webkit.org> > > Unreviewed. Rename m_forceSandboxFlags to m_forcedSandoxFlags, as > Index: WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp > -static const ExtensionMap extensionMap [] = { > +static const ExtensionMap sExtensionMap[] = { Please don't change the name of this struct. WebKit doesn't use this style of notation for static const arrays. > + // Try system mime database Please add a "." > + String fakeFileName("filename."); > + fakeFileName.append(str); > + > + BMimeType type; > + if (BMimeType::GuessMimeType(fakeFileName.utf8().data(), &type) == B_OK) Mild concern about passing untrusted data (derived from ext) to system api, but since it is a a null terminated string, this appears fine.
Stephan Aßmus
Comment 6 2010-04-13 02:00:00 PDT
Created attachment 53233 [details] [Haiku] Fall back to the system MIME database, return correct string for unknown types. Revised patch after review. Thanks! Somehow I was under the wrong impression that the style guide said this about static variables, but was obviously mistaken.
WebKit Commit Bot
Comment 7 2010-04-13 06:45:33 PDT
Comment on attachment 53233 [details] [Haiku] Fall back to the system MIME database, return correct string for unknown types. Clearing flags on attachment: 53233 Committed r57513: <http://trac.webkit.org/changeset/57513>
WebKit Commit Bot
Comment 8 2010-04-13 06:45:38 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.