Add SPI to test safe browsing
Created attachment 346437 [details] Patch
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
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
Created attachment 346501 [details] Patch
Created attachment 346506 [details] Patch
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.
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 !!
(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.
Created attachment 346739 [details] Patch
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;
http://trac.webkit.org/r234676
<rdar://problem/43025805>