Changeset 162000 in webkit
- Timestamp:
- Jan 14, 2014, 1:41:04 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r161999 r162000 1 2014-01-09 Roger Fong <roger_fong@apple.com> 2 3 Add support for handling WebGL load policies. 4 https://bugs.webkit.org/show_bug.cgi?id=126935 5 <rdar://problem/15790448>. 6 7 Reviewed by Brent Fulgham. 8 9 * WebCore.xcodeproj/project.pbxproj: Copy over HTMLCanvasElement.h to the private headers directory. 10 * html/HTMLCanvasElement.cpp: Show the policy dialog and retrieve policies as necessary. 11 (WebCore::HTMLCanvasElement::getContext): Make sure that WebGL is allowed on the site. 12 If it isn't, be sure to notify the frame loader client that 13 the site is trying to create a WebGL context. 14 * loader/FrameLoaderClient.h: 15 (WebCore::FrameLoaderClient::webGLPolicyForHost): Used to get the WebGL load policy for a site. 16 * loader/FrameLoaderTypes.h: 17 * page/ChromeClient.h: 18 (WebCore::ChromeClient::webGLContextCreated): Called when a site is creating a WebGL context. 19 1 20 2014-01-14 Anders Carlsson <andersca@apple.com> 2 21 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r161950 r162000 3242 3242 93F199BE08245E59001E9ABC /* BlockExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A640F00533BB1F0085E777 /* BlockExceptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3243 3243 93F199DE08245E59001E9ABC /* Position.h in Headers */ = {isa = PBXBuildFile; fileRef = BE91FC8B06133666005E3790 /* Position.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3244 93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */; };3244 93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3245 3245 93F199EC08245E59001E9ABC /* XSLStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F24A06D18A7E004A6FA3 /* XSLStyleSheet.h */; }; 3246 3246 93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */; }; … … 23191 23191 93F1992F08245E59001E9ABC /* Cursor.h in Headers */, 23192 23192 BC2272A20E82E87C00E7F975 /* CursorData.h in Headers */, 23193 93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */, 23193 23194 868160D618766A130021E79D /* UserActivity.h in Headers */, 23194 23195 BC2272AD0E82E8F300E7F975 /* CursorList.h in Headers */, … … 23954 23955 A8CFF7AA0A156978000A4234 /* HTMLBRElement.h in Headers */, 23955 23956 A81369D2097374F600D74463 /* HTMLButtonElement.h in Headers */, 23956 93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */,23957 23957 07969DC017D14151007FF842 /* JSRTCStatsCallback.h in Headers */, 23958 23958 A8DF3FD0097FA0FC0052981B /* HTMLCollection.h in Headers */, -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r161181 r162000 34 34 #include "CanvasRenderingContext2D.h" 35 35 #include "Chrome.h" 36 #include "ChromeClient.h" 36 37 #include "Document.h" 37 38 #include "ExceptionCode.h" 38 39 #include "Frame.h" 40 #include "FrameLoaderClient.h" 39 41 #include "GraphicsContext.h" 40 42 #include "HTMLNames.h" 41 43 #include "ImageData.h" 42 44 #include "MIMETypeRegistry.h" 45 #include "MainFrame.h" 43 46 #include "Page.h" 44 47 #include "RenderHTMLCanvas.h" … … 202 205 if (is2dType(type)) { 203 206 if (m_context && !m_context->is2d()) 204 return 0;207 return nullptr; 205 208 if (!m_context) { 206 209 bool usesDashbardCompatibilityMode = false; … … 224 227 return 0; 225 228 if (!m_context) { 229 Page* page = document().page(); 230 if (page && !document().url().isLocalFile()) { 231 WebGLLoadPolicy policy = page->mainFrame().loader().client().webGLPolicyForHost(document().url().host()); 232 233 if (policy == WebGLAsk) { 234 page->chrome().client().webGLContextCreated(this); 235 return nullptr; 236 } 237 if (policy == WebGLBlock) 238 return nullptr; 239 } 226 240 m_context = WebGLRenderingContext::create(this, static_cast<WebGLContextAttributes*>(attrs)); 227 241 if (m_context) { … … 236 250 UNUSED_PARAM(attrs); 237 251 #endif 238 return 0;252 return nullptr; 239 253 } 240 254 -
trunk/Source/WebCore/loader/FrameLoaderClient.h
r161744 r162000 332 332 // notification with the given GL_ARB_robustness guilt/innocence code (see Extensions3D.h). 333 333 virtual void didLoseWebGLContext(int) { } 334 virtual WebGLLoadPolicy webGLPolicyForHost(const String&) const { return WebGLAsk; } 334 335 #endif 335 336 -
trunk/Source/WebCore/loader/FrameLoaderTypes.h
r100353 r162000 106 106 NotAboutToInstantiatePlugin 107 107 }; 108 109 enum WebGLLoadPolicy { 110 WebGLAsk = 0, 111 WebGLAllow, 112 WebGLBlock 113 }; 108 114 109 115 } -
trunk/Source/WebCore/page/ChromeClient.h
r161342 r162000 429 429 virtual void incrementActivePageCount() { } 430 430 virtual void decrementActivePageCount() { } 431 432 #if ENABLE(WEBGL) 433 virtual void webGLContextCreated(Element*) const { } 434 #endif 431 435 432 436 protected: -
trunk/Source/WebKit2/ChangeLog
r161998 r162000 1 2014-01-09 Roger Fong <roger_fong@apple.com> 2 3 Add support for handling WebGL load policies. 4 https://bugs.webkit.org/show_bug.cgi?id=126935 5 <rdar://problem/15790448>. 6 7 Reviewed by Brent Fulgham. 8 9 Boiler plate code for sending messages to and from the UI and Web Process. 10 11 * UIProcess/API/C/WKAPICast.h: 12 (WebKit::toWebGLLoadPolicy): 13 * UIProcess/API/C/WKPageLoaderClient.h: 14 * UIProcess/API/C/WKPageUIClient.h: 15 * UIProcess/WebLoaderClient.cpp: 16 (WebKit::WebLoaderClient::webGLLoadPolicy): 17 * UIProcess/WebLoaderClient.h: 18 * UIProcess/WebPageProxy.cpp: 19 (WebKit::WebPageProxy::webGLContextCreated): 20 (WebKit::WebPageProxy::webGLPolicyForHost): 21 * UIProcess/WebPageProxy.h: 22 * UIProcess/WebPageProxy.messages.in: 23 * UIProcess/WebUIClient.cpp: 24 (WebKit::WebUIClient::webGLContextCreated): 25 * UIProcess/WebUIClient.h: 26 * UIProcess/mac/WebInspectorProxyMac.mm: 27 (WebKit::WebInspectorProxy::platformCreateInspectorPage): 28 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 29 (WebKit::WebChromeClient::webGLContextCreated): 30 * WebProcess/WebCoreSupport/WebChromeClient.h: 31 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 32 (WebKit::WebFrameLoaderClient::webGLPolicyForHost): 33 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 34 * WebProcess/WebPage/WebPage.cpp: A sendSync is used here to get the webGLPolicyForHost message sent between the Web and UI process. 35 In the future this will be replaced with a strategy is non-blocking. 36 (WebKit::WebPage::getWebGLPolicyForHost): 37 * WebProcess/WebPage/WebPage.h: 38 1 39 2014-01-14 Mark Rowe <mrowe@apple.com> 2 40 -
trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h
r159461 r162000 474 474 } 475 475 476 inline WebCore::WebGLLoadPolicy toWebGLLoadPolicy(WKWebGLLoadPolicy webGLLoadPolicy) 477 { 478 switch (webGLLoadPolicy) { 479 case kWKWebGLLoadPolicyInactive: 480 return WebCore::WebGLAsk; 481 case kWKWebGLLoadPolicyLoadNormally: 482 return WebCore::WebGLAllow; 483 case kWKWebGLLoadPolicyBlocked: 484 return WebCore::WebGLBlock; 485 } 486 487 ASSERT_NOT_REACHED(); 488 return WebCore::WebGLAsk; 489 } 490 476 491 inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& grammarDetail) 477 492 { -
trunk/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h
r160104 r162000 43 43 typedef uint32_t WKPluginLoadPolicy; 44 44 45 enum { 46 kWKWebGLLoadPolicyInactive = 0, 47 kWKWebGLLoadPolicyLoadNormally, 48 kWKWebGLLoadPolicyBlocked 49 }; 50 typedef uint32_t WKWebGLLoadPolicy; 51 45 52 typedef void (*WKPageLoaderClientCallback)(WKPageRef page, const void* clientInfo); 46 53 typedef void (*WKPageDidStartProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); … … 67 74 typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo); 68 75 typedef void (*WKPagePluginDidFailCallback)(WKPageRef page, WKErrorCode errorCode, WKDictionaryRef pluginInfoDictionary, const void* clientInfo); 76 typedef WKWebGLLoadPolicy (*WKPageWebGLLoadPolicyCallback)(WKPageRef page, WKStringRef host, const void* clientInfo); 69 77 70 78 // Deprecated … … 265 273 // Version 3. 266 274 WKPagePluginLoadPolicyCallback pluginLoadPolicy; 275 WKPageWebGLLoadPolicyCallback webGLLoadPolicy; 267 276 } WKPageLoaderClientV3; 268 277 -
trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h
r160104 r162000 86 86 typedef void (*WKPageHideColorPickerCallback)(WKPageRef page, const void* clientInfo); 87 87 typedef void (*WKPageUnavailablePluginButtonClickedCallback)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKDictionaryRef pluginInfoDictionary, const void* clientInfo); 88 typedef void (*WKPageWebGLContextCreatedCallback)(WKPageRef page, WKStringRef, const void* clientInfo); 88 89 89 90 // Deprecated … … 248 249 WKPageHideColorPickerCallback hideColorPicker; 249 250 WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; 251 WKPageWebGLContextCreatedCallback webGLContextCreated; 250 252 } WKPageUIClientV2; 251 253 -
trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp
r160608 r162000 334 334 #endif // ENABLE(NETSCAPE_PLUGIN_API) 335 335 336 #if ENABLE(WEBGL) 337 void WebLoaderClient::webGLLoadPolicy(WebPageProxy* page, WebCore::WebGLLoadPolicy& loadPolicy, const String& host) 338 { 339 if (m_client.webGLLoadPolicy) 340 loadPolicy = toWebGLLoadPolicy(m_client.webGLLoadPolicy(toAPI(page), toAPI(host.impl()), m_client.base.clientInfo)); 341 } 342 #endif // ENABLE(WEBGL) 343 336 344 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/WebLoaderClient.h
r159994 r162000 31 31 #include "SameDocumentNavigationType.h" 32 32 #include "WKPage.h" 33 #include <WebCore/FrameLoaderTypes.h> 33 34 #include <WebCore/LayoutMilestones.h> 34 35 #include <wtf/Forward.h> … … 103 104 void didBlockInsecurePluginVersion(WebPageProxy*, ImmutableDictionary*); 104 105 #endif // ENABLE(NETSCAPE_PLUGIN_API) 106 107 #if ENABLE(WEBGL) 108 void webGLLoadPolicy(WebPageProxy*, WebCore::WebGLLoadPolicy&, const String&); 109 #endif // ENABLE(WEBGL) 105 110 }; 106 111 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r161851 r162000 2681 2681 #endif // ENABLE(NETSCAPE_PLUGIN_API) 2682 2682 2683 #if ENABLE(WEBGL) 2684 void WebPageProxy::webGLContextCreated(const String& pageURLString) 2685 { 2686 m_uiClient.webGLContextCreated(this, pageURLString); 2687 } 2688 2689 void WebPageProxy::webGLPolicyForHost(const String& host, uint32_t& loadPolicy) 2690 { 2691 WebCore::WebGLLoadPolicy policy; 2692 m_loaderClient.webGLLoadPolicy(this, policy, host); 2693 loadPolicy = static_cast<uint32_t>(policy); 2694 } 2695 #endif // ENABLE(WEBGL) 2696 2683 2697 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible) 2684 2698 { -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r161679 r162000 930 930 void unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& pluginURLString, const String& pluginsPageURLString, const String& frameURLString, const String& pageURLString); 931 931 #endif // ENABLE(NETSCAPE_PLUGIN_API) 932 #if ENABLE(WEBGL) 933 void webGLContextCreated(const String& pageURLString); 934 void webGLPolicyForHost(const String& host, uint32_t& loadPolicy); 935 #endif // ENABLE(WEBGL) 932 936 void setToolbarsAreVisible(bool toolbarsAreVisible); 933 937 void getToolbarsAreVisible(bool& toolbarsAreVisible); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r161358 r162000 34 34 UnavailablePluginButtonClicked(uint32_t pluginUnavailabilityReason, String mimeType, String pluginURLString, String pluginspageAttributeURLString, String frameURLString, String pageURLString) 35 35 #endif // ENABLE(NETSCAPE_PLUGIN_API) 36 #if ENABLE(WEBGL) 37 WebGLContextCreated(String pageURLString) 38 WebGLPolicyForHost(String host) -> (uint32_t loadPolicy) 39 #endif // ENABLE(WEBGL) 36 40 DidChangeViewportProperties(WebCore::ViewportAttributes attributes) 37 41 DidReceiveEvent(uint32_t type, bool handled) -
trunk/Source/WebKit2/UIProcess/WebUIClient.cpp
r160737 r162000 208 208 #endif // ENABLE(NETSCAPE_PLUGIN_API) 209 209 210 #if ENABLE(WEBGL) 211 void WebUIClient::webGLContextCreated(WebPageProxy* page, const String& originatingURL) 212 { 213 if (m_client.webGLContextCreated) 214 m_client.webGLContextCreated(toAPI(page), toAPI(originatingURL.impl()), m_client.base.clientInfo); 215 } 216 #endif // ENABLE(WEBGL) 217 210 218 bool WebUIClient::implementsDidNotHandleKeyEvent() const 211 219 { -
trunk/Source/WebKit2/UIProcess/WebUIClient.h
r160653 r162000 82 82 void unavailablePluginButtonClicked(WebPageProxy*, WKPluginUnavailabilityReason, ImmutableDictionary*); 83 83 #endif // ENABLE(NETSCAPE_PLUGIN_API) 84 84 #if ENABLE(WEBGL) 85 void webGLContextCreated(WebPageProxy*, const String&); 86 #endif // ENABLE(WEBGL) 85 87 bool implementsDidNotHandleKeyEvent() const; 86 88 void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&); -
trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
r160104 r162000 448 448 0, // hideColorPicker 449 449 0, // unavailablePluginButtonClicked 450 0, // webGLContextCreated 450 451 }; 451 452 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r161662 r162000 59 59 #include <WebCore/FrameLoader.h> 60 60 #include <WebCore/FrameView.h> 61 #include <WebCore/HTMLCanvasElement.h> 61 62 #include <WebCore/HTMLInputElement.h> 62 63 #include <WebCore/HTMLNames.h> … … 563 564 } 564 565 566 #if ENABLE(WEBGL) 567 void WebChromeClient::webGLContextCreated(Element* element) const 568 { 569 String pageURLString = m_page->mainFrame()->loader().documentLoader()->responseURL().string(); 570 m_page->send(Messages::WebPageProxy::WebGLContextCreated(pageURLString)); 571 } 572 #endif // ENABLE(WEBGL) 573 565 574 void WebChromeClient::scrollbarsModeDidChange() const 566 575 { -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
r161413 r162000 124 124 virtual bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE; 125 125 virtual void unavailablePluginButtonClicked(WebCore::Element*, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE; 126 #if ENABLE(WEBGL) 127 virtual void webGLContextCreated(WebCore::Element*) const OVERRIDE; 128 #endif // ENABLE(WEBGL) 126 129 127 130 virtual void scrollbarsModeDidChange() const OVERRIDE; -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r161751 r162000 1379 1379 } 1380 1380 1381 #if ENABLE(WEBGL) 1382 WebCore::WebGLLoadPolicy WebFrameLoaderClient::webGLPolicyForHost(const String& host) const 1383 { 1384 if (WebPage* webPage = m_frame->page()) 1385 return webPage->getWebGLPolicyForHost(m_frame, host); 1386 return WebGLAsk; 1387 } 1388 #endif // ENABLE(WEBGL) 1389 1381 1390 PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* appletElement, const URL&, const Vector<String>& paramNames, const Vector<String>& paramValues) 1382 1391 { -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r161751 r162000 195 195 virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget) OVERRIDE; 196 196 197 #if ENABLE(WEBGL) 198 virtual WebCore::WebGLLoadPolicy webGLPolicyForHost(const String&) const OVERRIDE; 199 #endif // ENABLE(WEBGL) 200 197 201 virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::URL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) OVERRIDE; 198 202 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r161744 r162000 591 591 #endif // ENABLE(NETSCAPE_PLUGIN_API) 592 592 593 #if ENABLE(WEBGL) 594 WebCore::WebGLLoadPolicy WebPage::getWebGLPolicyForHost(WebFrame* frame, const String& url) 595 { 596 WebGLLoadPolicy defaultPolicy = WebGLAsk; 597 uint32_t policyResult = 0; 598 // FIXME: Get rid of sendSync in favor of a non-blocking strategy. 599 sendSync(Messages::WebPageProxy::WebGLPolicyForHost(url), Messages::WebPageProxy::WebGLPolicyForHost::Reply(policyResult)); 600 if (policyResult) 601 return static_cast<WebGLLoadPolicy>(policyResult); 602 return defaultPolicy; 603 } 604 #endif // ENABLE(WEBGL) 605 593 606 EditorState WebPage::editorState() const 594 607 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r161950 r162000 288 288 #endif 289 289 290 #if ENABLE(WEBGL) 291 WebCore::WebGLLoadPolicy getWebGLPolicyForHost(WebFrame*, const String&); 292 #endif // ENABLE(WEBGL) 293 290 294 EditorState editorState() const; 291 295 -
trunk/Tools/ChangeLog
r161990 r162000 1 2014-01-13 Roger Fong <roger_fong@apple.com> 2 3 Add support for handling WebGL load policies. 4 https://bugs.webkit.org/show_bug.cgi?id=126935 5 <rdar://problem/15790448>. 6 7 Reviewed by Brent Fulgham. 8 9 * MiniBrowser/mac/WK2BrowserWindowController.m: 10 (-[WK2BrowserWindowController awakeFromNib]): 11 * WebKitTestRunner/TestController.cpp: 12 (WTR::TestController::createWebViewWithOptions): 13 1 14 2014-01-14 Zan Dobersek <zdobersek@igalia.com> 2 15 -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r160654 r162000 582 582 0, // hideColorPicker 583 583 0, // unavailablePluginButtonClicked 584 0, // webGLContextCreated 584 585 }; 585 586 WKPageSetPageUIClient(_webView.pageRef, &uiClient.base); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r161105 r162000 243 243 0, // hideColorPicker 244 244 0, // unavailablePluginButtonClicked 245 0, // webGLContextCreated 245 246 }; 246 247 WKPageSetPageUIClient(newPage, &otherPageUIClient.base); … … 420 421 0, // hideColorPicker 421 422 unavailablePluginButtonClicked, 423 0, // webGLContextCreated 422 424 }; 423 425 WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base); … … 461 463 0, // pluginDidFail 462 464 pluginLoadPolicy, // pluginLoadPolicy 465 0, // webGLLoadPolicy 463 466 }; 464 467 WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient.base);
Note:
See TracChangeset
for help on using the changeset viewer.