<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162000] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162000">162000</a></dd>
<dt>Author</dt> <dd>roger_fong@apple.com</dd>
<dt>Date</dt> <dd>2014-01-14 13:41:04 -0800 (Tue, 14 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for handling WebGL load policies.
https://bugs.webkit.org/show_bug.cgi?id=126935
&lt;rdar://problem/15790448&gt;.

Reviewed by Brent Fulgham.

* WebCore.xcodeproj/project.pbxproj: Copy over HTMLCanvasElement.h to the private headers directory.
* html/HTMLCanvasElement.cpp: Show the policy dialog and retrieve policies as necessary.
(WebCore::HTMLCanvasElement::getContext): Make sure that WebGL is allowed on the site.
                                          If it isn't, be sure to notify the frame loader client that
                                          the site is trying to create a WebGL context.

Boiler plate code for sending messages to and from the UI and Web Process. 

* loader/FrameLoaderClient.h:
(WebCore::FrameLoaderClient::webGLPolicyForHost): Used to get the WebGL load policy for a site.
* loader/FrameLoaderTypes.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::webGLContextCreated): Called when a site is creating a WebGL context.
* UIProcess/API/C/WKAPICast.h:
(WebKit::toWebGLLoadPolicy):
* UIProcess/API/C/WKPageLoaderClient.h:
* UIProcess/API/C/WKPageUIClient.h:
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::webGLLoadPolicy):
* UIProcess/WebLoaderClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::webGLContextCreated):
(WebKit::WebPageProxy::webGLPolicyForHost):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::webGLContextCreated):
* UIProcess/WebUIClient.h:
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::webGLContextCreated):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::webGLPolicyForHost):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebPage.cpp: A sendSync is used here to get the webGLPolicyForHost message sent between the Web and UI process.
                                  In the future this will be replaced with a strategy is non-blocking.
