Changeset 222322 in webkit
- Timestamp:
- Sep 21, 2017 9:41:11 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r222320 r222322 1 2017-09-21 Alex Christensen <achristensen@webkit.org> 2 3 REGRESSION(r221465) WKWebViews without WebGL delegate callbacks crash when WebGL contexts are created 4 https://bugs.webkit.org/show_bug.cgi?id=177306 5 <rdar://problem/34351988> 6 7 Reviewed by Chris Dumez. 8 9 * UIProcess/Cocoa/NavigationState.mm: 10 (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): 11 (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): 12 I forgot to early return after calling the default completion handler if there's no delegate selector. 13 1 14 2017-09-21 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm
r222150 r222322 308 308 void NavigationState::NavigationClient::webGLLoadPolicy(WebPageProxy&, const WebCore::URL& url, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const 309 309 { 310 if (!m_navigationState.m_navigationDelegateMethods.webViewWebGLLoadPolicyForURL) 310 if (!m_navigationState.m_navigationDelegateMethods.webViewWebGLLoadPolicyForURL) { 311 311 completionHandler(WebGLAllowCreation); 312 return; 313 } 312 314 313 315 auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); … … 323 325 void NavigationState::NavigationClient::resolveWebGLLoadPolicy(WebPageProxy&, const WebCore::URL& url, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const 324 326 { 325 if (!m_navigationState.m_navigationDelegateMethods.webViewResolveWebGLLoadPolicyForURL) 327 if (!m_navigationState.m_navigationDelegateMethods.webViewResolveWebGLLoadPolicyForURL) { 326 328 completionHandler(WebGLAllowCreation); 329 return; 330 } 327 331 328 332 auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); -
trunk/Tools/ChangeLog
r222311 r222322 1 2017-09-21 Alex Christensen <achristensen@webkit.org> 2 3 REGRESSION(r221465) WKWebViews without WebGL delegate callbacks crash when WebGL contexts are created 4 https://bugs.webkit.org/show_bug.cgi?id=177306 5 <rdar://problem/34351988> 6 7 Reviewed by Chris Dumez. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm: 10 (-[WebGLTestDelegate webView:startURLSchemeTask:]): 11 (-[DelegateWithoutWebGL webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]): 12 (TEST): 13 1 14 2017-09-20 Joseph Pecoraro <pecoraro@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebGLPolicy.mm
r221505 r222322 44 44 static RetainPtr<NSURL> htmlURL; 45 45 46 static NSString *data = @"<script>" 47 "var canvas = document.createElement('canvas');" 48 "var context = canvas.getContext('webgl');" 49 "if (context) {" 50 "var framebuffer = context.createFramebuffer();" 51 "var status = context.checkFramebufferStatus(context.FRAMEBUFFER);" 52 "if (status == context.FRAMEBUFFER_UNSUPPORTED)" 53 "alert('doing stuff with webgl context failed');" 54 "else if (status == context.FRAMEBUFFER_COMPLETE)" 55 "alert('doing stuff with webgl context succeeded');" 56 "else alert('unexpected status');" 57 "} else alert('webgl context creation failed');" 58 "</script>"; 59 46 60 @interface WebGLTestDelegate : NSObject <WKNavigationDelegatePrivate, WKUIDelegate, WKURLSchemeHandler> 47 61 @end … … 51 65 - (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)urlSchemeTask 52 66 { 53 NSString *data = @"<script>"54 "var canvas = document.createElement('canvas');"55 "var context = canvas.getContext('webgl');"56 "if (context) {"57 "var framebuffer = context.createFramebuffer();"58 "var status = context.checkFramebufferStatus(context.FRAMEBUFFER);"59 "if (status == context.FRAMEBUFFER_UNSUPPORTED)"60 "alert('doing stuff with webgl context failed');"61 "else if (status == context.FRAMEBUFFER_COMPLETE)"62 "alert('doing stuff with webgl context succeeded');"63 "else alert('unexpected status');"64 "} else alert('webgl context creation failed');"65 "</script>";66 67 [urlSchemeTask didReceiveResponse:[[[NSURLResponse alloc] initWithURL:urlSchemeTask.request.URL MIMEType:@"text/html" expectedContentLength:data.length textEncodingName:nil] autorelease]]; 67 68 [urlSchemeTask didReceiveData:[data dataUsingEncoding:NSUTF8StringEncoding]]; … … 141 142 } 142 143 144 @interface DelegateWithoutWebGL : NSObject <WKUIDelegate> 145 @end 146 147 @implementation DelegateWithoutWebGL 148 149 - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler 150 { 151 alert = message; 152 testComplete = true; 153 completionHandler(); 154 } 155 156 @end 157 158 TEST(WebKit, WebGLPolicyNoDelegate) 159 { 160 auto delegate = adoptNS([[DelegateWithoutWebGL alloc] init]); 161 auto webView = adoptNS([[WKWebView alloc] init]); 162 [webView setUIDelegate:delegate.get()]; 163 [webView loadHTMLString:data baseURL:[NSURL URLWithString:@"http://example.com/"]]; 164 TestWebKitAPI::Util::run(&testComplete); 165 EXPECT_STREQ([alert UTF8String], "doing stuff with webgl context succeeded"); 166 } 167 143 168 #endif // WK_API_ENABLED
Note: See TracChangeset
for help on using the changeset viewer.