Add WebGL validation extensions to ANGLE.

BUG=angleproject:1523

Change-Id: I6fecb5055ed8087665aeee34b3a066ea8f38d51b
Reviewed-on: https://chromium-review.googlesource.com/386281
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 2775fe9..68285ce 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -3433,4 +3433,24 @@
     return true;
 }
 
+bool ValidateEnableExtensionANGLE(ValidationContext *context, const GLchar *name)
+{
+    if (!context->getExtensions().webglCompatibility)
+    {
+        context->handleError(
+            Error(GL_INVALID_OPERATION, "GL_ANGLE_webgl_compatibility is not available."));
+        return false;
+    }
+
+    const ExtensionInfoMap &extensionInfos = GetExtensionInfoMap();
+    auto extension                         = extensionInfos.find(name);
+    if (extension == extensionInfos.end() || !extension->second.Enableable)
+    {
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension %s is not enableable.", name));
+        return false;
+    }
+
+    return true;
+}
+
 }  // namespace gl