Bug 97547

Summary: Code inside FrameLoaderClient::canShowMIMEType() implementations can be shared among different WK ports
Product: WebKit Reporter: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Component: WebCore Misc.Assignee: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, cdumez, darin, gyuyoung.kim, hausmann, kenneth, mifenton, rakuco, rwlbuis, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
buildbot: commit-queue-
patch v2
none
patch v3 (do not put flags)
buildbot: commit-queue-
patch v4
none
patch v5 none

Mikhail Pozdnyakov
Reported 2012-09-25 03:25:45 PDT
Currently the code inside FrameLoaderClient::canShowMIMEType() implementations is pretty much similar among different WK ports: EFL, Qt, GTK, WinCe have following snippet inside FrameLoaderClient canShowMIMEType() function: MIMETypeRegistry::isSupportedImageMIMEType(type) || MIMETypeRegistry::isSupportedNonImageMIMEType(type) || MIMETypeRegistry::isSupportedMediaMIMEType(type) WK2 has similar logic inside WebKit::WebPageProxy::canShowMIMEType() if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) return true; if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) return true; if (mimeType.startsWith("text/", false)) return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType); Think it would be wise to have a new function inside MIMETypeRegistry, that would encapsulate this logic.
Attachments
patch (14.23 KB, patch)
2012-09-25 05:46 PDT, Mikhail Pozdnyakov
buildbot: commit-queue-
patch v2 (15.35 KB, patch)
2012-09-25 06:01 PDT, Mikhail Pozdnyakov
no flags
patch v3 (do not put flags) (14.88 KB, patch)
2012-09-27 01:57 PDT, Mikhail Pozdnyakov
buildbot: commit-queue-
patch v4 (15.11 KB, patch)
2012-09-27 02:12 PDT, Mikhail Pozdnyakov
no flags
patch v5 (15.14 KB, patch)
2012-09-27 05:34 PDT, Mikhail Pozdnyakov
no flags
Mikhail Pozdnyakov
Comment 1 2012-09-25 05:46:48 PDT
Build Bot
Comment 2 2012-09-25 05:52:08 PDT
Mikhail Pozdnyakov
Comment 3 2012-09-25 06:01:40 PDT
Created attachment 165594 [details] patch v2 Rebased. Build on MAC should be fixed.
Kenneth Rohde Christiansen
Comment 4 2012-09-25 06:08:51 PDT
Comment on attachment 165594 [details] patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=165594&action=review > Source/WebCore/platform/MIMETypeRegistry.cpp:582 > > +bool MIMETypeRegistry::isVisuallyRepresentableMIMEType(const String& mimeType) Isnt that like a really weird name. What if it contains only javascript?
Mikhail Pozdnyakov
Comment 5 2012-09-25 06:11:20 PDT
(In reply to comment #4) > (From update of attachment 165594 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=165594&action=review > > > Source/WebCore/platform/MIMETypeRegistry.cpp:582 > > > > +bool MIMETypeRegistry::isVisuallyRepresentableMIMEType(const String& mimeType) > > Isnt that like a really weird name. What if it contains only javascript? right. I need to find a better one..
Mikhail Pozdnyakov
Comment 6 2012-09-26 00:22:17 PDT
(In reply to comment #5) > (In reply to comment #4) > > (From update of attachment 165594 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=165594&action=review > > > > > Source/WebCore/platform/MIMETypeRegistry.cpp:582 > > > > > > +bool MIMETypeRegistry::isVisuallyRepresentableMIMEType(const String& mimeType) > > > > Isnt that like a really weird name. What if it contains only javascript? > > right. I need to find a better one.. How about 'isMIMETypeHandledByWebPage' ?
Benjamin Poulain
Comment 7 2012-09-26 11:25:38 PDT
Comment on attachment 165594 [details] patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=165594&action=review > Source/WebCore/WebCore.exp.in:422 > __ZN7WebCore16MIMETypeRegistry27getUnsupportedTextMIMETypesEv > __ZN7WebCore16MIMETypeRegistry27isSupportedNonImageMIMETypeERKN3WTF6StringE > __ZN7WebCore16MIMETypeRegistry29getSupportedNonImageMIMETypesEv > +__ZN7WebCore16MIMETypeRegistry31isVisuallyRepresentableMIMETypeERKN3WTF6StringE Are all the other exports still needed?
Mikhail Pozdnyakov
Comment 8 2012-09-27 01:53:00 PDT
(In reply to comment #7) > (From update of attachment 165594 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=165594&action=review > > > Source/WebCore/WebCore.exp.in:422 > > __ZN7WebCore16MIMETypeRegistry27getUnsupportedTextMIMETypesEv > > __ZN7WebCore16MIMETypeRegistry27isSupportedNonImageMIMETypeERKN3WTF6StringE > > __ZN7WebCore16MIMETypeRegistry29getSupportedNonImageMIMETypesEv > > +__ZN7WebCore16MIMETypeRegistry31isVisuallyRepresentableMIMETypeERKN3WTF6StringE > > Are all the other exports still needed? Looks MIMETypeRegistry::getUnsupportedTextMIMETypes does not need to be exported anymore.
Mikhail Pozdnyakov
Comment 9 2012-09-27 01:57:00 PDT
Created attachment 165953 [details] patch v3 (do not put flags) Having an IRC discussion with Kenneth came to conclusion that the already used "canShowMIMEType" looks like the most appropriate name for the new function. Do not require any flags as need to get mangled name for the new function from MAC bot first :)
Simon Hausmann
Comment 10 2012-09-27 02:01:37 PDT
Comment on attachment 165953 [details] patch v3 (do not put flags) Yay for removal of duplicated code!
Build Bot
Comment 11 2012-09-27 02:02:20 PDT
Comment on attachment 165953 [details] patch v3 (do not put flags) Attachment 165953 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14037732
Mikhail Pozdnyakov
Comment 12 2012-09-27 02:12:53 PDT
Created attachment 165955 [details] patch v4 Now should build on MAC. Thanks, bot.
Mikhail Pozdnyakov
Comment 13 2012-09-27 05:34:22 PDT
Created attachment 165980 [details] patch v5 Rebased.
Mikhail Pozdnyakov
Comment 14 2012-09-27 08:59:31 PDT
Could please anyone review?
Adam Barth
Comment 15 2012-09-28 11:03:14 PDT
Comment on attachment 165980 [details] patch v5 Looks great.
WebKit Review Bot
Comment 16 2012-09-28 11:16:20 PDT
Comment on attachment 165980 [details] patch v5 Clearing flags on attachment: 165980 Committed r129924: <http://trac.webkit.org/changeset/129924>
WebKit Review Bot
Comment 17 2012-09-28 11:16:25 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.