(WebKit::WebPage::getWebGLPolicyForHost):
* WebProcess/WebPage/WebPage.h:
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController awakeFromNib]):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLCanvasElementcpp">trunk/Source/WebCore/html/HTMLCanvasElement.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoaderClienth">trunk/Source/WebCore/loader/FrameLoaderClient.h</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoaderTypesh">trunk/Source/WebCore/loader/FrameLoaderTypes.h</a></li>
<li><a href="#trunkSourceWebCorepageChromeClienth">trunk/Source/WebCore/page/ChromeClient.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKAPICasth">trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPageLoaderClienth">trunk/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPageUIClienth">trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebLoaderClientcpp">trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebLoaderClienth">trunk/Source/WebKit2/UIProcess/WebLoaderClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebUIClientcpp">trunk/Source/WebKit2/UIProcess/WebUIClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebUIClienth">trunk/Source/WebKit2/UIProcess/WebUIClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebInspectorProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowsermacWK2BrowserWindowControllerm">trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebCore/ChangeLog        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-01-09  Roger Fong  &lt;roger_fong@apple.com&gt;
+
+        Add support for handling WebGL load policies.
+        https://bugs.webkit.org/show_bug.cgi?id=126935
+        &lt;rdar://problem/15790448&gt;.
+
+        Reviewed by Brent Fulgham.
+
+        * WebCore.xcodeproj/project.pbxproj: Copy over HTMLCanvasElement.h to the private headers directory.
+        * html/HTMLCanvasElement.cpp: Show the policy dialog and retrieve policies as necessary.
+        (WebCore::HTMLCanvasElement::getContext): Make sure that WebGL is allowed on the site.
+                                                  If it isn't, be sure to notify the frame loader client that
+                                                  the site is trying to create a WebGL context.
+        * loader/FrameLoaderClient.h:
+        (WebCore::FrameLoaderClient::webGLPolicyForHost): Used to get the WebGL load policy for a site.
+        * loader/FrameLoaderTypes.h:
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::webGLContextCreated): Called when a site is creating a WebGL context.
+
</ins><span class="cx"> 2014-01-14  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Get rid of ThreadRestrictionVerifier
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -3241,7 +3241,7 @@
</span><span class="cx">                 93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */ = {isa = PBXBuildFile; fileRef = BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 93F199BE08245E59001E9ABC /* BlockExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A640F00533BB1F0085E777 /* BlockExceptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 93F199DE08245E59001E9ABC /* Position.h in Headers */ = {isa = PBXBuildFile; fileRef = BE91FC8B06133666005E3790 /* Position.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */; };
</del><ins>+                93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 93F199EC08245E59001E9ABC /* XSLStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F24A06D18A7E004A6FA3 /* XSLStyleSheet.h */; };
</span><span class="cx">                 93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */; };
</span><span class="cx">                 93F199F008245E59001E9ABC /* WebCoreView.h in Headers */ = {isa = PBXBuildFile; fileRef = BE855F7F0701E83500239769 /* WebCoreView.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -23190,6 +23190,7 @@
</span><span class="cx">                                 E4B65A58132FA8E70070E7BE /* TileGrid.h in Headers */,
</span><span class="cx">                                 93F1992F08245E59001E9ABC /* Cursor.h in Headers */,
</span><span class="cx">                                 BC2272A20E82E87C00E7F975 /* CursorData.h in Headers */,
</span><ins>+                                93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */,
</ins><span class="cx">                                 868160D618766A130021E79D /* UserActivity.h in Headers */,
</span><span class="cx">                                 BC2272AD0E82E8F300E7F975 /* CursorList.h in Headers */,
</span><span class="cx">                                 62CD325A1157E57C0063B0A7 /* CustomEvent.h in Headers */,
</span><span class="lines">@@ -23953,7 +23954,6 @@
</span><span class="cx">                                 A871DE2C0A152AC800B12A68 /* HTMLBodyElement.h in Headers */,
</span><span class="cx">                                 A8CFF7AA0A156978000A4234 /* HTMLBRElement.h in Headers */,
</span><span class="cx">                                 A81369D2097374F600D74463 /* HTMLButtonElement.h in Headers */,
</span><del>-                                93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */,
</del><span class="cx">                                 07969DC017D14151007FF842 /* JSRTCStatsCallback.h in Headers */,
</span><span class="cx">                                 A8DF3FD0097FA0FC0052981B /* HTMLCollection.h in Headers */,
</span><span class="cx">                                 977B3865122883E900B81FF8 /* HTMLConstructionSite.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCanvasElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -33,13 +33,16 @@
</span><span class="cx"> #include &quot;CanvasPattern.h&quot;
</span><span class="cx"> #include &quot;CanvasRenderingContext2D.h&quot;
</span><span class="cx"> #include &quot;Chrome.h&quot;
</span><ins>+#include &quot;ChromeClient.h&quot;
</ins><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><ins>+#include &quot;FrameLoaderClient.h&quot;
</ins><span class="cx"> #include &quot;GraphicsContext.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;ImageData.h&quot;
</span><span class="cx"> #include &quot;MIMETypeRegistry.h&quot;
</span><ins>+#include &quot;MainFrame.h&quot;
</ins><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;RenderHTMLCanvas.h&quot;
</span><span class="cx"> #include &quot;ScriptController.h&quot;
</span><span class="lines">@@ -201,7 +204,7 @@
</span><span class="cx">     // once it is created. https://bugs.webkit.org/show_bug.cgi?id=117095
</span><span class="cx">     if (is2dType(type)) {
</span><span class="cx">         if (m_context &amp;&amp; !m_context-&gt;is2d())
</span><del>-            return 0;
</del><ins>+            return nullptr;
</ins><span class="cx">         if (!m_context) {
</span><span class="cx">             bool usesDashbardCompatibilityMode = false;
</span><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="lines">@@ -223,6 +226,17 @@
</span><span class="cx">             if (m_context &amp;&amp; !m_context-&gt;is3d())
</span><span class="cx">                 return 0;
</span><span class="cx">             if (!m_context) {
</span><ins>+                Page* page = document().page();
+                if (page &amp;&amp; !document().url().isLocalFile()) {
+                    WebGLLoadPolicy policy = page-&gt;mainFrame().loader().client().webGLPolicyForHost(document().url().host());
+
+                    if (policy == WebGLAsk) {
+                        page-&gt;chrome().client().webGLContextCreated(this);
+                        return nullptr;
+                    }
+                    if (policy == WebGLBlock)
+                        return nullptr;
+                }
</ins><span class="cx">                 m_context = WebGLRenderingContext::create(this, static_cast&lt;WebGLContextAttributes*&gt;(attrs));
</span><span class="cx">                 if (m_context) {
</span><span class="cx">                     // Need to make sure a RenderLayer and compositing layer get created for the Canvas
</span><span class="lines">@@ -235,7 +249,7 @@
</span><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(attrs);
</span><span class="cx"> #endif
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> bool HTMLCanvasElement::probablySupportsContext(const String&amp; type, CanvasContextAttributes*)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoaderClient.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -331,6 +331,7 @@
</span><span class="cx">         // Informs the embedder that a WebGL canvas inside this frame received a lost context
</span><span class="cx">         // notification with the given GL_ARB_robustness guilt/innocence code (see Extensions3D.h).
</span><span class="cx">         virtual void didLoseWebGLContext(int) { }
</span><ins>+        virtual WebGLLoadPolicy webGLPolicyForHost(const String&amp;) const { return WebGLAsk; }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">         virtual void forcePageTransitionIfNeeded() { }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoaderTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoaderTypes.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoaderTypes.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebCore/loader/FrameLoaderTypes.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -105,6 +105,12 @@
</span><span class="cx">         AboutToInstantiatePlugin,
</span><span class="cx">         NotAboutToInstantiatePlugin
</span><span class="cx">     };
</span><ins>+    
+    enum WebGLLoadPolicy {
+        WebGLAsk = 0,
+        WebGLAllow,
+        WebGLBlock
+    };
</ins><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ChromeClient.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ChromeClient.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebCore/page/ChromeClient.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -428,6 +428,10 @@
</span><span class="cx">     // would likely want the page to remain running uninterrupted.
</span><span class="cx">     virtual void incrementActivePageCount() { }
</span><span class="cx">     virtual void decrementActivePageCount() { }
</span><ins>+    
+#if ENABLE(WEBGL)
+    virtual void webGLContextCreated(Element*) const { }
+#endif
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     virtual ~ChromeClient() { }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-01-09  Roger Fong  &lt;roger_fong@apple.com&gt;
+
+        Add support for handling WebGL load policies.
+        https://bugs.webkit.org/show_bug.cgi?id=126935
+        &lt;rdar://problem/15790448&gt;.
+
+        Reviewed by Brent Fulgham.
+
+        Boiler plate code for sending messages to and from the UI and Web Process. 
+
+        * UIProcess/API/C/WKAPICast.h:
+        (WebKit::toWebGLLoadPolicy):
+        * UIProcess/API/C/WKPageLoaderClient.h:
+        * UIProcess/API/C/WKPageUIClient.h:
+        * UIProcess/WebLoaderClient.cpp:
+        (WebKit::WebLoaderClient::webGLLoadPolicy):
+        * UIProcess/WebLoaderClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::webGLContextCreated):
+        (WebKit::WebPageProxy::webGLPolicyForHost):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/WebUIClient.cpp:
+        (WebKit::WebUIClient::webGLContextCreated):
+        * UIProcess/WebUIClient.h:
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::webGLContextCreated):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::webGLPolicyForHost):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        * WebProcess/WebPage/WebPage.cpp: A sendSync is used here to get the webGLPolicyForHost message sent between the Web and UI process.
+                                          In the future this will be replaced with a strategy is non-blocking.
+        (WebKit::WebPage::getWebGLPolicyForHost):
+        * WebProcess/WebPage/WebPage.h:
+
</ins><span class="cx"> 2014-01-14  Mark Rowe  &lt;mrowe@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebKit2 leaks sudden termination assertions when a page with unload handlers is closed.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKAPICasth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -473,6 +473,21 @@
</span><span class="cx">     return PluginModuleBlocked;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline WebCore::WebGLLoadPolicy toWebGLLoadPolicy(WKWebGLLoadPolicy webGLLoadPolicy)
+{
+    switch (webGLLoadPolicy) {
+    case kWKWebGLLoadPolicyInactive:
+        return WebCore::WebGLAsk;
+    case kWKWebGLLoadPolicyLoadNormally:
+        return WebCore::WebGLAllow;
+    case kWKWebGLLoadPolicyBlocked:
+        return WebCore::WebGLBlock;
+    }
+    
+    ASSERT_NOT_REACHED();
+    return WebCore::WebGLAsk;
+}
+
</ins><span class="cx"> inline ProxyingRefPtr&lt;WebGrammarDetail&gt; toAPI(const WebCore::GrammarDetail&amp; grammarDetail)
</span><span class="cx"> {
</span><span class="cx">     return ProxyingRefPtr&lt;WebGrammarDetail&gt;(WebGrammarDetail::create(grammarDetail));
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPageLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -42,6 +42,13 @@
</span><span class="cx"> };
</span><span class="cx"> typedef uint32_t WKPluginLoadPolicy;
</span><span class="cx"> 
</span><ins>+enum {
+    kWKWebGLLoadPolicyInactive = 0,
+    kWKWebGLLoadPolicyLoadNormally,
+    kWKWebGLLoadPolicyBlocked
+};
+typedef uint32_t WKWebGLLoadPolicy;
+
</ins><span class="cx"> typedef void (*WKPageLoaderClientCallback)(WKPageRef page, const void* clientInfo);
</span><span class="cx"> typedef void (*WKPageDidStartProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
</span><span class="cx"> typedef void (*WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
</span><span class="lines">@@ -66,6 +73,7 @@
</span><span class="cx"> typedef void (*WKPageDidLayoutCallback)(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo);
</span><span class="cx"> typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo);
</span><span class="cx"> typedef void (*WKPagePluginDidFailCallback)(WKPageRef page, WKErrorCode errorCode, WKDictionaryRef pluginInfoDictionary, const void* clientInfo);
</span><ins>+typedef WKWebGLLoadPolicy (*WKPageWebGLLoadPolicyCallback)(WKPageRef page, WKStringRef host, const void* clientInfo);
</ins><span class="cx"> 
</span><span class="cx"> // Deprecated
</span><span class="cx"> typedef void (*WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, const void* clientInfo);
</span><span class="lines">@@ -264,6 +272,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Version 3.
</span><span class="cx">     WKPagePluginLoadPolicyCallback                                      pluginLoadPolicy;
</span><ins>+    WKPageWebGLLoadPolicyCallback                                       webGLLoadPolicy;
</ins><span class="cx"> } WKPageLoaderClientV3;
</span><span class="cx"> 
</span><span class="cx"> // FIXME: These should be deprecated.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPageUIClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx"> typedef void (*WKPageShowColorPickerCallback)(WKPageRef page, WKStringRef initialColor, WKColorPickerResultListenerRef listener, const void* clientInfo);
</span><span class="cx"> typedef void (*WKPageHideColorPickerCallback)(WKPageRef page, const void* clientInfo);
</span><span class="cx"> typedef void (*WKPageUnavailablePluginButtonClickedCallback)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKDictionaryRef pluginInfoDictionary, const void* clientInfo);
</span><ins>+typedef void (*WKPageWebGLContextCreatedCallback)(WKPageRef page, WKStringRef, const void* clientInfo);
</ins><span class="cx"> 
</span><span class="cx"> // Deprecated    
</span><span class="cx"> typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
</span><span class="lines">@@ -247,6 +248,7 @@
</span><span class="cx">     WKPageShowColorPickerCallback                                       showColorPicker;
</span><span class="cx">     WKPageHideColorPickerCallback                                       hideColorPicker;
</span><span class="cx">     WKPageUnavailablePluginButtonClickedCallback                        unavailablePluginButtonClicked;
</span><ins>+    WKPageWebGLContextCreatedCallback                                   webGLContextCreated;
</ins><span class="cx"> } WKPageUIClientV2;
</span><span class="cx"> 
</span><span class="cx"> enum { kWKPageUIClientCurrentVersion WK_ENUM_DEPRECATED(&quot;Use an explicit version number instead&quot;) = 2 };
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -333,4 +333,12 @@
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBGL)
+void WebLoaderClient::webGLLoadPolicy(WebPageProxy* page, WebCore::WebGLLoadPolicy&amp; loadPolicy, const String&amp; host)
+{
+    if (m_client.webGLLoadPolicy)
+        loadPolicy = toWebGLLoadPolicy(m_client.webGLLoadPolicy(toAPI(page), toAPI(host.impl()), m_client.base.clientInfo));
+}
+#endif // ENABLE(WEBGL)
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;PluginModuleInfo.h&quot;
</span><span class="cx"> #include &quot;SameDocumentNavigationType.h&quot;
</span><span class="cx"> #include &quot;WKPage.h&quot;
</span><ins>+#include &lt;WebCore/FrameLoaderTypes.h&gt;
</ins><span class="cx"> #include &lt;WebCore/LayoutMilestones.h&gt;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="lines">@@ -102,6 +103,10 @@
</span><span class="cx">     void didFailToInitializePlugin(WebPageProxy*, ImmutableDictionary*);
</span><span class="cx">     void didBlockInsecurePluginVersion(WebPageProxy*, ImmutableDictionary*);
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><ins>+
+#if ENABLE(WEBGL)
+    void webGLLoadPolicy(WebPageProxy*, WebCore::WebGLLoadPolicy&amp;, const String&amp;);
+#endif // ENABLE(WEBGL)
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -2680,6 +2680,20 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBGL)
+void WebPageProxy::webGLContextCreated(const String&amp; pageURLString)
+{
+    m_uiClient.webGLContextCreated(this, pageURLString);
+}
+
+void WebPageProxy::webGLPolicyForHost(const String&amp; host, uint32_t&amp; loadPolicy)
+{
+    WebCore::WebGLLoadPolicy policy;
+    m_loaderClient.webGLLoadPolicy(this, policy, host);
+    loadPolicy = static_cast&lt;uint32_t&gt;(policy);
+}
+#endif // ENABLE(WEBGL)
+
</ins><span class="cx"> void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
</span><span class="cx"> {
</span><span class="cx">     m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -929,6 +929,10 @@
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx">     void unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String&amp; mimeType, const String&amp; pluginURLString, const String&amp; pluginsPageURLString, const String&amp; frameURLString, const String&amp; pageURLString);
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><ins>+#if ENABLE(WEBGL)
+    void webGLContextCreated(const String&amp; pageURLString);
+    void webGLPolicyForHost(const String&amp; host, uint32_t&amp; loadPolicy);
+#endif // ENABLE(WEBGL)
</ins><span class="cx">     void setToolbarsAreVisible(bool toolbarsAreVisible);
</span><span class="cx">     void getToolbarsAreVisible(bool&amp; toolbarsAreVisible);
</span><span class="cx">     void setMenuBarIsVisible(bool menuBarIsVisible);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -33,6 +33,10 @@
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx">     UnavailablePluginButtonClicked(uint32_t pluginUnavailabilityReason, String mimeType, String pluginURLString, String pluginspageAttributeURLString, String frameURLString, String pageURLString)
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><ins>+#if ENABLE(WEBGL)
+    WebGLContextCreated(String pageURLString)
+    WebGLPolicyForHost(String host) -&gt; (uint32_t loadPolicy)
+#endif // ENABLE(WEBGL)
</ins><span class="cx">     DidChangeViewportProperties(WebCore::ViewportAttributes attributes)
</span><span class="cx">     DidReceiveEvent(uint32_t type, bool handled)
</span><span class="cx">     StopResponsivenessTimer()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebUIClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebUIClient.cpp (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebUIClient.cpp        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/WebUIClient.cpp        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -207,6 +207,14 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBGL)
+void WebUIClient::webGLContextCreated(WebPageProxy* page, const String&amp; originatingURL)
+{
+    if (m_client.webGLContextCreated)
+        m_client.webGLContextCreated(toAPI(page), toAPI(originatingURL.impl()), m_client.base.clientInfo);
+}
+#endif // ENABLE(WEBGL)
+
</ins><span class="cx"> bool WebUIClient::implementsDidNotHandleKeyEvent() const
</span><span class="cx"> {
</span><span class="cx">     return m_client.didNotHandleKeyEvent;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebUIClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebUIClient.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebUIClient.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/WebUIClient.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -81,7 +81,9 @@
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx">     void unavailablePluginButtonClicked(WebPageProxy*, WKPluginUnavailabilityReason, ImmutableDictionary*);
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><del>-
</del><ins>+#if ENABLE(WEBGL)
+    void webGLContextCreated(WebPageProxy*, const String&amp;);
+#endif // ENABLE(WEBGL)
</ins><span class="cx">     bool implementsDidNotHandleKeyEvent() const;
</span><span class="cx">     void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebInspectorProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -447,6 +447,7 @@
</span><span class="cx">         0, // showColorPicker
</span><span class="cx">         0, // hideColorPicker
</span><span class="cx">         0, // unavailablePluginButtonClicked
</span><ins>+        0, // webGLContextCreated
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     inspectorPage-&gt;initializeUIClient(reinterpret_cast&lt;const WKPageUIClientBase*&gt;(&amp;uiClient));
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx"> #include &lt;WebCore/FrameLoadRequest.h&gt;
</span><span class="cx"> #include &lt;WebCore/FrameLoader.h&gt;
</span><span class="cx"> #include &lt;WebCore/FrameView.h&gt;
</span><ins>+#include &lt;WebCore/HTMLCanvasElement.h&gt;
</ins><span class="cx"> #include &lt;WebCore/HTMLInputElement.h&gt;
</span><span class="cx"> #include &lt;WebCore/HTMLNames.h&gt;
</span><span class="cx"> #include &lt;WebCore/HTMLParserIdioms.h&gt;
</span><span class="lines">@@ -562,6 +563,14 @@
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBGL)
+void WebChromeClient::webGLContextCreated(Element* element) const
+{
+    String pageURLString = m_page-&gt;mainFrame()-&gt;loader().documentLoader()-&gt;responseURL().string();
+    m_page-&gt;send(Messages::WebPageProxy::WebGLContextCreated(pageURLString));
+}
+#endif // ENABLE(WEBGL)
+
</ins><span class="cx"> void WebChromeClient::scrollbarsModeDidChange() const
</span><span class="cx"> {
</span><span class="cx">     notImplemented();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -123,6 +123,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE;
</span><span class="cx">     virtual void unavailablePluginButtonClicked(WebCore::Element*, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE;
</span><ins>+#if ENABLE(WEBGL)
+    virtual void webGLContextCreated(WebCore::Element*) const OVERRIDE;
+#endif // ENABLE(WEBGL)
</ins><span class="cx"> 
</span><span class="cx">     virtual void scrollbarsModeDidChange() const OVERRIDE;
</span><span class="cx">     virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&amp;, unsigned modifierFlags) OVERRIDE;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -1378,6 +1378,15 @@
</span><span class="cx">         m_pluginView = static_cast&lt;PluginView*&gt;(pluginWidget);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBGL)
+WebCore::WebGLLoadPolicy WebFrameLoaderClient::webGLPolicyForHost(const String&amp; host) const
+{
+    if (WebPage* webPage = m_frame-&gt;page())
+        return webPage-&gt;getWebGLPolicyForHost(m_frame, host);
+    return WebGLAsk;
+}
+#endif // ENABLE(WEBGL)
+
</ins><span class="cx"> PassRefPtr&lt;Widget&gt; WebFrameLoaderClient::createJavaAppletWidget(const IntSize&amp; pluginSize, HTMLAppletElement* appletElement, const URL&amp;, const Vector&lt;String&gt;&amp; paramNames, const Vector&lt;String&gt;&amp; paramValues)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -194,6 +194,10 @@
</span><span class="cx">     virtual void recreatePlugin(WebCore::Widget*) OVERRIDE;
</span><span class="cx">     virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget) OVERRIDE;
</span><span class="cx">     
</span><ins>+#if ENABLE(WEBGL)
+    virtual WebCore::WebGLLoadPolicy webGLPolicyForHost(const String&amp;) const OVERRIDE;
+#endif // ENABLE(WEBGL)
+
</ins><span class="cx">     virtual PassRefPtr&lt;WebCore::Widget&gt; createJavaAppletWidget(const WebCore::IntSize&amp;, WebCore::HTMLAppletElement*, const WebCore::URL&amp; baseURL, const Vector&lt;String&gt;&amp; paramNames, const Vector&lt;String&gt;&amp; paramValues) OVERRIDE;
</span><span class="cx">     
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -590,6 +590,19 @@
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBGL)
+WebCore::WebGLLoadPolicy WebPage::getWebGLPolicyForHost(WebFrame* frame, const String&amp; url)
+{
+    WebGLLoadPolicy defaultPolicy = WebGLAsk;
+    uint32_t policyResult = 0;
+    // FIXME: Get rid of sendSync in favor of a non-blocking strategy.
+    sendSync(Messages::WebPageProxy::WebGLPolicyForHost(url), Messages::WebPageProxy::WebGLPolicyForHost::Reply(policyResult));
+    if (policyResult)
+        return static_cast&lt;WebGLLoadPolicy&gt;(policyResult);
+    return defaultPolicy;
+}
+#endif // ENABLE(WEBGL)
+
</ins><span class="cx"> EditorState WebPage::editorState() const
</span><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -287,6 +287,10 @@
</span><span class="cx">     PassRefPtr&lt;Plugin&gt; createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&amp;, String&amp; newMIMEType);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBGL)
+    WebCore::WebGLLoadPolicy getWebGLPolicyForHost(WebFrame*, const String&amp;);
+#endif // ENABLE(WEBGL)
+    
</ins><span class="cx">     EditorState editorState() const;
</span><span class="cx"> 
</span><span class="cx">     String renderTreeExternalRepresentation() const;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Tools/ChangeLog        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-01-13  Roger Fong  &lt;roger_fong@apple.com&gt;
+
+        Add support for handling WebGL load policies.
+        https://bugs.webkit.org/show_bug.cgi?id=126935
+        &lt;rdar://problem/15790448&gt;.
+
+        Reviewed by Brent Fulgham.
+
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController awakeFromNib]):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createWebViewWithOptions):
+
</ins><span class="cx"> 2014-01-14  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Skip FontConfig initialization in WebKitTestRunner if requested
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacWK2BrowserWindowControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -581,6 +581,7 @@
</span><span class="cx">         0, // showColorPicker
</span><span class="cx">         0, // hideColorPicker
</span><span class="cx">         0, // unavailablePluginButtonClicked
</span><ins>+        0, // webGLContextCreated
</ins><span class="cx">     };
</span><span class="cx">     WKPageSetPageUIClient(_webView.pageRef, &amp;uiClient.base);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (161999 => 162000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2014-01-14 21:38:38 UTC (rev 161999)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2014-01-14 21:41:04 UTC (rev 162000)
</span><span class="lines">@@ -242,6 +242,7 @@
</span><span class="cx">         0, // showColorPicker
</span><span class="cx">         0, // hideColorPicker
</span><span class="cx">         0, // unavailablePluginButtonClicked
</span><ins>+        0, // webGLContextCreated
</ins><span class="cx">     };
</span><span class="cx">     WKPageSetPageUIClient(newPage, &amp;otherPageUIClient.base);
</span><span class="cx"> 
</span><span class="lines">@@ -419,6 +420,7 @@
</span><span class="cx">         0, // showColorPicker
</span><span class="cx">         0, // hideColorPicker
</span><span class="cx">         unavailablePluginButtonClicked,
</span><ins>+        0, // webGLContextCreated
</ins><span class="cx">     };
</span><span class="cx">     WKPageSetPageUIClient(m_mainWebView-&gt;page(), &amp;pageUIClient.base);
</span><span class="cx"> 
</span><span class="lines">@@ -460,6 +462,7 @@
</span><span class="cx">         0, // pluginLoadPolicy_deprecatedForUseWithV2
</span><span class="cx">         0, // pluginDidFail
</span><span class="cx">         pluginLoadPolicy, // pluginLoadPolicy
</span><ins>+        0, // webGLLoadPolicy
</ins><span class="cx">     };
</span><span class="cx">     WKPageSetPageLoaderClient(m_mainWebView-&gt;page(), &amp;pageLoaderClient.base);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>