RESOLVED FIXED 171077
Whitelist supported image MIME types
https://bugs.webkit.org/show_bug.cgi?id=171077
Summary Whitelist supported image MIME types
Said Abou-Hallawa
Reported 2017-04-20 14:31:48 PDT
This API should return the UTIs of the images instead of MIME types because some of UTIs do not have corresponding MIME types.
Attachments
Patch (15.20 KB, patch)
2017-04-20 14:36 PDT, Said Abou-Hallawa
no flags
Patch (13.60 KB, patch)
2017-04-20 14:56 PDT, Said Abou-Hallawa
no flags
Archive of layout-test-results from ews116 for mac-elcapitan (1.53 MB, application/zip)
2017-04-20 15:44 PDT, Build Bot
no flags
Archive of layout-test-results from ews103 for mac-elcapitan (723.91 KB, application/zip)
2017-04-20 15:45 PDT, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 (1.09 MB, application/zip)
2017-04-20 15:51 PDT, Build Bot
no flags
Archive of layout-test-results from ews125 for ios-simulator-wk2 (57.76 MB, application/zip)
2017-04-20 16:20 PDT, Build Bot
no flags
Patch (13.58 KB, patch)
2017-04-20 16:52 PDT, Said Abou-Hallawa
no flags
Patch (14.06 KB, patch)
2017-04-20 18:52 PDT, Said Abou-Hallawa
no flags
Archive of layout-test-results from ews122 for ios-simulator-wk2 (762.08 KB, application/zip)
2017-04-20 22:07 PDT, Build Bot
no flags
Patch (14.18 KB, patch)
2017-04-21 08:55 PDT, Said Abou-Hallawa
no flags
Patch (13.67 KB, patch)
2017-04-21 11:20 PDT, Said Abou-Hallawa
no flags
Patch (13.12 KB, patch)
2017-04-21 12:06 PDT, Said Abou-Hallawa
no flags
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 (1.83 MB, application/zip)
2017-04-21 13:01 PDT, Build Bot
no flags
Archive of layout-test-results from ews112 for mac-elcapitan (1.86 MB, application/zip)
2017-04-21 13:04 PDT, Build Bot
no flags
Archive of layout-test-results from ews102 for mac-elcapitan (1.04 MB, application/zip)
2017-04-21 13:05 PDT, Build Bot
no flags
Archive of layout-test-results from ews123 for ios-simulator-wk2 (53.97 MB, application/zip)
2017-04-21 13:59 PDT, Build Bot
no flags
Patch (12.54 KB, patch)
2017-04-21 14:26 PDT, Said Abou-Hallawa
no flags
Patch (12.52 KB, patch)
2017-04-21 15:14 PDT, Said Abou-Hallawa
no flags
Patch (11.58 KB, patch)
2017-04-21 16:05 PDT, Said Abou-Hallawa
no flags
Patch (11.52 KB, patch)
2017-04-21 16:29 PDT, Said Abou-Hallawa
no flags
Patch (11.48 KB, patch)
2017-04-21 16:39 PDT, Said Abou-Hallawa
no flags
Patch (12.01 KB, patch)
2017-04-21 18:12 PDT, Said Abou-Hallawa
no flags
Patch (12.01 KB, patch)
2017-04-24 14:46 PDT, Said Abou-Hallawa
no flags
Patch (12.11 KB, patch)
2017-04-24 16:32 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2017-04-20 14:36:35 PDT
Said Abou-Hallawa
Comment 2 2017-04-20 14:56:21 PDT
Radar WebKit Bug Importer
Comment 3 2017-04-20 15:11:10 PDT
Build Bot
Comment 4 2017-04-20 15:44:38 PDT
Comment on attachment 307641 [details] Patch Attachment 307641 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/3572422 Number of test failures exceeded the failure limit.
Build Bot
Comment 5 2017-04-20 15:44:39 PDT
Created attachment 307650 [details] Archive of layout-test-results from ews116 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 6 2017-04-20 15:45:55 PDT
Comment on attachment 307641 [details] Patch Attachment 307641 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/3572470 Number of test failures exceeded the failure limit.
Build Bot
Comment 7 2017-04-20 15:45:56 PDT
Created attachment 307651 [details] Archive of layout-test-results from ews103 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 8 2017-04-20 15:51:22 PDT
Comment on attachment 307641 [details] Patch Attachment 307641 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/3572490 Number of test failures exceeded the failure limit.
Build Bot
Comment 9 2017-04-20 15:51:23 PDT
Created attachment 307653 [details] Archive of layout-test-results from ews107 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Build Bot
Comment 10 2017-04-20 16:20:05 PDT
Comment on attachment 307641 [details] Patch Attachment 307641 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/3572469 Number of test failures exceeded the failure limit.
Build Bot
Comment 11 2017-04-20 16:20:11 PDT
Created attachment 307657 [details] Archive of layout-test-results from ews125 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Said Abou-Hallawa
Comment 12 2017-04-20 16:52:48 PDT
Said Abou-Hallawa
Comment 13 2017-04-20 18:52:22 PDT
Build Bot
Comment 14 2017-04-20 22:07:26 PDT
Comment on attachment 307674 [details] Patch Attachment 307674 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/3573990 New failing tests: http/tests/local/blob/send-hybrid-blob-using-open-panel.html
Build Bot
Comment 15 2017-04-20 22:07:27 PDT
Created attachment 307691 [details] Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Simon Fraser (smfr)
Comment 16 2017-04-21 03:58:48 PDT
Comment on attachment 307674 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307674&action=review > Source/WebCore/ChangeLog:3 > + Add an API to return a list of the WebKit supported image formats I don' think this is API, right? It's not exposed through WKWebView?
Said Abou-Hallawa
Comment 17 2017-04-21 08:55:21 PDT
Tim Horton
Comment 18 2017-04-21 10:58:02 PDT
Comment on attachment 307734 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307734&action=review > Source/WebCore/platform/ImageTypeIdentifierRegistry.cpp:27 > +#include "ImageTypeIdentifierRegistry.h" I think we should make this generic and specific, and similar to MIMETypeRegistry: "UTIRegistry", so that in the future when we want to do the same for e.g. video or audio or document types we can, without renaming! Also, it should probably be USE(CG)-specific, UTIs are an Apple concept. > Source/WebCore/platform/ImageTypeIdentifierRegistry.cpp:48 > + static NeverDestroyed<HashSet<String>> unsupportedTypetypeIdentifiers(std::initializer_list<String> { "unsupportedTypetypeIdentifiers" -- type type? > Source/WebCore/platform/ImageTypeIdentifierRegistry.cpp:88 > + return unsupportedTypetypeIdentifiers.get().contains(typeIdentifier); This looks like a blacklist to me, not a whitelist; what's to guarantee that new versions of CG don't add support for new image formats that we don't want to expose to the web?
Said Abou-Hallawa
Comment 19 2017-04-21 11:20:40 PDT
Said Abou-Hallawa
Comment 20 2017-04-21 12:06:34 PDT
Said Abou-Hallawa
Comment 21 2017-04-21 12:17:27 PDT
Comment on attachment 307734 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307734&action=review >> Source/WebCore/platform/ImageTypeIdentifierRegistry.cpp:27 >> +#include "ImageTypeIdentifierRegistry.h" > > I think we should make this generic and specific, and similar to MIMETypeRegistry: "UTIRegistry", so that in the future when we want to do the same for e.g. video or audio or document types we can, without renaming! > > Also, it should probably be USE(CG)-specific, UTIs are an Apple concept. The name is fixed. Regarding making the file USE(CG)-specific, I do not think I can do that. Some of the supported image formats don't have corresponding MIME types, so CG has to use the UTI's. For none-CG platforms I made them return a UTI, please see the https://bugs.webkit.org/show_bug.cgi?id=171042. And the plan is use isSupportedImageUTI() on all platforms. >> Source/WebCore/platform/ImageTypeIdentifierRegistry.cpp:48 >> + static NeverDestroyed<HashSet<String>> unsupportedTypetypeIdentifiers(std::initializer_list<String> { > > "unsupportedTypetypeIdentifiers" -- type type? Fixed. >> Source/WebCore/platform/ImageTypeIdentifierRegistry.cpp:88 >> + return unsupportedTypetypeIdentifiers.get().contains(typeIdentifier); > > This looks like a blacklist to me, not a whitelist; what's to guarantee that new versions of CG don't add support for new image formats that we don't want to expose to the web? Fixed.
Build Bot
Comment 22 2017-04-21 13:01:39 PDT
Comment on attachment 307768 [details] Patch Attachment 307768 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/3577828 Number of test failures exceeded the failure limit.
Build Bot
Comment 23 2017-04-21 13:01:40 PDT
Created attachment 307778 [details] Archive of layout-test-results from ews107 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Build Bot
Comment 24 2017-04-21 13:04:56 PDT
Comment on attachment 307768 [details] Patch Attachment 307768 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/3577819 Number of test failures exceeded the failure limit.
Build Bot
Comment 25 2017-04-21 13:04:58 PDT
Created attachment 307780 [details] Archive of layout-test-results from ews112 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 26 2017-04-21 13:05:09 PDT
Comment on attachment 307768 [details] Patch Attachment 307768 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/3577851 Number of test failures exceeded the failure limit.
Build Bot
Comment 27 2017-04-21 13:05:11 PDT
Created attachment 307781 [details] Archive of layout-test-results from ews102 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 28 2017-04-21 13:59:32 PDT
Comment on attachment 307768 [details] Patch Attachment 307768 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/3578013 Number of test failures exceeded the failure limit.
Build Bot
Comment 29 2017-04-21 13:59:34 PDT
Created attachment 307794 [details] Archive of layout-test-results from ews123 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews123 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Said Abou-Hallawa
Comment 30 2017-04-21 14:26:49 PDT
Said Abou-Hallawa
Comment 31 2017-04-21 15:14:47 PDT
Tim Horton
Comment 32 2017-04-21 15:21:03 PDT
Comment on attachment 307815 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307815&action=review > Source/WebCore/platform/UTIRegistry.cpp:46 > +static void initializeWhitelistImageUTIs(HashSet<String>& whitelistImageUTIs) If this returns the HashSet instead, then you can... > Source/WebCore/platform/UTIRegistry.cpp:88 > + static NeverDestroyed<HashSet<String>> s_whitelistImageUTIs; ... just do an = initializeWhitelistImageUTIs(); here... > Source/WebCore/platform/UTIRegistry.cpp:91 > + if (!s_whitelistImageUTIs.get().size()) > + initializeWhitelistImageUTIs(s_whitelistImageUTIs.get()); allowing you to get rid of this entirely.
Tim Horton
Comment 33 2017-04-21 15:23:16 PDT
Comment on attachment 307815 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307815&action=review > Source/WebCore/platform/UTIRegistry.cpp:81 > + // Assume that all implementations at least support the following standard > + // image types: > + whitelistImageUTIs = std::initializer_list<String> { > + "public.jpeg", > + "public.png", > + "com.compuserve.gif", > + "com.microsoft.bmp", > + "com.microsoft.ico", > +#if USE(WEBP) > + "com.google.webp" > +#endif This is only called from USE(CG) code, so I think you should just delete this and make the whole thing guarded by USE(CG). > Source/WebCore/platform/UTIRegistry.h:33 > +HashSet<String>& whitelistImageUTIs(); allowedImageUTIs(), I think.
Said Abou-Hallawa
Comment 34 2017-04-21 16:05:21 PDT
Tim Horton
Comment 35 2017-04-21 16:09:14 PDT
Comment on attachment 307822 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307822&action=review > Source/WebCore/ChangeLog:14 > + * platform/graphics/cg/UTIRegistryCG.cpp: Added. Not likely that there will ever be a non-CG version of this, so you could just leave the CG off (usually we add the suffix if it's the CG parts of a cross-platform class).
Said Abou-Hallawa
Comment 36 2017-04-21 16:29:38 PDT
Said Abou-Hallawa
Comment 37 2017-04-21 16:39:26 PDT
Said Abou-Hallawa
Comment 38 2017-04-21 18:12:47 PDT
Said Abou-Hallawa
Comment 39 2017-04-24 14:46:44 PDT
Said Abou-Hallawa
Comment 40 2017-04-24 14:47:46 PDT
Comment on attachment 307857 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307857&action=review > Source/WebCore/ChangeLog:15 > + * platform/graphics/cg/UTIRegistryCG.cpp: Added. This entry is wrong. The file UTIRegistryCG.cpp was renamed to UTIRegistry.cpp. I will submit an update.
Tim Horton
Comment 41 2017-04-24 15:58:14 PDT
Comment on attachment 308013 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=308013&action=review > Source/WebCore/ChangeLog:9 > + WebKit should support only a whitelist image formats. WebKit will not support new > + image formats till they get broader industry adoption. "should support only whitelisted image formats". Also, this isn't a generic WebKit policy (obviously), this is about CG ports. I think you should drop the second sentence, too, since even that isn't a guarantee of support, of course. Maybe write something helpful about the code change you made instead?
Said Abou-Hallawa
Comment 42 2017-04-24 16:32:05 PDT
WebKit Commit Bot
Comment 43 2017-04-24 17:14:37 PDT
Comment on attachment 308022 [details] Patch Clearing flags on attachment: 308022 Committed r215706: <http://trac.webkit.org/changeset/215706>
WebKit Commit Bot
Comment 44 2017-04-24 17:14:39 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.