RESOLVED FIXED 188290
Add a test for using SafeBrowsing
https://bugs.webkit.org/show_bug.cgi?id=188290
Summary Add a test for using SafeBrowsing
Alex Christensen
Reported 2018-08-02 17:16:59 PDT
Add SPI to test safe browsing
Attachments
Patch (18.32 KB, patch)
2018-08-02 17:32 PDT, Alex Christensen
no flags
Archive of layout-test-results from ews200 for win-future (12.90 MB, application/zip)
2018-08-03 06:31 PDT, EWS Watchlist
no flags
Patch (18.32 KB, patch)
2018-08-03 10:19 PDT, Alex Christensen
no flags
Patch (17.43 KB, patch)
2018-08-03 11:05 PDT, Alex Christensen
no flags
Patch (10.10 KB, patch)
2018-08-07 15:43 PDT, Alex Christensen
cdumez: review+
Alex Christensen
Comment 1 2018-08-02 17:32:14 PDT
EWS Watchlist
Comment 2 2018-08-03 06:31:09 PDT
Comment on attachment 346437 [details] Patch Attachment 346437 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/8749373 New failing tests: http/tests/security/video-poster-cross-origin-crash2.html
EWS Watchlist
Comment 3 2018-08-03 06:31:20 PDT
Created attachment 346476 [details] Archive of layout-test-results from ews200 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews200 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Alex Christensen
Comment 4 2018-08-03 10:19:24 PDT
Alex Christensen
Comment 5 2018-08-03 11:05:58 PDT
mitz
Comment 6 2018-08-03 15:55:24 PDT
Comment on attachment 346506 [details] Patch Have you tried testing by using the Objective-C runtime to replace [SSBLookupContext sharedLookupContext] with an object of your choosing at runtime? Seems less invasive and doesn’t require any changes to production code.
Tim Horton
Comment 7 2018-08-03 15:55:42 PDT
Comment on attachment 346506 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=346506&action=review > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:5875 > + handler.get()(url, BlockPtr<void(BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler)] (BOOL phishing) mutable { should this be "isUnsafe" or something? > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:5876 > + completionHandler({{ "MockSafeBrowsingProvider"_s, !!phishing, false, false, false }}); why the !!
Alex Christensen
Comment 8 2018-08-03 15:57:55 PDT
(In reply to mitz from comment #6) > Comment on attachment 346506 [details] > Patch > > Have you tried testing by using the Objective-C runtime to replace > [SSBLookupContext sharedLookupContext] with an object of your choosing at > runtime? Seems less invasive and doesn’t require any changes to production > code. That's a great idea. Then I wouldn't need any of this! (In reply to Tim Horton from comment #7) > Comment on attachment 346506 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=346506&action=review > > > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:5875 > > + handler.get()(url, BlockPtr<void(BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler)] (BOOL phishing) mutable { > > should this be "isUnsafe" or something? isPhishing > > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:5876 > > + completionHandler({{ "MockSafeBrowsingProvider"_s, !!phishing, false, false, false }}); > > why the !! This is needed to convert BOOL to bool.
Alex Christensen
Comment 9 2018-08-07 15:43:19 PDT
Chris Dumez
Comment 10 2018-08-07 16:11:51 PDT
Comment on attachment 346739 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=346739&action=review r=me with comment. > Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:136 > + static NeverDestroyed<RetainPtr<TestLookupContext>> context; Why NeverDestroyed with a RetainPtr? Why not the following? static TestLookupContext *context = [[TestLookupContext alloc] init]; return context;
Alex Christensen
Comment 11 2018-08-07 16:18:25 PDT
Radar WebKit Bug Importer
Comment 12 2018-08-07 16:19:40 PDT
Note You need to log in before you can comment on or make changes to this bug.