Bug 1171682 - Disable WebGL in safemode. r=jgilbert a=lizzard
☠☠ backed out by f069ca975718 ☠ ☠
authorBenoit Girard <b56girard@gmail.com>
Mon, 15 Jun 2015 17:05:02 -0400
changeset 267742 f940d6d04ccd9d15c5dbb57730a326a4ff220431
parent 267741 2f8d779efaa1e6bad1e9b962929cf5062be02f60
child 267743 f069ca975718c46fe372e5742cf93db1803bf364
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, lizzard
bugs1171682
milestone39.0
Bug 1171682 - Disable WebGL in safemode. r=jgilbert a=lizzard
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -5,16 +5,17 @@
 
 #include "WebGLContext.h"
 
 #include "AccessCheck.h"
 #include "CanvasUtils.h"
 #include "gfxContext.h"
 #include "gfxCrashReporterUtils.h"
 #include "gfxPattern.h"
+#include "gfxPlatform.h"
 #include "gfxPrefs.h"
 #include "gfxUtils.h"
 #include "GLBlitHelper.h"
 #include "GLContext.h"
 #include "GLContextProvider.h"
 #include "GLReadTexImageHelper.h"
 #include "ImageContainer.h"
 #include "ImageEncoder.h"
@@ -863,16 +864,20 @@ WebGLContext::SetDimensions(int32_t sign
         GenerateWarning("Too many WebGL contexts created this run.");
         return NS_ERROR_FAILURE; // exit without changing the value of mGeneration
     }
 
     // Get some prefs for some preferred/overriden things
     NS_ENSURE_TRUE(Preferences::GetRootBranch(), NS_ERROR_FAILURE);
 
     bool disabled = Preferences::GetBool("webgl.disabled", false);
+
+    // TODO: When we have software webgl support we should use that instead.
+    disabled |= gfxPlatform::InSafeMode();
+
     if (disabled) {
         GenerateWarning("WebGL creation is disabled, and so disallowed here.");
         return NS_ERROR_FAILURE;
     }
 
     // Alright, now let's start trying.
     bool forceEnabled = Preferences::GetBool("webgl.force-enabled", false);
     ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);