Bug 1341959: Part 2. Check if WebGL2 is blocked before creating it. r?jgilbert
MozReview-Commit-ID: Div1umXOMV
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -705,16 +705,32 @@ WebGLContext::CreateAndInitGLWith(FnCrea
return true;
}
bool
WebGLContext::CreateAndInitGL(bool forceEnabled,
std::vector<FailureReason>* const out_failReasons)
{
+ // WebGL2 is separately blocked:
+ if (IsWebGL2()) {
+ const nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
+ const auto feature = nsIGfxInfo::FEATURE_WEBGL2;
+
+ FailureReason reason;
+ if (IsFeatureInBlacklist(gfxInfo, feature, &reason.key)) {
+ reason.info = "Refused to create WebGL2 context because of blacklist"
+ " entry: ";
+ reason.info.Append(reason.key);
+ out_failReasons->push_back(reason);
+ GenerateWarning("%s", reason.info.BeginReading());
+ return false;
+ }
+ }
+
const gl::SurfaceCaps baseCaps = BaseCaps(mOptions, this);
gl::CreateContextFlags flags = gl::CreateContextFlags::NO_VALIDATION;
bool tryNativeGL = true;
bool tryANGLE = false;
if (forceEnabled) {
flags |= gl::CreateContextFlags::FORCE_ENABLE_HARDWARE;
}