RESOLVED FIXED 197641
Add a release assertion that Functions can only be constructed from non-null CompletionHandlers
https://bugs.webkit.org/show_bug.cgi?id=197641
Summary Add a release assertion that Functions can only be constructed from non-null ...
Alex Christensen
Reported 2019-05-06 17:58:42 PDT
Add a release assertion that Functions can only be constructed from non-null CompletionHandlers
Attachments
Patch (6.13 KB, patch)
2019-05-06 18:02 PDT, Alex Christensen
cdumez: review+
Archive of layout-test-results from ews210 for win-future (13.60 MB, application/zip)
2019-05-07 07:09 PDT, EWS Watchlist
no flags
Alex Christensen
Comment 1 2019-05-06 18:02:52 PDT
EWS Watchlist
Comment 2 2019-05-07 07:09:48 PDT
Comment on attachment 369213 [details] Patch Attachment 369213 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/12122984 New failing tests: security/contentSecurityPolicy/video-with-file-url-allowed-by-media-src-star.html
EWS Watchlist
Comment 3 2019-05-07 07:09:50 PDT
Created attachment 369280 [details] Archive of layout-test-results from ews210 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews210 Port: win-future Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Chris Dumez
Comment 4 2019-05-07 08:44:51 PDT
Comment on attachment 369213 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=369213&action=review > Source/WTF/wtf/Function.h:33 > +namespace Detail { Why is this better than a private class in the Function scope? I preferred the old way as it was hiding the implementation detail. Now it's public and anyone could use it directly in theory.
Alex Christensen
Comment 5 2019-05-07 11:48:15 PDT
Private classes inside template classes seem to be unspecializable. I only get these: error: cannot specialize a member of an unspecialized template This is what Detail namespaces are for.
Chris Dumez
Comment 6 2019-05-07 11:56:37 PDT
Comment on attachment 369213 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=369213&action=review > Source/WTF/wtf/CompletionHandler.h:68 > +template<typename Out, typename... In> Should we add a FIXME to indicate this is temporary? I don't this this would stay a RELEASE_ASSERT() forever and it seems like a lot of extra code for a debug ASSERT().
Alex Christensen
Comment 7 2019-05-07 12:15:17 PDT
I'm not convinced this is temporary. We should always be unable to make a non-null Function that when called will always dereference null. Also, we could use this same technique to make a CallableWrapperStorage class that is usually a unique_ptr but is just a CompletionHandler for the Function-wrapping-CompletionHandler case. We should also make Function more const correct by making operator() const if the lambda is not mutable and non-const for mutable lambdas. There's work to be done here.
Alex Christensen
Comment 8 2019-05-07 12:54:13 PDT
Radar WebKit Bug Importer
Comment 9 2019-05-07 12:55:29 PDT
Note You need to log in before you can comment on or make changes to this bug.