Bug 1377974 - WEBGL_debug_shaders extension should always be enabled. r=jgilbert
authorSamuel Vargas <svargas@mozilla.com>
Tue, 18 Jul 2017 14:41:00 -0400
changeset 418423 e8bbb40ce18d63ae8582a40b1c092d31108b70ec
parent 418422 b268982e5a349b24d7e775d15db72491c36c1d21
child 418424 ec2b3b09f00b7b617d24c07ce11347c358c34322
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1377974
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1377974 - WEBGL_debug_shaders extension should always be enabled. r=jgilbert WEBGL_debug_shaders should be allowed if ShouldResistFingerprinting is on. Mochitests updated to reflect that.
dom/canvas/WebGLContextExtensions.cpp
dom/canvas/WebGLShader.cpp
dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html
dom/canvas/test/webgl-mochitest/test_privileged_exts.html
--- a/dom/canvas/WebGLContextExtensions.cpp
+++ b/dom/canvas/WebGLContextExtensions.cpp
@@ -5,16 +5,17 @@
 
 #include "WebGLContext.h"
 #include "WebGLContextUtils.h"
 #include "WebGLExtensions.h"
 #include "gfxPrefs.h"
 #include "GLContext.h"
 
 #include "nsString.h"
+#include "nsContentUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "AccessCheck.h"
 
 namespace mozilla {
 
 /*static*/ const char*
 WebGLContext::GetExtensionString(WebGLExtensionID ext)
@@ -141,17 +142,18 @@ WebGLContext::IsExtensionSupported(WebGL
         return gl->IsExtensionSupported(gl::GLContext::IMG_texture_compression_pvrtc);
     case WebGLExtensionID::WEBGL_compressed_texture_s3tc:
         return WebGLExtensionCompressedTextureS3TC::IsSupported(this);
     case WebGLExtensionID::WEBGL_compressed_texture_s3tc_srgb:
         return WebGLExtensionCompressedTextureS3TC::IsSupported(this) &&
                gl->IsExtensionSupported(gl::GLContext::EXT_texture_sRGB);
     case WebGLExtensionID::WEBGL_debug_renderer_info:
         return Preferences::GetBool("webgl.enable-debug-renderer-info", false);
-
+    case WebGLExtensionID::WEBGL_debug_shaders:
+        return !nsContentUtils::ShouldResistFingerprinting();
     case WebGLExtensionID::WEBGL_lose_context:
         // We always support this extension.
         return true;
 
     default:
         // For warnings-as-errors.
         break;
     }
--- a/dom/canvas/WebGLShader.cpp
+++ b/dom/canvas/WebGLShader.cpp
@@ -274,22 +274,16 @@ WebGLShader::GetShaderSource(nsAString* 
 {
     out->SetIsVoid(false);
     *out = mSource;
 }
 
 void
 WebGLShader::GetShaderTranslatedSource(nsAString* out) const
 {
-    if (!mCompilationSuccessful) {
-        mContext->ErrorInvalidOperation("getShaderTranslatedSource: Shader has"
-                                        " not been successfully compiled.");
-        return;
-    }
-
     out->SetIsVoid(false);
     CopyASCIItoUTF16(mTranslatedSource, *out);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 bool
 WebGLShader::CanLinkTo(const WebGLShader* prev, nsCString* const out_log) const
--- a/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html
+++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html
@@ -27,17 +27,17 @@ var defaultExts = [
     ['OES_standard_derivatives'      , [MACHINE_SPECIFIC, FORBID          ]],
     ['OES_texture_float'             , [ENSURE          , FORBID          ]],
     ['OES_texture_float_linear'      , [ENSURE          , ENSURE          ]],
     ['OES_texture_half_float'        , [ENSURE          , FORBID          ]],
     ['OES_texture_half_float_linear' , [ENSURE          , FORBID          ]],
     ['OES_vertex_array_object'       , [ENSURE          , FORBID          ]],
     ['WEBGL_compressed_texture_s3tc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
     ['WEBGL_debug_renderer_info'     , [ENSURE          , ENSURE          ]],
-    ['WEBGL_debug_shaders'           , [FORBID          , FORBID          ]],
+    ['WEBGL_debug_shaders'           , [ENSURE          , ENSURE          ]],
     ['WEBGL_depth_texture'           , [MACHINE_SPECIFIC, FORBID          ]],
     ['WEBGL_draw_buffers'            , [MACHINE_SPECIFIC, FORBID          ]],
     ['WEBGL_lose_context'            , [ENSURE          , ENSURE          ]],
 
     // Community Approved
     ['EXT_color_buffer_float'        , [FORBID          , ENSURE          ]],
     ['EXT_color_buffer_half_float'   , [MACHINE_SPECIFIC, FORBID          ]],
     ['EXT_sRGB'                      , [MACHINE_SPECIFIC, FORBID          ]],
--- a/dom/canvas/test/webgl-mochitest/test_privileged_exts.html
+++ b/dom/canvas/test/webgl-mochitest/test_privileged_exts.html
@@ -19,14 +19,14 @@ function TestExt(gl, name) {
 (function() {
   var gl = WebGLUtil.getWebGL('c');
   if (!gl) {
     todo(gl, 'Get GL working here first.');
     return;
   }
 
   // Privileged extensions:
-  TestExt(gl, 'WEBGL_debug_shaders');
+  TestExt(gl, 'MOZ_debug');
 })();
 
 </script>
 </body>
 </html>