Title: [222324] tags/Safari-605.1.7

Diff

Modified: tags/Safari-605.1.7/Source/WebKit/ChangeLog (222323 => 222324)


--- tags/Safari-605.1.7/Source/WebKit/ChangeLog	2017-09-21 16:47:55 UTC (rev 222323)
+++ tags/Safari-605.1.7/Source/WebKit/ChangeLog	2017-09-21 16:56:22 UTC (rev 222324)
@@ -1,3 +1,20 @@
+2017-09-21  Jason Marcell  <[email protected]>
+
+        Cherry-pick r222322. rdar://problem/34351988
+
+    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-20  Jonathan Bedard  <[email protected]>
 
         Removed nullable from UIDragItem property

Modified: tags/Safari-605.1.7/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (222323 => 222324)


--- tags/Safari-605.1.7/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2017-09-21 16:47:55 UTC (rev 222323)
+++ tags/Safari-605.1.7/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2017-09-21 16:56:22 UTC (rev 222324)
@@ -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: tags/Safari-605.1.7/Tools/ChangeLog (222323 => 222324)


--- tags/Safari-605.1.7/Tools/ChangeLog	2017-09-21 16:47:55 UTC (rev 222323)
+++ tags/Safari-605.1.7/Tools/ChangeLog	2017-09-21 16:56:22 UTC (rev 222324)
@@ -1,3 +1,20 @@
+2017-09-21  Jason Marcell  <[email protected]>
+
+        Cherry-pick r222322. rdar://problem/34351988
+
+    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  Myles C. Maxfield  <[email protected]>
 
         Create vector swizzle operators in WSL's standard library

Modified: tags/Safari-605.1.7/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm (222323 => 222324)


--- tags/Safari-605.1.7/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm	2017-09-21 16:47:55 UTC (rev 222323)
+++ tags/Safari-605.1.7/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm	2017-09-21 16:56:22 UTC (rev 222324)
@@ -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

Reply via email to