Bug 175779 - Add ObjC SPI corresponding to WKPageLoaderClient's webGLLoadPolicy and resolveWebGLLoadPolicy
Summary: Add ObjC SPI corresponding to WKPageLoaderClient's webGLLoadPolicy and resolv...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-08-21 12:22 PDT by Alex Christensen
Modified: 2017-09-27 12:56 PDT (History)
10 users (show)

See Also:


Attachments
Patch (33.29 KB, patch)
2017-08-21 12:26 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (34.04 KB, patch)
2017-08-21 14:22 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (34.01 KB, patch)
2017-08-31 18:43 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2017-08-21 12:22:45 PDT
Add ObjC SPI corresponding to WKPageLoaderClient's webGLLoadPolicy and resolveWebGLLoadPolicy
Comment 1 Alex Christensen 2017-08-21 12:26:21 PDT
Created attachment 318659 [details]
Patch
Comment 2 mitz 2017-08-21 13:58:33 PDT
Comment on attachment 318659 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318659&action=review

> Source/WebKit/UIProcess/Cocoa/NavigationState.mm:324
> +void NavigationState::NavigationClient::webGLLoadPolicy(WebPageProxy&, const WebCore::URL& url, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const
> +{
> +    if (!m_navigationState.m_navigationDelegateMethods.webViewWebGLLoadPolicyForURL)
> +        completionHandler(WebGLAllowCreation);
> +
> +    [(id <WKNavigationDelegatePrivate>)m_navigationState.m_navigationDelegate _webView:m_navigationState.m_webView webGLLoadPolicyForURL:(NSURL *)url decisionHandler:BlockPtr<void(_WKWebGLLoadPolicy)>::fromCallable([completionHandler = WTFMove(completionHandler)](_WKWebGLLoadPolicy policy) {
> +        completionHandler(toWebCoreWebGLLoadPolicy(policy));
> +    }).get()];
> +}
> +
> +void NavigationState::NavigationClient::resolveWebGLLoadPolicy(WebPageProxy&, const WebCore::URL& url, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const
> +{
> +    if (!m_navigationState.m_navigationDelegateMethods.webViewResolveWebGLLoadPolicyForURL)
> +        completionHandler(WebGLAllowCreation);
> +    
> +    [(id <WKNavigationDelegatePrivate>)m_navigationState.m_navigationDelegate _webView:m_navigationState.m_webView resolveWebGLLoadPolicyForURL:(NSURL *)url decisionHandler:BlockPtr<void(_WKWebGLLoadPolicy)>::fromCallable([completionHandler = WTFMove(completionHandler)](_WKWebGLLoadPolicy policy) {
> +        completionHandler(toWebCoreWebGLLoadPolicy(policy));
> +    }).get()];
> +}

Might be good to use a CompletionHandlerCallChecker in each of these functions.
Comment 3 Alex Christensen 2017-08-21 14:22:53 PDT
Created attachment 318670 [details]
Patch
Comment 4 Tim Horton 2017-08-31 17:42:28 PDT
Comment on attachment 318670 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318670&action=review

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebGLPolicy.mm:100
> +    return [[a absoluteString] isEqualToString:[b absoluteString]];

Why not NSURL equality?
Comment 5 WebKit Commit Bot 2017-08-31 18:00:13 PDT
Comment on attachment 318670 [details]
Patch

Rejecting attachment 318670 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-02', 'apply-attachment', '--no-update', '--non-interactive', 318670, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
.xcodeproj/project.pbxproj
Hunk #1 FAILED at 231.
Hunk #2 FAILED at 1302.
Hunk #3 succeeded at 1972 (offset 23 lines).
Hunk #4 succeeded at 3362 (offset 32 lines).
2 out of 4 hunks FAILED -- saving rejects to file Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj.rej
patching file Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebGLPolicy.mm

Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Tim Horton']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Full output: http://webkit-queues.webkit.org/results/4420648
Comment 6 Alex Christensen 2017-08-31 18:43:39 PDT
Created attachment 319561 [details]
Patch
Comment 7 Alex Christensen 2017-08-31 18:46:40 PDT
http://trac.webkit.org/r221465
Comment 8 Ryan Haddad 2017-09-01 08:52:29 PDT
The API test added with this change is failing on iOS simulator. Should it be disabled there? 
https://build.webkit.org/builders/Apple%20iOS%2010%20Simulator%20Release%20WK2%20(Tests)/builds/4026
Comment 9 Alex Christensen 2017-09-01 10:58:22 PDT
Fixing in https://bugs.webkit.org/show_bug.cgi?id=176233
If EWS ran API tests, this never would've been an issue.
Comment 10 Radar WebKit Bug Importer 2017-09-27 12:56:21 PDT
<rdar://problem/34694350>