<!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>[164452] trunk/Source/WebCore</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/164452">164452</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2014-02-20 15:12:18 -0800 (Thu, 20 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>An unresolved WebGL Context should operate normally until used
https://bugs.webkit.org/show_bug.cgi?id=129110
Reviewed by Brent Fulgham.
Add the ability to create a special instance of WebGLRenderingContext,
that appears normal but won't actually do anything if asked. This will
be created in the case of the WebGLLoadPolicy being "pending" and helps
in the case of pages that feature detect by creating a context and
immediately deleting it.
Note that the context doesn't actually try to recover from this state
yet, although that would be a nice addition. When asked to do something
it could actually try to create the GraphicsContext3D. However, if it
fails it would then have to fire a context lost.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext): Move the load policy code out of getContext.
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::create): Add the ability to create a pending context.
(WebCore::WebGLRenderingContext::WebGLRenderingContext): New constructor for a pending context.
(WebCore::WebGLRenderingContext::~WebGLRenderingContext): Only delete if not pending.
(WebCore::WebGLRenderingContext::destroyGraphicsContext3D): Ditto.
(WebCore::WebGLRenderingContext::clearIfComposited): Everything below is about checking the
pending state before doing anything, and triggering a resolution if necessary.
(WebCore::WebGLRenderingContext::activeTexture):
(WebCore::WebGLRenderingContext::attachShader):
(WebCore::WebGLRenderingContext::bindAttribLocation):
(WebCore::WebGLRenderingContext::checkObjectToBeBound):
(WebCore::WebGLRenderingContext::blendColor):
(WebCore::WebGLRenderingContext::blendEquation):
(WebCore::WebGLRenderingContext::blendEquationSeparate):
(WebCore::WebGLRenderingContext::blendFunc):
(WebCore::WebGLRenderingContext::blendFuncSeparate):
(WebCore::WebGLRenderingContext::bufferData):
(WebCore::WebGLRenderingContext::bufferSubData):
(WebCore::WebGLRenderingContext::checkFramebufferStatus):
(WebCore::WebGLRenderingContext::clear):
(WebCore::WebGLRenderingContext::clearColor):
(WebCore::WebGLRenderingContext::clearDepth):
(WebCore::WebGLRenderingContext::clearStencil):
(WebCore::WebGLRenderingContext::colorMask):
(WebCore::WebGLRenderingContext::compileShader):
(WebCore::WebGLRenderingContext::compressedTexImage2D):
(WebCore::WebGLRenderingContext::compressedTexSubImage2D):
(WebCore::WebGLRenderingContext::copyTexImage2D):
(WebCore::WebGLRenderingContext::copyTexSubImage2D):
(WebCore::WebGLRenderingContext::createBuffer):
(WebCore::WebGLRenderingContext::createFramebuffer):
(WebCore::WebGLRenderingContext::createTexture):
(WebCore::WebGLRenderingContext::createProgram):
(WebCore::WebGLRenderingContext::createRenderbuffer):
(WebCore::WebGLRenderingContext::createShader):
(WebCore::WebGLRenderingContext::cullFace):
(WebCore::WebGLRenderingContext::deleteObject):
(WebCore::WebGLRenderingContext::depthFunc):
(WebCore::WebGLRenderingContext::depthMask):
(WebCore::WebGLRenderingContext::depthRange):
(WebCore::WebGLRenderingContext::detachShader):
(WebCore::WebGLRenderingContext::disable):
(WebCore::WebGLRenderingContext::disableVertexAttribArray):
(WebCore::WebGLRenderingContext::validateDrawArrays):
(WebCore::WebGLRenderingContext::validateDrawElements):
(WebCore::WebGLRenderingContext::enable):
(WebCore::WebGLRenderingContext::enableVertexAttribArray):
(WebCore::WebGLRenderingContext::finish):
(WebCore::WebGLRenderingContext::flush):
(WebCore::WebGLRenderingContext::framebufferRenderbuffer):
(WebCore::WebGLRenderingContext::framebufferTexture2D):
(WebCore::WebGLRenderingContext::frontFace):
(WebCore::WebGLRenderingContext::generateMipmap):
(WebCore::WebGLRenderingContext::getActiveAttrib):
(WebCore::WebGLRenderingContext::getActiveUniform):
(WebCore::WebGLRenderingContext::getAttachedShaders):
(WebCore::WebGLRenderingContext::getAttribLocation):
(WebCore::WebGLRenderingContext::getBufferParameter):
(WebCore::WebGLRenderingContext::getContextAttributes):
(WebCore::WebGLRenderingContext::getExtension):
(WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
(WebCore::WebGLRenderingContext::getParameter):
(WebCore::WebGLRenderingContext::getProgramParameter):
(WebCore::WebGLRenderingContext::getProgramInfoLog):
(WebCore::WebGLRenderingContext::getRenderbufferParameter):
(WebCore::WebGLRenderingContext::getShaderParameter):
(WebCore::WebGLRenderingContext::getShaderInfoLog):
(WebCore::WebGLRenderingContext::getShaderPrecisionFormat):
(WebCore::WebGLRenderingContext::getShaderSource):
(WebCore::WebGLRenderingContext::getTexParameter):
(WebCore::WebGLRenderingContext::getUniform):
(WebCore::WebGLRenderingContext::getUniformLocation):
(WebCore::WebGLRenderingContext::getVertexAttrib):
(WebCore::WebGLRenderingContext::getVertexAttribOffset):
(WebCore::WebGLRenderingContext::hint):
(WebCore::WebGLRenderingContext::isBuffer):
(WebCore::WebGLRenderingContext::isContextLostOrPending):
(WebCore::WebGLRenderingContext::isEnabled):
(WebCore::WebGLRenderingContext::isFramebuffer):
(WebCore::WebGLRenderingContext::isProgram):
(WebCore::WebGLRenderingContext::isRenderbuffer):
(WebCore::WebGLRenderingContext::isShader):
(WebCore::WebGLRenderingContext::isTexture):
(WebCore::WebGLRenderingContext::lineWidth):
(WebCore::WebGLRenderingContext::linkProgram):
(WebCore::WebGLRenderingContext::pixelStorei):
(WebCore::WebGLRenderingContext::polygonOffset):
(WebCore::WebGLRenderingContext::readPixels):
(WebCore::WebGLRenderingContext::releaseShaderCompiler):
(WebCore::WebGLRenderingContext::renderbufferStorage):
(WebCore::WebGLRenderingContext::sampleCoverage):
(WebCore::WebGLRenderingContext::scissor):
(WebCore::WebGLRenderingContext::shaderSource):
(WebCore::WebGLRenderingContext::stencilFunc):
(WebCore::WebGLRenderingContext::stencilFuncSeparate):
(WebCore::WebGLRenderingContext::stencilMask):
(WebCore::WebGLRenderingContext::stencilMaskSeparate):
(WebCore::WebGLRenderingContext::stencilOp):
(WebCore::WebGLRenderingContext::stencilOpSeparate):
(WebCore::WebGLRenderingContext::texImage2D):
(WebCore::WebGLRenderingContext::texParameter):
(WebCore::WebGLRenderingContext::texSubImage2D):
(WebCore::WebGLRenderingContext::uniform1f):
(WebCore::WebGLRenderingContext::uniform1fv):
(WebCore::WebGLRenderingContext::uniform1i):
(WebCore::WebGLRenderingContext::uniform1iv):
(WebCore::WebGLRenderingContext::uniform2f):
(WebCore::WebGLRenderingContext::uniform2fv):
(WebCore::WebGLRenderingContext::uniform2i):
(WebCore::WebGLRenderingContext::uniform2iv):
(WebCore::WebGLRenderingContext::uniform3f):
(WebCore::WebGLRenderingContext::uniform3fv):
(WebCore::WebGLRenderingContext::uniform3i):
(WebCore::WebGLRenderingContext::uniform3iv):
(WebCore::WebGLRenderingContext::uniform4f):
(WebCore::WebGLRenderingContext::uniform4fv):
(WebCore::WebGLRenderingContext::uniform4i):
(WebCore::WebGLRenderingContext::uniform4iv):
(WebCore::WebGLRenderingContext::uniformMatrix2fv):
(WebCore::WebGLRenderingContext::uniformMatrix3fv):
(WebCore::WebGLRenderingContext::uniformMatrix4fv):
(WebCore::WebGLRenderingContext::validateProgram):
(WebCore::WebGLRenderingContext::vertexAttribPointer):
(WebCore::WebGLRenderingContext::viewport):
(WebCore::WebGLRenderingContext::forceLostContext):
(WebCore::WebGLRenderingContext::forceRestoreContext):
(WebCore::WebGLRenderingContext::platformLayer):
(WebCore::WebGLRenderingContext::removeSharedObject):
(WebCore::WebGLRenderingContext::addSharedObject):
(WebCore::WebGLRenderingContext::removeContextObject):
(WebCore::WebGLRenderingContext::addContextObject):
(WebCore::WebGLRenderingContext::detachAndRemoveAllObjects):
(WebCore::WebGLRenderingContext::stop):
(WebCore::WebGLRenderingContext::vertexAttribfImpl):
(WebCore::WebGLRenderingContext::vertexAttribfvImpl):
(WebCore::WebGLRenderingContext::vertexAttribDivisor):
* html/canvas/WebGLRenderingContext.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLCanvasElementcpp">trunk/Source/WebCore/html/HTMLCanvasElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp">trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContexth">trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164451 => 164452)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-20 23:11:52 UTC (rev 164451)
+++ trunk/Source/WebCore/ChangeLog        2014-02-20 23:12:18 UTC (rev 164452)
</span><span class="lines">@@ -1,5 +1,163 @@
</span><span class="cx"> 2014-02-20 Dean Jackson <dino@apple.com>
</span><span class="cx">
</span><ins>+ An unresolved WebGL Context should operate normally until used
+ https://bugs.webkit.org/show_bug.cgi?id=129110
+
+ Reviewed by Brent Fulgham.
+
+ Add the ability to create a special instance of WebGLRenderingContext,
+ that appears normal but won't actually do anything if asked. This will
+ be created in the case of the WebGLLoadPolicy being "pending" and helps
+ in the case of pages that feature detect by creating a context and
+ immediately deleting it.
+
+ Note that the context doesn't actually try to recover from this state
+ yet, although that would be a nice addition. When asked to do something
+ it could actually try to create the GraphicsContext3D. However, if it
+ fails it would then have to fire a context lost.
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::getContext): Move the load policy code out of getContext.
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::create): Add the ability to create a pending context.
+ (WebCore::WebGLRenderingContext::WebGLRenderingContext): New constructor for a pending context.
+ (WebCore::WebGLRenderingContext::~WebGLRenderingContext): Only delete if not pending.
+ (WebCore::WebGLRenderingContext::destroyGraphicsContext3D): Ditto.
+ (WebCore::WebGLRenderingContext::clearIfComposited): Everything below is about checking the
+ pending state before doing anything, and triggering a resolution if necessary.
+ (WebCore::WebGLRenderingContext::activeTexture):
+ (WebCore::WebGLRenderingContext::attachShader):
+ (WebCore::WebGLRenderingContext::bindAttribLocation):
+ (WebCore::WebGLRenderingContext::checkObjectToBeBound):
+ (WebCore::WebGLRenderingContext::blendColor):
+ (WebCore::WebGLRenderingContext::blendEquation):
+ (WebCore::WebGLRenderingContext::blendEquationSeparate):
+ (WebCore::WebGLRenderingContext::blendFunc):
+ (WebCore::WebGLRenderingContext::blendFuncSeparate):
+ (WebCore::WebGLRenderingContext::bufferData):
+ (WebCore::WebGLRenderingContext::bufferSubData):
+ (WebCore::WebGLRenderingContext::checkFramebufferStatus):
+ (WebCore::WebGLRenderingContext::clear):
+ (WebCore::WebGLRenderingContext::clearColor):
+ (WebCore::WebGLRenderingContext::clearDepth):
+ (WebCore::WebGLRenderingContext::clearStencil):
+ (WebCore::WebGLRenderingContext::colorMask):
+ (WebCore::WebGLRenderingContext::compileShader):
+ (WebCore::WebGLRenderingContext::compressedTexImage2D):
+ (WebCore::WebGLRenderingContext::compressedTexSubImage2D):
+ (WebCore::WebGLRenderingContext::copyTexImage2D):
+ (WebCore::WebGLRenderingContext::copyTexSubImage2D):
+ (WebCore::WebGLRenderingContext::createBuffer):
+ (WebCore::WebGLRenderingContext::createFramebuffer):
+ (WebCore::WebGLRenderingContext::createTexture):
+ (WebCore::WebGLRenderingContext::createProgram):
+ (WebCore::WebGLRenderingContext::createRenderbuffer):
+ (WebCore::WebGLRenderingContext::createShader):
+ (WebCore::WebGLRenderingContext::cullFace):
+ (WebCore::WebGLRenderingContext::deleteObject):
+ (WebCore::WebGLRenderingContext::depthFunc):
+ (WebCore::WebGLRenderingContext::depthMask):
+ (WebCore::WebGLRenderingContext::depthRange):
+ (WebCore::WebGLRenderingContext::detachShader):
+ (WebCore::WebGLRenderingContext::disable):
+ (WebCore::WebGLRenderingContext::disableVertexAttribArray):
+ (WebCore::WebGLRenderingContext::validateDrawArrays):
+ (WebCore::WebGLRenderingContext::validateDrawElements):
+ (WebCore::WebGLRenderingContext::enable):
+ (WebCore::WebGLRenderingContext::enableVertexAttribArray):
+ (WebCore::WebGLRenderingContext::finish):
+ (WebCore::WebGLRenderingContext::flush):
+ (WebCore::WebGLRenderingContext::framebufferRenderbuffer):
+ (WebCore::WebGLRenderingContext::framebufferTexture2D):
+ (WebCore::WebGLRenderingContext::frontFace):
+ (WebCore::WebGLRenderingContext::generateMipmap):
+ (WebCore::WebGLRenderingContext::getActiveAttrib):
+ (WebCore::WebGLRenderingContext::getActiveUniform):
+ (WebCore::WebGLRenderingContext::getAttachedShaders):
+ (WebCore::WebGLRenderingContext::getAttribLocation):
+ (WebCore::WebGLRenderingContext::getBufferParameter):
+ (WebCore::WebGLRenderingContext::getContextAttributes):
+ (WebCore::WebGLRenderingContext::getExtension):
+ (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
+ (WebCore::WebGLRenderingContext::getParameter):
+ (WebCore::WebGLRenderingContext::getProgramParameter):
+ (WebCore::WebGLRenderingContext::getProgramInfoLog):
+ (WebCore::WebGLRenderingContext::getRenderbufferParameter):
+ (WebCore::WebGLRenderingContext::getShaderParameter):
+ (WebCore::WebGLRenderingContext::getShaderInfoLog):
+ (WebCore::WebGLRenderingContext::getShaderPrecisionFormat):
+ (WebCore::WebGLRenderingContext::getShaderSource):
+ (WebCore::WebGLRenderingContext::getTexParameter):
+ (WebCore::WebGLRenderingContext::getUniform):
+ (WebCore::WebGLRenderingContext::getUniformLocation):
+ (WebCore::WebGLRenderingContext::getVertexAttrib):
+ (WebCore::WebGLRenderingContext::getVertexAttribOffset):
+ (WebCore::WebGLRenderingContext::hint):
+ (WebCore::WebGLRenderingContext::isBuffer):
+ (WebCore::WebGLRenderingContext::isContextLostOrPending):
+ (WebCore::WebGLRenderingContext::isEnabled):
+ (WebCore::WebGLRenderingContext::isFramebuffer):
+ (WebCore::WebGLRenderingContext::isProgram):
+ (WebCore::WebGLRenderingContext::isRenderbuffer):
+ (WebCore::WebGLRenderingContext::isShader):
+ (WebCore::WebGLRenderingContext::isTexture):
+ (WebCore::WebGLRenderingContext::lineWidth):
+ (WebCore::WebGLRenderingContext::linkProgram):
+ (WebCore::WebGLRenderingContext::pixelStorei):
+ (WebCore::WebGLRenderingContext::polygonOffset):
+ (WebCore::WebGLRenderingContext::readPixels):
+ (WebCore::WebGLRenderingContext::releaseShaderCompiler):
+ (WebCore::WebGLRenderingContext::renderbufferStorage):
+ (WebCore::WebGLRenderingContext::sampleCoverage):
+ (WebCore::WebGLRenderingContext::scissor):
+ (WebCore::WebGLRenderingContext::shaderSource):
+ (WebCore::WebGLRenderingContext::stencilFunc):
+ (WebCore::WebGLRenderingContext::stencilFuncSeparate):
+ (WebCore::WebGLRenderingContext::stencilMask):
+ (WebCore::WebGLRenderingContext::stencilMaskSeparate):
+ (WebCore::WebGLRenderingContext::stencilOp):
+ (WebCore::WebGLRenderingContext::stencilOpSeparate):
+ (WebCore::WebGLRenderingContext::texImage2D):
+ (WebCore::WebGLRenderingContext::texParameter):
+ (WebCore::WebGLRenderingContext::texSubImage2D):
+ (WebCore::WebGLRenderingContext::uniform1f):
+ (WebCore::WebGLRenderingContext::uniform1fv):
+ (WebCore::WebGLRenderingContext::uniform1i):
+ (WebCore::WebGLRenderingContext::uniform1iv):
+ (WebCore::WebGLRenderingContext::uniform2f):
+ (WebCore::WebGLRenderingContext::uniform2fv):
+ (WebCore::WebGLRenderingContext::uniform2i):
+ (WebCore::WebGLRenderingContext::uniform2iv):
+ (WebCore::WebGLRenderingContext::uniform3f):
+ (WebCore::WebGLRenderingContext::uniform3fv):
+ (WebCore::WebGLRenderingContext::uniform3i):
+ (WebCore::WebGLRenderingContext::uniform3iv):
+ (WebCore::WebGLRenderingContext::uniform4f):
+ (WebCore::WebGLRenderingContext::uniform4fv):
+ (WebCore::WebGLRenderingContext::uniform4i):
+ (WebCore::WebGLRenderingContext::uniform4iv):
+ (WebCore::WebGLRenderingContext::uniformMatrix2fv):
+ (WebCore::WebGLRenderingContext::uniformMatrix3fv):
+ (WebCore::WebGLRenderingContext::uniformMatrix4fv):
+ (WebCore::WebGLRenderingContext::validateProgram):
+ (WebCore::WebGLRenderingContext::vertexAttribPointer):
+ (WebCore::WebGLRenderingContext::viewport):
+ (WebCore::WebGLRenderingContext::forceLostContext):
+ (WebCore::WebGLRenderingContext::forceRestoreContext):
+ (WebCore::WebGLRenderingContext::platformLayer):
+ (WebCore::WebGLRenderingContext::removeSharedObject):
+ (WebCore::WebGLRenderingContext::addSharedObject):
+ (WebCore::WebGLRenderingContext::removeContextObject):
+ (WebCore::WebGLRenderingContext::addContextObject):
+ (WebCore::WebGLRenderingContext::detachAndRemoveAllObjects):
+ (WebCore::WebGLRenderingContext::stop):
+ (WebCore::WebGLRenderingContext::vertexAttribfImpl):
+ (WebCore::WebGLRenderingContext::vertexAttribfvImpl):
+ (WebCore::WebGLRenderingContext::vertexAttribDivisor):
+ * html/canvas/WebGLRenderingContext.h:
+
+2014-02-20 Dean Jackson <dino@apple.com>
+
</ins><span class="cx"> Add an unresolved WebGLPolicy and an API to resolve it
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=129109
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCanvasElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (164451 => 164452)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp        2014-02-20 23:11:52 UTC (rev 164451)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp        2014-02-20 23:12:18 UTC (rev 164452)
</span><span class="lines">@@ -42,7 +42,6 @@
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "ImageData.h"
</span><span class="cx"> #include "MIMETypeRegistry.h"
</span><del>-#include "MainFrame.h"
</del><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "RenderHTMLCanvas.h"
</span><span class="cx"> #include "ScriptController.h"
</span><span class="lines">@@ -221,14 +220,6 @@
</span><span class="cx"> if (m_context && !m_context->is3d())
</span><span class="cx"> return nullptr;
</span><span class="cx"> if (!m_context) {
</span><del>- Document& topDocument = document().topDocument();
- Page* page = topDocument.page();
- if (page && !topDocument.url().isLocalFile()) {
- WebGLLoadPolicy policy = page->mainFrame().loader().client().webGLPolicyForURL(topDocument.url());
-
- if (policy == WebGLBlockCreation)
- return nullptr;
- }
</del><span class="cx"> m_context = WebGLRenderingContext::create(this, static_cast<WebGLContextAttributes*>(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></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (164451 => 164452)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2014-02-20 23:11:52 UTC (rev 164451)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2014-02-20 23:12:18 UTC (rev 164452)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "ANGLEInstancedArrays.h"
</span><span class="cx"> #include "CachedImage.h"
</span><span class="cx"> #include "DOMWindow.h"
</span><ins>+#include "Document.h"
</ins><span class="cx"> #include "EXTDrawBuffers.h"
</span><span class="cx"> #include "EXTTextureFilterAnisotropic.h"
</span><span class="cx"> #include "ExceptionCode.h"
</span><span class="lines">@@ -47,6 +48,7 @@
</span><span class="cx"> #include "ImageData.h"
</span><span class="cx"> #include "IntSize.h"
</span><span class="cx"> #include "Logging.h"
</span><ins>+#include "MainFrame.h"
</ins><span class="cx"> #include "NotImplemented.h"
</span><span class="cx"> #include "OESElementIndexUint.h"
</span><span class="cx"> #include "OESStandardDerivatives.h"
</span><span class="lines">@@ -392,14 +394,30 @@
</span><span class="cx"> if (!frame)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- // The FrameLoaderClient might creation of a new WebGL context despite the page settings; in
</del><ins>+ // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in
</ins><span class="cx"> // particular, if WebGL contexts were lost one or more times via the GL_ARB_robustness extension.
</span><span class="cx"> if (!frame->loader().client().allowWebGL(frame->settings().webGLEnabled())) {
</span><span class="cx"> canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Web page was not allowed to create a WebGL context."));
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- HostWindow* hostWindow = document.view()->root()->hostWindow();
</del><ins>+ bool isPendingPolicyResolution = false;
+ Document& topDocument = document.topDocument();
+ Page* page = topDocument.page();
+ if (page && !topDocument.url().isLocalFile()) {
+ WebGLLoadPolicy policy = page->mainFrame().loader().client().webGLPolicyForURL(topDocument.url());
+
+ if (policy == WebGLBlockCreation) {
+ LOG(WebGL, "The policy for this URL (%s) is to block WebGL.", topDocument.url().host().utf8().data());
+ return nullptr;
+ }
+
+ if (policy == WebGLPendingCreation) {
+ LOG(WebGL, "WebGL policy is pending. May need to be resolved later.");
+ isPendingPolicyResolution = true;
+ }
+ }
+
</ins><span class="cx"> GraphicsContext3D::Attributes attributes = attrs ? attrs->attributes() : GraphicsContext3D::Attributes();
</span><span class="cx">
</span><span class="cx"> if (attributes.antialias) {
</span><span class="lines">@@ -417,6 +435,14 @@
</span><span class="cx"> if (frame->settings().forceSoftwareWebGLRendering())
</span><span class="cx"> attributes.forceSoftwareRenderer = true;
</span><span class="cx">
</span><ins>+ if (isPendingPolicyResolution) {
+ LOG(WebGL, "Create a WebGL context that looks real, but will require a policy resolution if used.");
+ OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRenderingContext(canvas, attributes));
+ renderingContext->suspendIfNeeded();
+ return renderingContext.release();
+ }
+
+ HostWindow* hostWindow = document.view()->root()->hostWindow();
</ins><span class="cx"> RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes, hostWindow));
</span><span class="cx">
</span><span class="cx"> if (!context || !context->makeContextCurrent()) {
</span><span class="lines">@@ -434,8 +460,27 @@
</span><span class="cx"> return renderingContext.release();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, GraphicsContext3D::Attributes attributes)
+ : CanvasRenderingContext(passedCanvas)
+ , ActiveDOMObject(&passedCanvas->document())
+ , m_context(0)
+ , m_drawingBuffer(0)
+ , m_dispatchContextLostEventTimer(this, &WebGLRenderingContext::dispatchContextLostEvent)
+ , m_restoreAllowed(false)
+ , m_restoreTimer(this, &WebGLRenderingContext::maybeRestoreContext)
+ , m_generatedImageCache(0)
+ , m_contextLost(false)
+ , m_contextLostMode(SyntheticLostContext)
+ , m_attributes(attributes)
+ , m_synthesizedErrorsToConsole(true)
+ , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole)
+ , m_isPendingPolicyResolution(true)
+ , m_hasRequestedPolicyResolution(false)
+{
+}
+
</ins><span class="cx"> WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassRefPtr<GraphicsContext3D> context,
</span><del>- GraphicsContext3D::Attributes attributes)
</del><ins>+ GraphicsContext3D::Attributes attributes)
</ins><span class="cx"> : CanvasRenderingContext(passedCanvas)
</span><span class="cx"> , ActiveDOMObject(&passedCanvas->document())
</span><span class="cx"> , m_context(context)
</span><span class="lines">@@ -449,6 +494,8 @@
</span><span class="cx"> , m_attributes(attributes)
</span><span class="cx"> , m_synthesizedErrorsToConsole(true)
</span><span class="cx"> , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole)
</span><ins>+ , m_isPendingPolicyResolution(false)
+ , m_hasRequestedPolicyResolution(false)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_context);
</span><span class="cx"> m_contextGroup = WebGLContextGroup::create();
</span><span class="lines">@@ -598,13 +645,18 @@
</span><span class="cx"> m_blackTexture2D = nullptr;
</span><span class="cx"> m_blackTextureCubeMap = nullptr;
</span><span class="cx">
</span><del>- detachAndRemoveAllObjects();
- destroyGraphicsContext3D();
- m_contextGroup->removeContext(this);
</del><ins>+ if (!m_isPendingPolicyResolution) {
+ detachAndRemoveAllObjects();
+ destroyGraphicsContext3D();
+ m_contextGroup->removeContext(this);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::destroyGraphicsContext3D()
</span><span class="cx"> {
</span><ins>+ if (m_isPendingPolicyResolution)
+ return;
+
</ins><span class="cx"> // The drawing buffer holds a context reference. It must also be destroyed
</span><span class="cx"> // in order for the context to be released.
</span><span class="cx"> if (m_drawingBuffer)
</span><span class="lines">@@ -643,7 +695,7 @@
</span><span class="cx">
</span><span class="cx"> bool WebGLRenderingContext::clearIfComposited(GC3Dbitfield mask)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (!m_context->layerComposited() || m_layerCleared
</span><span class="lines">@@ -840,7 +892,7 @@
</span><span class="cx"> void WebGLRenderingContext::activeTexture(GC3Denum texture, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (texture - GraphicsContext3D::TEXTURE0 >= m_textureUnits.size()) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "activeTexture", "texture unit out of range");
</span><span class="lines">@@ -856,7 +908,7 @@
</span><span class="cx"> void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* shader, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("attachShader", program) || !validateWebGLObject("attachShader", shader))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("attachShader", program) || !validateWebGLObject("attachShader", shader))
</ins><span class="cx"> return;
</span><span class="cx"> if (!program->attachShader(shader)) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "attachShader", "shader attachment already has shader");
</span><span class="lines">@@ -869,7 +921,7 @@
</span><span class="cx"> void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, GC3Duint index, const String& name, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("bindAttribLocation", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("bindAttribLocation", program))
</ins><span class="cx"> return;
</span><span class="cx"> if (!validateLocationLength("bindAttribLocation", name))
</span><span class="cx"> return;
</span><span class="lines">@@ -889,7 +941,7 @@
</span><span class="cx"> bool WebGLRenderingContext::checkObjectToBeBound(const char* functionName, WebGLObject* object, bool& deleted)
</span><span class="cx"> {
</span><span class="cx"> deleted = false;
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return false;
</span><span class="cx"> if (object) {
</span><span class="cx"> if (!object->validate(contextGroup(), this)) {
</span><span class="lines">@@ -1013,21 +1065,21 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::blendColor(GC3Dfloat red, GC3Dfloat green, GC3Dfloat blue, GC3Dfloat alpha)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->blendColor(red, green, blue, alpha);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::blendEquation(GC3Denum mode)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateBlendEquation("blendEquation", mode))
</del><ins>+ if (isContextLostOrPending() || !validateBlendEquation("blendEquation", mode))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->blendEquation(mode);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::blendEquationSeparate(GC3Denum modeRGB, GC3Denum modeAlpha)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateBlendEquation("blendEquation", modeRGB) || !validateBlendEquation("blendEquation", modeAlpha))
</del><ins>+ if (isContextLostOrPending() || !validateBlendEquation("blendEquation", modeRGB) || !validateBlendEquation("blendEquation", modeAlpha))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->blendEquationSeparate(modeRGB, modeAlpha);
</span><span class="cx"> }
</span><span class="lines">@@ -1035,7 +1087,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::blendFunc(GC3Denum sfactor, GC3Denum dfactor)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateBlendFuncFactors("blendFunc", sfactor, dfactor))
</del><ins>+ if (isContextLostOrPending() || !validateBlendFuncFactors("blendFunc", sfactor, dfactor))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->blendFunc(sfactor, dfactor);
</span><span class="cx"> }
</span><span class="lines">@@ -1043,7 +1095,7 @@
</span><span class="cx"> void WebGLRenderingContext::blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB, GC3Denum srcAlpha, GC3Denum dstAlpha)
</span><span class="cx"> {
</span><span class="cx"> // Note: Alpha does not have the same restrictions as RGB.
</span><del>- if (isContextLost() || !validateBlendFuncFactors("blendFunc", srcRGB, dstRGB))
</del><ins>+ if (isContextLostOrPending() || !validateBlendFuncFactors("blendFunc", srcRGB, dstRGB))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
</span><span class="cx"> }
</span><span class="lines">@@ -1051,7 +1103,7 @@
</span><span class="cx"> void WebGLRenderingContext::bufferData(GC3Denum target, long long size, GC3Denum usage, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
</span><span class="cx"> if (!buffer)
</span><span class="lines">@@ -1077,7 +1129,7 @@
</span><span class="cx"> void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
</span><span class="cx"> if (!buffer)
</span><span class="lines">@@ -1099,7 +1151,7 @@
</span><span class="cx"> void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBufferView* data, GC3Denum usage, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
</span><span class="cx"> if (!buffer)
</span><span class="lines">@@ -1121,7 +1173,7 @@
</span><span class="cx"> void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> WebGLBuffer* buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
</span><span class="cx"> if (!buffer)
</span><span class="lines">@@ -1145,7 +1197,7 @@
</span><span class="cx"> void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, ArrayBufferView* data, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> WebGLBuffer* buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
</span><span class="cx"> if (!buffer)
</span><span class="lines">@@ -1168,7 +1220,7 @@
</span><span class="cx">
</span><span class="cx"> GC3Denum WebGLRenderingContext::checkFramebufferStatus(GC3Denum target)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return GraphicsContext3D::FRAMEBUFFER_UNSUPPORTED;
</span><span class="cx"> if (target != GraphicsContext3D::FRAMEBUFFER) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "checkFramebufferStatus", "invalid target");
</span><span class="lines">@@ -1188,7 +1240,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::clear(GC3Dbitfield mask)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (mask & ~(GraphicsContext3D::COLOR_BUFFER_BIT | GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_BUFFER_BIT)) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "clear", "invalid mask");
</span><span class="lines">@@ -1206,7 +1258,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::clearColor(GC3Dfloat r, GC3Dfloat g, GC3Dfloat b, GC3Dfloat a)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (std::isnan(r))
</span><span class="cx"> r = 0;
</span><span class="lines">@@ -1225,7 +1277,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::clearDepth(GC3Dfloat depth)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_clearDepth = depth;
</span><span class="cx"> m_context->clearDepth(depth);
</span><span class="lines">@@ -1233,7 +1285,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::clearStencil(GC3Dint s)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_clearStencil = s;
</span><span class="cx"> m_context->clearStencil(s);
</span><span class="lines">@@ -1241,7 +1293,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::colorMask(GC3Dboolean red, GC3Dboolean green, GC3Dboolean blue, GC3Dboolean alpha)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_colorMask[0] = red;
</span><span class="cx"> m_colorMask[1] = green;
</span><span class="lines">@@ -1253,7 +1305,7 @@
</span><span class="cx"> void WebGLRenderingContext::compileShader(WebGLShader* shader, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("compileShader", shader))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("compileShader", shader))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->compileShader(objectOrZero(shader));
</span><span class="cx"> GC3Dint value;
</span><span class="lines">@@ -1264,7 +1316,7 @@
</span><span class="cx"> void WebGLRenderingContext::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width,
</span><span class="cx"> GC3Dsizei height, GC3Dint border, ArrayBufferView* data)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!validateTexFuncLevel("compressedTexImage2D", target, level))
</span><span class="cx"> return;
</span><span class="lines">@@ -1300,7 +1352,7 @@
</span><span class="cx"> void WebGLRenderingContext::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
</span><span class="cx"> GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!validateTexFuncLevel("compressedTexSubImage2D", target, level))
</span><span class="cx"> return;
</span><span class="lines">@@ -1339,7 +1391,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!validateTexFuncParameters("copyTexImage2D", NotTexSubImage2D, target, level, internalformat, width, height, border, internalformat, GraphicsContext3D::UNSIGNED_BYTE))
</span><span class="cx"> return;
</span><span class="lines">@@ -1385,7 +1437,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::copyTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!validateTexFuncLevel("copyTexSubImage2D", target, level))
</span><span class="cx"> return;
</span><span class="lines">@@ -1455,7 +1507,7 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<WebGLBuffer> WebGLRenderingContext::createBuffer()
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx"> RefPtr<WebGLBuffer> o = WebGLBuffer::create(this);
</span><span class="cx"> addSharedObject(o.get());
</span><span class="lines">@@ -1464,7 +1516,7 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<WebGLFramebuffer> WebGLRenderingContext::createFramebuffer()
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx"> RefPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this);
</span><span class="cx"> addContextObject(o.get());
</span><span class="lines">@@ -1473,7 +1525,7 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<WebGLTexture> WebGLRenderingContext::createTexture()
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx"> RefPtr<WebGLTexture> o = WebGLTexture::create(this);
</span><span class="cx"> addSharedObject(o.get());
</span><span class="lines">@@ -1482,7 +1534,7 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<WebGLProgram> WebGLRenderingContext::createProgram()
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx"> RefPtr<WebGLProgram> o = WebGLProgram::create(this);
</span><span class="cx"> addSharedObject(o.get());
</span><span class="lines">@@ -1491,7 +1543,7 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<WebGLRenderbuffer> WebGLRenderingContext::createRenderbuffer()
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx"> RefPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this);
</span><span class="cx"> addSharedObject(o.get());
</span><span class="lines">@@ -1501,7 +1553,7 @@
</span><span class="cx"> PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(GC3Denum type, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx"> if (type != GraphicsContext3D::VERTEX_SHADER && type != GraphicsContext3D::FRAGMENT_SHADER) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "createShader", "invalid shader type");
</span><span class="lines">@@ -1515,14 +1567,14 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::cullFace(GC3Denum mode)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->cullFace(mode);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool WebGLRenderingContext::deleteObject(WebGLObject* object)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !object)
</del><ins>+ if (isContextLostOrPending() || !object)
</ins><span class="cx"> return false;
</span><span class="cx"> if (!object->validate(contextGroup(), this)) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "delete", "object does not belong to this context");
</span><span class="lines">@@ -1598,14 +1650,14 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::depthFunc(GC3Denum func)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->depthFunc(func);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::depthMask(GC3Dboolean flag)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_depthMask = flag;
</span><span class="cx"> m_context->depthMask(flag);
</span><span class="lines">@@ -1613,7 +1665,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::depthRange(GC3Dfloat zNear, GC3Dfloat zFar)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (zNear > zFar) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "depthRange", "zNear > zFar");
</span><span class="lines">@@ -1625,7 +1677,7 @@
</span><span class="cx"> void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* shader, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("detachShader", program) || !validateWebGLObject("detachShader", shader))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("detachShader", program) || !validateWebGLObject("detachShader", shader))
</ins><span class="cx"> return;
</span><span class="cx"> if (!program->detachShader(shader)) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "detachShader", "shader not attached");
</span><span class="lines">@@ -1637,7 +1689,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::disable(GC3Denum cap)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateCapability("disable", cap))
</del><ins>+ if (isContextLostOrPending() || !validateCapability("disable", cap))
</ins><span class="cx"> return;
</span><span class="cx"> if (cap == GraphicsContext3D::STENCIL_TEST) {
</span><span class="cx"> m_stencilEnabled = false;
</span><span class="lines">@@ -1655,7 +1707,7 @@
</span><span class="cx"> void WebGLRenderingContext::disableVertexAttribArray(GC3Duint index, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (index >= m_maxVertexAttribs) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "disableVertexAttribArray", "index out of range");
</span><span class="lines">@@ -1886,7 +1938,7 @@
</span><span class="cx">
</span><span class="cx"> bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateDrawMode(functionName, mode))
</del><ins>+ if (isContextLostOrPending() || !validateDrawMode(functionName, mode))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (!validateStencilSettings(functionName))
</span><span class="lines">@@ -1957,7 +2009,7 @@
</span><span class="cx">
</span><span class="cx"> bool WebGLRenderingContext::validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateDrawMode(functionName, mode))
</del><ins>+ if (isContextLostOrPending() || !validateDrawMode(functionName, mode))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (!validateStencilSettings(functionName))
</span><span class="lines">@@ -2050,7 +2102,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::enable(GC3Denum cap)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateCapability("enable", cap))
</del><ins>+ if (isContextLostOrPending() || !validateCapability("enable", cap))
</ins><span class="cx"> return;
</span><span class="cx"> if (cap == GraphicsContext3D::STENCIL_TEST) {
</span><span class="cx"> m_stencilEnabled = true;
</span><span class="lines">@@ -2068,7 +2120,7 @@
</span><span class="cx"> void WebGLRenderingContext::enableVertexAttribArray(GC3Duint index, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (index >= m_maxVertexAttribs) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "enableVertexAttribArray", "index out of range");
</span><span class="lines">@@ -2083,14 +2135,14 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::finish()
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->finish();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::flush()
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->flush();
</span><span class="cx"> }
</span><span class="lines">@@ -2098,7 +2150,7 @@
</span><span class="cx"> void WebGLRenderingContext::framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer* buffer, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateFramebufferFuncParameters("framebufferRenderbuffer", target, attachment))
</del><ins>+ if (isContextLostOrPending() || !validateFramebufferFuncParameters("framebufferRenderbuffer", target, attachment))
</ins><span class="cx"> return;
</span><span class="cx"> if (renderbuffertarget != GraphicsContext3D::RENDERBUFFER) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "framebufferRenderbuffer", "invalid target");
</span><span class="lines">@@ -2131,7 +2183,7 @@
</span><span class="cx"> void WebGLRenderingContext::framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture* texture, GC3Dint level, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateFramebufferFuncParameters("framebufferTexture2D", target, attachment))
</del><ins>+ if (isContextLostOrPending() || !validateFramebufferFuncParameters("framebufferTexture2D", target, attachment))
</ins><span class="cx"> return;
</span><span class="cx"> if (level) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "framebufferTexture2D", "level not 0");
</span><span class="lines">@@ -2169,14 +2221,14 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::frontFace(GC3Denum mode)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->frontFace(mode);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::generateMipmap(GC3Denum target)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> WebGLTexture* tex = validateTextureBinding("generateMipmap", target, false);
</span><span class="cx"> if (!tex)
</span><span class="lines">@@ -2213,7 +2265,7 @@
</span><span class="cx"> PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram* program, GC3Duint index, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("getActiveAttrib", program))
</ins><span class="cx"> return 0;
</span><span class="cx"> ActiveInfo info;
</span><span class="cx"> if (!m_context->getActiveAttrib(objectOrZero(program), index, info))
</span><span class="lines">@@ -2227,7 +2279,7 @@
</span><span class="cx"> PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveUniform(WebGLProgram* program, GC3Duint index, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("getActiveUniform", program))
</ins><span class="cx"> return 0;
</span><span class="cx"> ActiveInfo info;
</span><span class="cx"> if (!m_context->getActiveUniform(objectOrZero(program), index, info))
</span><span class="lines">@@ -2245,7 +2297,7 @@
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><span class="cx"> shaderObjects.clear();
</span><del>- if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("getAttachedShaders", program))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> const GC3Denum shaderType[] = {
</span><span class="lines">@@ -2262,7 +2314,7 @@
</span><span class="cx">
</span><span class="cx"> GC3Dint WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const String& name)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateWebGLObject("getAttribLocation", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("getAttribLocation", program))
</ins><span class="cx"> return -1;
</span><span class="cx"> if (!validateLocationLength("getAttribLocation", name))
</span><span class="cx"> return -1;
</span><span class="lines">@@ -2280,7 +2332,7 @@
</span><span class="cx"> WebGLGetInfo WebGLRenderingContext::getBufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return WebGLGetInfo();
</span><span class="cx"> if (target != GraphicsContext3D::ARRAY_BUFFER && target != GraphicsContext3D::ELEMENT_ARRAY_BUFFER) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getBufferParameter", "invalid target");
</span><span class="lines">@@ -2301,7 +2353,7 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<WebGLContextAttributes> WebGLRenderingContext::getContextAttributes()
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx"> // We always need to return a new WebGLContextAttributes object to
</span><span class="cx"> // prevent the user from mutating any cached version.
</span><span class="lines">@@ -2329,7 +2381,7 @@
</span><span class="cx">
</span><span class="cx"> WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><span class="cx"> if (equalIgnoringCase(name, "WEBKIT_EXT_texture_filter_anisotropic")
</span><span class="lines">@@ -2460,7 +2512,7 @@
</span><span class="cx"> WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateFramebufferFuncParameters("getFramebufferAttachmentParameter", target, attachment))
</del><ins>+ if (isContextLostOrPending() || !validateFramebufferFuncParameters("getFramebufferAttachmentParameter", target, attachment))
</ins><span class="cx"> return WebGLGetInfo();
</span><span class="cx">
</span><span class="cx"> if (!m_framebufferBinding || !m_framebufferBinding->object()) {
</span><span class="lines">@@ -2512,7 +2564,7 @@
</span><span class="cx"> WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return WebGLGetInfo();
</span><span class="cx"> const int intZero = 0;
</span><span class="cx"> switch (pname) {
</span><span class="lines">@@ -2750,7 +2802,7 @@
</span><span class="cx"> WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, GC3Denum pname, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("getProgramParameter", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("getProgramParameter", program))
</ins><span class="cx"> return WebGLGetInfo();
</span><span class="cx">
</span><span class="cx"> GC3Dint value = 0;
</span><span class="lines">@@ -2778,7 +2830,7 @@
</span><span class="cx"> String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return String();
</span><span class="cx"> if (!validateWebGLObject("getProgramInfoLog", program))
</span><span class="cx"> return "";
</span><span class="lines">@@ -2788,7 +2840,7 @@
</span><span class="cx"> WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return WebGLGetInfo();
</span><span class="cx"> if (target != GraphicsContext3D::RENDERBUFFER) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getRenderbufferParameter", "invalid target");
</span><span class="lines">@@ -2854,7 +2906,7 @@
</span><span class="cx"> WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, GC3Denum pname, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("getShaderParameter", shader))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("getShaderParameter", shader))
</ins><span class="cx"> return WebGLGetInfo();
</span><span class="cx"> GC3Dint value = 0;
</span><span class="cx"> switch (pname) {
</span><span class="lines">@@ -2875,7 +2927,7 @@
</span><span class="cx"> String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return String();
</span><span class="cx"> if (!validateWebGLObject("getShaderInfoLog", shader))
</span><span class="cx"> return "";
</span><span class="lines">@@ -2885,7 +2937,7 @@
</span><span class="cx"> PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContext::getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx"> switch (shaderType) {
</span><span class="cx"> case GraphicsContext3D::VERTEX_SHADER:
</span><span class="lines">@@ -2917,7 +2969,7 @@
</span><span class="cx"> String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return String();
</span><span class="cx"> if (!validateWebGLObject("getShaderSource", shader))
</span><span class="cx"> return "";
</span><span class="lines">@@ -2969,7 +3021,7 @@
</span><span class="cx"> WebGLGetInfo WebGLRenderingContext::getTexParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return WebGLGetInfo();
</span><span class="cx"> WebGLTexture* tex = validateTextureBinding("getTexParameter", target, false);
</span><span class="cx"> if (!tex)
</span><span class="lines">@@ -2998,7 +3050,7 @@
</span><span class="cx"> WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebGLUniformLocation* uniformLocation, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("getUniform", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("getUniform", program))
</ins><span class="cx"> return WebGLGetInfo();
</span><span class="cx"> if (!uniformLocation || uniformLocation->program() != program) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "getUniform", "no uniformlocation or not valid for this program");
</span><span class="lines">@@ -3126,7 +3178,7 @@
</span><span class="cx"> PassRefPtr<WebGLUniformLocation> WebGLRenderingContext::getUniformLocation(WebGLProgram* program, const String& name, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("getUniformLocation", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("getUniformLocation", program))
</ins><span class="cx"> return nullptr;
</span><span class="cx"> if (!validateLocationLength("getUniformLocation", name))
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -3166,7 +3218,7 @@
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><span class="cx">
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return WebGLGetInfo();
</span><span class="cx">
</span><span class="cx"> if (index >= m_maxVertexAttribs) {
</span><span class="lines">@@ -3206,7 +3258,7 @@
</span><span class="cx">
</span><span class="cx"> long long WebGLRenderingContext::getVertexAttribOffset(GC3Duint index, GC3Denum pname)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx"> GC3Dsizeiptr result = m_context->getVertexAttribOffset(index, pname);
</span><span class="cx"> return static_cast<long long>(result);
</span><span class="lines">@@ -3214,7 +3266,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::hint(GC3Denum target, GC3Denum mode)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> bool isValid = false;
</span><span class="cx"> switch (target) {
</span><span class="lines">@@ -3235,7 +3287,7 @@
</span><span class="cx">
</span><span class="cx"> GC3Dboolean WebGLRenderingContext::isBuffer(WebGLBuffer* buffer)
</span><span class="cx"> {
</span><del>- if (!buffer || isContextLost())
</del><ins>+ if (!buffer || isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><span class="cx"> if (!buffer->hasEverBeenBound())
</span><span class="lines">@@ -3249,9 +3301,27 @@
</span><span class="cx"> return m_contextLost;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool WebGLRenderingContext::isContextLostOrPending()
+{
+ if (m_isPendingPolicyResolution && !m_hasRequestedPolicyResolution) {
+ LOG(WebGL, "Context is being used. Attempt to resolve the policy.");
+ Document& document = canvas()->document().topDocument();
+ Page* page = document.page();
+ if (page && !document.url().isLocalFile())
+ page->mainFrame().loader().client().resolveWebGLPolicyForURL(document.url());
+ // FIXME: We don't currently do anything with the result from resolution. A more
+ // complete implementation might try to construct a real context, etc and proceed
+ // with normal operation.
+ // https://bugs.webkit.org/show_bug.cgi?id=129122
+ m_hasRequestedPolicyResolution = true;
+ }
+
+ return m_contextLost || m_isPendingPolicyResolution;
+}
+
</ins><span class="cx"> GC3Dboolean WebGLRenderingContext::isEnabled(GC3Denum cap)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateCapability("isEnabled", cap))
</del><ins>+ if (isContextLostOrPending() || !validateCapability("isEnabled", cap))
</ins><span class="cx"> return 0;
</span><span class="cx"> if (cap == GraphicsContext3D::STENCIL_TEST)
</span><span class="cx"> return m_stencilEnabled;
</span><span class="lines">@@ -3260,7 +3330,7 @@
</span><span class="cx">
</span><span class="cx"> GC3Dboolean WebGLRenderingContext::isFramebuffer(WebGLFramebuffer* framebuffer)
</span><span class="cx"> {
</span><del>- if (!framebuffer || isContextLost())
</del><ins>+ if (!framebuffer || isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><span class="cx"> if (!framebuffer->hasEverBeenBound())
</span><span class="lines">@@ -3271,7 +3341,7 @@
</span><span class="cx">
</span><span class="cx"> GC3Dboolean WebGLRenderingContext::isProgram(WebGLProgram* program)
</span><span class="cx"> {
</span><del>- if (!program || isContextLost())
</del><ins>+ if (!program || isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><span class="cx"> return m_context->isProgram(program->object());
</span><span class="lines">@@ -3279,7 +3349,7 @@
</span><span class="cx">
</span><span class="cx"> GC3Dboolean WebGLRenderingContext::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
</span><span class="cx"> {
</span><del>- if (!renderbuffer || isContextLost())
</del><ins>+ if (!renderbuffer || isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><span class="cx"> if (!renderbuffer->hasEverBeenBound())
</span><span class="lines">@@ -3290,7 +3360,7 @@
</span><span class="cx">
</span><span class="cx"> GC3Dboolean WebGLRenderingContext::isShader(WebGLShader* shader)
</span><span class="cx"> {
</span><del>- if (!shader || isContextLost())
</del><ins>+ if (!shader || isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><span class="cx"> return m_context->isShader(shader->object());
</span><span class="lines">@@ -3298,7 +3368,7 @@
</span><span class="cx">
</span><span class="cx"> GC3Dboolean WebGLRenderingContext::isTexture(WebGLTexture* texture)
</span><span class="cx"> {
</span><del>- if (!texture || isContextLost())
</del><ins>+ if (!texture || isContextLostOrPending())
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><span class="cx"> if (!texture->hasEverBeenBound())
</span><span class="lines">@@ -3309,7 +3379,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::lineWidth(GC3Dfloat width)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->lineWidth(width);
</span><span class="cx"> }
</span><span class="lines">@@ -3317,7 +3387,7 @@
</span><span class="cx"> void WebGLRenderingContext::linkProgram(WebGLProgram* program, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("linkProgram", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("linkProgram", program))
</ins><span class="cx"> return;
</span><span class="cx"> if (!isGLES2Compliant()) {
</span><span class="cx"> WebGLShader* vertexShader = program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER);
</span><span class="lines">@@ -3334,7 +3404,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::pixelStorei(GC3Denum pname, GC3Dint param)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> switch (pname) {
</span><span class="cx"> case GraphicsContext3D::UNPACK_FLIP_Y_WEBGL:
</span><span class="lines">@@ -3372,14 +3442,14 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::polygonOffset(GC3Dfloat factor, GC3Dfloat units)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->polygonOffset(factor, units);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode&)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> // Due to WebGL's same-origin restrictions, it is not possible to
</span><span class="cx"> // taint the origin using the WebGL API.
</span><span class="lines">@@ -3469,14 +3539,14 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::releaseShaderCompiler()
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->releaseShaderCompiler();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (target != GraphicsContext3D::RENDERBUFFER) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "renderbufferStorage", "invalid target");
</span><span class="lines">@@ -3516,14 +3586,14 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::sampleCoverage(GC3Dfloat value, GC3Dboolean invert)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->sampleCoverage(value, invert);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::scissor(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!validateSize("scissor", width, height))
</span><span class="cx"> return;
</span><span class="lines">@@ -3533,7 +3603,7 @@
</span><span class="cx"> void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& string, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("shaderSource", shader))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("shaderSource", shader))
</ins><span class="cx"> return;
</span><span class="cx"> String stringWithoutComments = StripComments(string).result();
</span><span class="cx"> if (!validateString("shaderSource", stringWithoutComments))
</span><span class="lines">@@ -3544,7 +3614,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::stencilFunc(GC3Denum func, GC3Dint ref, GC3Duint mask)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!validateStencilFunc("stencilFunc", func))
</span><span class="cx"> return;
</span><span class="lines">@@ -3557,7 +3627,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::stencilFuncSeparate(GC3Denum face, GC3Denum func, GC3Dint ref, GC3Duint mask)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!validateStencilFunc("stencilFuncSeparate", func))
</span><span class="cx"> return;
</span><span class="lines">@@ -3585,7 +3655,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::stencilMask(GC3Duint mask)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_stencilMask = mask;
</span><span class="cx"> m_stencilMaskBack = mask;
</span><span class="lines">@@ -3594,7 +3664,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::stencilMaskSeparate(GC3Denum face, GC3Duint mask)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> switch (face) {
</span><span class="cx"> case GraphicsContext3D::FRONT_AND_BACK:
</span><span class="lines">@@ -3616,14 +3686,14 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::stencilOp(GC3Denum fail, GC3Denum zfail, GC3Denum zpass)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->stencilOp(fail, zfail, zpass);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::stencilOpSeparate(GC3Denum face, GC3Denum fail, GC3Denum zfail, GC3Denum zpass)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> m_context->stencilOpSeparate(face, fail, zfail, zpass);
</span><span class="cx"> }
</span><span class="lines">@@ -3734,7 +3804,7 @@
</span><span class="cx"> GC3Dsizei width, GC3Dsizei height, GC3Dint border,
</span><span class="cx"> GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode& ec)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateTexFuncData("texImage2D", level, width, height, format, type, pixels, NullAllowed)
</del><ins>+ if (isContextLostOrPending() || !validateTexFuncData("texImage2D", level, width, height, format, type, pixels, NullAllowed)
</ins><span class="cx"> || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceArrayBufferView, target, level, internalformat, width, height, border, format, type, 0, 0))
</span><span class="cx"> return;
</span><span class="cx"> void* data = pixels ? pixels->baseAddress() : 0;
</span><span class="lines">@@ -3762,7 +3832,7 @@
</span><span class="cx"> GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> ec = 0;
</span><del>- if (isContextLost() || !pixels || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceImageData, target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, 0, 0))
</del><ins>+ if (isContextLostOrPending() || !pixels || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceImageData, target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, 0, 0))
</ins><span class="cx"> return;
</span><span class="cx"> Vector<uint8_t> data;
</span><span class="cx"> bool needConversion = true;
</span><span class="lines">@@ -3803,7 +3873,7 @@
</span><span class="cx"> GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> ec = 0;
</span><del>- if (isContextLost() || !validateHTMLImageElement("texImage2D", image, ec))
</del><ins>+ if (isContextLostOrPending() || !validateHTMLImageElement("texImage2D", image, ec))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image->renderer());
</span><span class="lines">@@ -3820,7 +3890,7 @@
</span><span class="cx"> GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> ec = 0;
</span><del>- if (isContextLost() || !validateHTMLCanvasElement("texImage2D", canvas, ec) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLCanvasElement, target, level, internalformat, canvas->width(), canvas->height(), 0, format, type, 0, 0))
</del><ins>+ if (isContextLostOrPending() || !validateHTMLCanvasElement("texImage2D", canvas, ec) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLCanvasElement, target, level, internalformat, canvas->width(), canvas->height(), 0, format, type, 0, 0))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> WebGLTexture* texture = validateTextureBinding("texImage2D", target, true);
</span><span class="lines">@@ -3864,7 +3934,7 @@
</span><span class="cx"> GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> ec = 0;
</span><del>- if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, ec)
</del><ins>+ if (isContextLostOrPending() || !validateHTMLVideoElement("texImage2D", video, ec)
</ins><span class="cx"> || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLVideoElement, target, level, internalformat, video->videoWidth(), video->videoHeight(), 0, format, type, 0, 0))
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -3894,7 +3964,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::texParameter(GC3Denum target, GC3Denum pname, GC3Dfloat paramf, GC3Dint parami, bool isFloat)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> WebGLTexture* tex = validateTextureBinding("texParameter", target, false);
</span><span class="cx"> if (!tex)
</span><span class="lines">@@ -3996,7 +4066,7 @@
</span><span class="cx"> GC3Dsizei width, GC3Dsizei height,
</span><span class="cx"> GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode& ec)
</span><span class="cx"> {
</span><del>- if (isContextLost() || !validateTexFuncData("texSubImage2D", level, width, height, format, type, pixels, NullNotAllowed)
</del><ins>+ if (isContextLostOrPending() || !validateTexFuncData("texSubImage2D", level, width, height, format, type, pixels, NullNotAllowed)
</ins><span class="cx"> || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceArrayBufferView, target, level, format, width, height, 0, format, type, xoffset, yoffset))
</span><span class="cx"> return;
</span><span class="cx"> void* data = pixels->baseAddress();
</span><span class="lines">@@ -4023,7 +4093,7 @@
</span><span class="cx"> GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> ec = 0;
</span><del>- if (isContextLost() || !pixels || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceImageData, target, level, format, pixels->width(), pixels->height(), 0, format, type, xoffset, yoffset))
</del><ins>+ if (isContextLostOrPending() || !pixels || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceImageData, target, level, format, pixels->width(), pixels->height(), 0, format, type, xoffset, yoffset))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> Vector<uint8_t> data;
</span><span class="lines">@@ -4049,7 +4119,7 @@
</span><span class="cx"> GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> ec = 0;
</span><del>- if (isContextLost() || !validateHTMLImageElement("texSubImage2D", image, ec))
</del><ins>+ if (isContextLostOrPending() || !validateHTMLImageElement("texSubImage2D", image, ec))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image->renderer());
</span><span class="lines">@@ -4066,7 +4136,7 @@
</span><span class="cx"> GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> ec = 0;
</span><del>- if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, ec)
</del><ins>+ if (isContextLostOrPending() || !validateHTMLCanvasElement("texSubImage2D", canvas, ec)
</ins><span class="cx"> || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElement, target, level, format, canvas->width(), canvas->height(), 0, format, type, xoffset, yoffset))
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -4082,7 +4152,7 @@
</span><span class="cx"> GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> ec = 0;
</span><del>- if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, ec)
</del><ins>+ if (isContextLostOrPending() || !validateHTMLVideoElement("texSubImage2D", video, ec)
</ins><span class="cx"> || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLVideoElement, target, level, format, video->videoWidth(), video->videoHeight(), 0, format, type, xoffset, yoffset))
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -4096,7 +4166,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, GC3Dfloat x, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !location)
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><span class="lines">@@ -4110,7 +4180,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform1fv", location, v, 1))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, v, 1))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform1fv(location->location(), v->length(), v->data());
</span><span class="lines">@@ -4119,7 +4189,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform1fv", location, v, size, 1))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, v, size, 1))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform1fv(location->location(), size, v);
</span><span class="lines">@@ -4128,7 +4198,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, GC3Dint x, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !location)
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><span class="lines">@@ -4147,7 +4217,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform1iv", location, v, 1))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, v, 1))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->type() == GraphicsContext3D::SAMPLER_2D || location->type() == GraphicsContext3D::SAMPLER_CUBE)
</span><span class="lines">@@ -4165,7 +4235,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform1iv", location, v, size, 1))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, v, size, 1))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->type() == GraphicsContext3D::SAMPLER_2D || location->type() == GraphicsContext3D::SAMPLER_CUBE)
</span><span class="lines">@@ -4182,7 +4252,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !location)
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><span class="lines">@@ -4196,7 +4266,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform2fv", location, v, 2))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, v, 2))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform2fv(location->location(), v->length() / 2, v->data());
</span><span class="lines">@@ -4205,7 +4275,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform2fv", location, v, size, 2))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, v, size, 2))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform2fv(location->location(), size / 2, v);
</span><span class="lines">@@ -4214,7 +4284,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !location)
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><span class="lines">@@ -4228,7 +4298,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform2iv", location, v, 2))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, v, 2))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform2iv(location->location(), v->length() / 2, v->data());
</span><span class="lines">@@ -4237,7 +4307,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform2iv", location, v, size, 2))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, v, size, 2))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform2iv(location->location(), size / 2, v);
</span><span class="lines">@@ -4246,7 +4316,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !location)
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><span class="lines">@@ -4260,7 +4330,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform3fv", location, v, 3))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, v, 3))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform3fv(location->location(), v->length() / 3, v->data());
</span><span class="lines">@@ -4269,7 +4339,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform3fv", location, v, size, 3))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, v, size, 3))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform3fv(location->location(), size / 3, v);
</span><span class="lines">@@ -4278,7 +4348,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !location)
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><span class="lines">@@ -4292,7 +4362,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform3iv", location, v, 3))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, v, 3))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform3iv(location->location(), v->length() / 3, v->data());
</span><span class="lines">@@ -4301,7 +4371,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform3iv", location, v, size, 3))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, v, size, 3))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform3iv(location->location(), size / 3, v);
</span><span class="lines">@@ -4310,7 +4380,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !location)
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><span class="lines">@@ -4324,7 +4394,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform4fv", location, v, 4))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, v, 4))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform4fv(location->location(), v->length() / 4, v->data());
</span><span class="lines">@@ -4333,7 +4403,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform4fv", location, v, size, 4))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, v, size, 4))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform4fv(location->location(), size / 4, v);
</span><span class="lines">@@ -4342,7 +4412,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !location)
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><span class="lines">@@ -4356,7 +4426,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform4iv", location, v, 4))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, v, 4))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform4iv(location->location(), v->length() / 4, v->data());
</span><span class="lines">@@ -4365,7 +4435,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformParameters("uniform4iv", location, v, size, 4))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, v, size, 4))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_context->uniform4iv(location->location(), size / 4, v);
</span><span class="lines">@@ -4374,7 +4444,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4))
</del><ins>+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->uniformMatrix2fv(location->location(), v->length() / 4, transpose, v->data());
</span><span class="cx"> }
</span><span class="lines">@@ -4382,7 +4452,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, size, 4))
</del><ins>+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, size, 4))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->uniformMatrix2fv(location->location(), size / 4, transpose, v);
</span><span class="cx"> }
</span><span class="lines">@@ -4390,7 +4460,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9))
</del><ins>+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->uniformMatrix3fv(location->location(), v->length() / 9, transpose, v->data());
</span><span class="cx"> }
</span><span class="lines">@@ -4398,7 +4468,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, size, 9))
</del><ins>+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, size, 9))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->uniformMatrix3fv(location->location(), size / 9, transpose, v);
</span><span class="cx"> }
</span><span class="lines">@@ -4406,7 +4476,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16))
</del><ins>+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->uniformMatrix4fv(location->location(), v->length() / 16, transpose, v->data());
</span><span class="cx"> }
</span><span class="lines">@@ -4414,7 +4484,7 @@
</span><span class="cx"> void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, size, 16))
</del><ins>+ if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, size, 16))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->uniformMatrix4fv(location->location(), size / 16, transpose, v);
</span><span class="cx"> }
</span><span class="lines">@@ -4444,7 +4514,7 @@
</span><span class="cx"> void WebGLRenderingContext::validateProgram(WebGLProgram* program, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost() || !validateWebGLObject("validateProgram", program))
</del><ins>+ if (isContextLostOrPending() || !validateWebGLObject("validateProgram", program))
</ins><span class="cx"> return;
</span><span class="cx"> m_context->validateProgram(objectOrZero(program));
</span><span class="cx"> }
</span><span class="lines">@@ -4512,7 +4582,7 @@
</span><span class="cx"> void WebGLRenderingContext::vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized, GC3Dsizei stride, long long offset, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> switch (type) {
</span><span class="cx"> case GraphicsContext3D::BYTE:
</span><span class="lines">@@ -4555,7 +4625,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!validateSize("viewport", width, height))
</span><span class="cx"> return;
</span><span class="lines">@@ -4564,7 +4634,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::forceLostContext(WebGLRenderingContext::LostContextMode mode)
</span><span class="cx"> {
</span><del>- if (isContextLost()) {
</del><ins>+ if (isContextLostOrPending()) {
</ins><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "loseContext", "context already lost");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -4617,7 +4687,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::forceRestoreContext()
</span><span class="cx"> {
</span><del>- if (!isContextLost()) {
</del><ins>+ if (!isContextLostOrPending()) {
</ins><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "restoreContext", "context not lost");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -4634,33 +4704,48 @@
</span><span class="cx">
</span><span class="cx"> PlatformLayer* WebGLRenderingContext::platformLayer() const
</span><span class="cx"> {
</span><del>- return (!isContextLost()) ? m_context->platformLayer() : 0;
</del><ins>+ return (!isContextLost() && !m_isPendingPolicyResolution) ? m_context->platformLayer() : 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::removeSharedObject(WebGLSharedObject* object)
</span><span class="cx"> {
</span><ins>+ if (m_isPendingPolicyResolution)
+ return;
+
</ins><span class="cx"> m_contextGroup->removeObject(object);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::addSharedObject(WebGLSharedObject* object)
</span><span class="cx"> {
</span><ins>+ if (m_isPendingPolicyResolution)
+ return;
+
</ins><span class="cx"> ASSERT(!isContextLost());
</span><span class="cx"> m_contextGroup->addObject(object);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::removeContextObject(WebGLContextObject* object)
</span><span class="cx"> {
</span><ins>+ if (m_isPendingPolicyResolution)
+ return;
+
</ins><span class="cx"> m_contextObjects.remove(object);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::addContextObject(WebGLContextObject* object)
</span><span class="cx"> {
</span><ins>+ if (m_isPendingPolicyResolution)
+ return;
+
</ins><span class="cx"> ASSERT(!isContextLost());
</span><span class="cx"> m_contextObjects.add(object);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::detachAndRemoveAllObjects()
</span><span class="cx"> {
</span><ins>+ if (m_isPendingPolicyResolution)
+ return;
+
</ins><span class="cx"> while (m_contextObjects.size() > 0) {
</span><span class="cx"> HashSet<WebGLContextObject*>::iterator it = m_contextObjects.begin();
</span><span class="cx"> (*it)->detachContext();
</span><span class="lines">@@ -4674,7 +4759,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::stop()
</span><span class="cx"> {
</span><del>- if (!isContextLost()) {
</del><ins>+ if (!isContextLost() && !m_isPendingPolicyResolution) {
</ins><span class="cx"> forceLostContext(SyntheticLostContext);
</span><span class="cx"> destroyGraphicsContext3D();
</span><span class="cx"> }
</span><span class="lines">@@ -5591,7 +5676,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::vertexAttribfImpl(const char* functionName, GC3Duint index, GC3Dsizei expectedSize, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (index >= m_maxVertexAttribs) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "index out of range");
</span><span class="lines">@@ -5623,7 +5708,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GC3Duint index, Float32Array* v, GC3Dsizei expectedSize)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!v) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
</span><span class="lines">@@ -5634,7 +5719,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GC3Duint index, GC3Dfloat* v, GC3Dsizei size, GC3Dsizei expectedSize)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx"> if (!v) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
</span><span class="lines">@@ -6067,7 +6152,7 @@
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::vertexAttribDivisor(GC3Duint index, GC3Duint divisor)
</span><span class="cx"> {
</span><del>- if (isContextLost())
</del><ins>+ if (isContextLostOrPending())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (index >= m_maxVertexAttribs) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h (164451 => 164452)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h        2014-02-20 23:11:52 UTC (rev 164451)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h        2014-02-20 23:12:18 UTC (rev 164452)
</span><span class="lines">@@ -339,6 +339,7 @@
</span><span class="cx"> friend class WebGLRenderingContextErrorMessageCallback;
</span><span class="cx"> friend class WebGLVertexArrayObjectOES;
</span><span class="cx">
</span><ins>+ WebGLRenderingContext(HTMLCanvasElement*, GraphicsContext3D::Attributes);
</ins><span class="cx"> WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes);
</span><span class="cx"> void initializeNewContext();
</span><span class="cx"> void setupFlags();
</span><span class="lines">@@ -524,6 +525,13 @@
</span><span class="cx"> bool m_synthesizedErrorsToConsole;
</span><span class="cx"> int m_numGLErrorsToConsoleAllowed;
</span><span class="cx">
</span><ins>+ // A WebGLRenderingContext can be created in a state where it appears as
+ // a valid and active context, but will not execute any important operations
+ // until its load policy is completely resolved.
+ bool m_isPendingPolicyResolution;
+ bool m_hasRequestedPolicyResolution;
+ bool isContextLostOrPending();
+
</ins><span class="cx"> // Enabled extension objects.
</span><span class="cx"> OwnPtr<EXTDrawBuffers> m_extDrawBuffers;
</span><span class="cx"> OwnPtr<EXTTextureFilterAnisotropic> m_extTextureFilterAnisotropic;
</span></span></pre>
</div>
</div>
</body>
</html>