Title: [222322] trunk
- Revision
- 222322
- Author
- [email protected]
- Date
- 2017-09-21 09:41:11 -0700 (Thu, 21 Sep 2017)
Log Message
REGRESSION(r221465) WKWebViews without WebGL delegate callbacks crash when WebGL contexts are created
https://bugs.webkit.org/show_bug.cgi?id=177306
<rdar://problem/34351988>
Reviewed by Chris Dumez.
Source/WebKit:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::webGLLoadPolicy const):
(WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const):
I forgot to early return after calling the default completion handler if there's no delegate selector.
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm:
(-[WebGLTestDelegate webView:startURLSchemeTask:]):
(-[DelegateWithoutWebGL webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (222321 => 222322)
--- trunk/Source/WebKit/ChangeLog 2017-09-21 16:28:35 UTC (rev 222321)
+++ trunk/Source/WebKit/ChangeLog 2017-09-21 16:41:11 UTC (rev 222322)
@@ -1,3 +1,16 @@
+2017-09-21 Alex Christensen <[email protected]>
+
+ REGRESSION(r221465) WKWebViews without WebGL delegate callbacks crash when WebGL contexts are created
+ https://bugs.webkit.org/show_bug.cgi?id=177306
+ <rdar://problem/34351988>
+
+ Reviewed by Chris Dumez.
+
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const):
+ (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const):
+ I forgot to early return after calling the default completion handler if there's no delegate selector.
+
2017-09-21 Chris Dumez <[email protected]>
Unreviewed, temporarily disable assertion added in r222308 while I investigate.
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (222321 => 222322)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2017-09-21 16:28:35 UTC (rev 222321)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2017-09-21 16:41:11 UTC (rev 222322)
@@ -307,8 +307,10 @@
void NavigationState::NavigationClient::webGLLoadPolicy(WebPageProxy&, const WebCore::URL& url, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const
{
- if (!m_navigationState.m_navigationDelegateMethods.webViewWebGLLoadPolicyForURL)
+ if (!m_navigationState.m_navigationDelegateMethods.webViewWebGLLoadPolicyForURL) {
completionHandler(WebGLAllowCreation);
+ return;
+ }
auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
Ref<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(_webView:webGLLoadPolicyForURL:decisionHandler:));
@@ -322,8 +324,10 @@
void NavigationState::NavigationClient::resolveWebGLLoadPolicy(WebPageProxy&, const WebCore::URL& url, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const
{
- if (!m_navigationState.m_navigationDelegateMethods.webViewResolveWebGLLoadPolicyForURL)
+ if (!m_navigationState.m_navigationDelegateMethods.webViewResolveWebGLLoadPolicyForURL) {
completionHandler(WebGLAllowCreation);
+ return;
+ }
auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
Ref<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(_webView:resolveWebGLLoadPolicyForURL:decisionHandler:));
Modified: trunk/Tools/ChangeLog (222321 => 222322)
--- trunk/Tools/ChangeLog 2017-09-21 16:28:35 UTC (rev 222321)
+++ trunk/Tools/ChangeLog 2017-09-21 16:41:11 UTC (rev 222322)
@@ -1,3 +1,16 @@
+2017-09-21 Alex Christensen <[email protected]>
+
+ REGRESSION(r221465) WKWebViews without WebGL delegate callbacks crash when WebGL contexts are created
+ https://bugs.webkit.org/show_bug.cgi?id=177306
+ <rdar://problem/34351988>
+
+ Reviewed by Chris Dumez.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm:
+ (-[WebGLTestDelegate webView:startURLSchemeTask:]):
+ (-[DelegateWithoutWebGL webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
+ (TEST):
+
2017-09-20 Joseph Pecoraro <[email protected]>
Update test262 tests
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm (222321 => 222322)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm 2017-09-21 16:28:35 UTC (rev 222321)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm 2017-09-21 16:41:11 UTC (rev 222322)
@@ -43,6 +43,20 @@
static bool testComplete { false };
static RetainPtr<NSURL> htmlURL;
+static NSString *data = ""
+ "var canvas = document.createElement('canvas');"
+ "var context = canvas.getContext('webgl');"
+ "if (context) {"
+ "var framebuffer = context.createFramebuffer();"
+ "var status = context.checkFramebufferStatus(context.FRAMEBUFFER);"
+ "if (status == context.FRAMEBUFFER_UNSUPPORTED)"
+ "alert('doing stuff with webgl context failed');"
+ "else if (status == context.FRAMEBUFFER_COMPLETE)"
+ "alert('doing stuff with webgl context succeeded');"
+ "else alert('unexpected status');"
+ "} else alert('webgl context creation failed');"
+"</script>";
+
@interface WebGLTestDelegate : NSObject <WKNavigationDelegatePrivate, WKUIDelegate, WKURLSchemeHandler>
@end
@@ -50,19 +64,6 @@
- (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)urlSchemeTask
{
- NSString *data = ""
- "var canvas = document.createElement('canvas');"
- "var context = canvas.getContext('webgl');"
- "if (context) {"
- "var framebuffer = context.createFramebuffer();"
- "var status = context.checkFramebufferStatus(context.FRAMEBUFFER);"
- "if (status == context.FRAMEBUFFER_UNSUPPORTED)"
- "alert('doing stuff with webgl context failed');"
- "else if (status == context.FRAMEBUFFER_COMPLETE)"
- "alert('doing stuff with webgl context succeeded');"
- "else alert('unexpected status');"
- "} else alert('webgl context creation failed');"
- "</script>";
[urlSchemeTask didReceiveResponse:[[[NSURLResponse alloc] initWithURL:urlSchemeTask.request.URL MIMEType:@"text/html" expectedContentLength:data.length textEncodingName:nil] autorelease]];
[urlSchemeTask didReceiveData:[data dataUsingEncoding:NSUTF8StringEncoding]];
[urlSchemeTask didFinish];
@@ -140,4 +141,28 @@
EXPECT_TRUE([htmlURL isEqual:secondURL.get()]);
}
+@interface DelegateWithoutWebGL : NSObject <WKUIDelegate>
+@end
+
+@implementation DelegateWithoutWebGL
+
+- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
+{
+ alert = message;
+ testComplete = true;
+ completionHandler();
+}
+
+@end
+
+TEST(WebKit, WebGLPolicyNoDelegate)
+{
+ auto delegate = adoptNS([[DelegateWithoutWebGL alloc] init]);
+ auto webView = adoptNS([[WKWebView alloc] init]);
+ [webView setUIDelegate:delegate.get()];
+ [webView loadHTMLString:data baseURL:[NSURL URLWithString:@"http://example.com/"]];
+ TestWebKitAPI::Util::run(&testComplete);
+ EXPECT_STREQ([alert UTF8String], "doing stuff with webgl context succeeded");
+}
+
#endif // WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes