From b47f9b8c7bc56524241cb37a034ae791cc87e8d0 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Sat, 16 Jun 2012 01:11:50 -0400 Subject: [PATCH] Bug 765137 - 1/3 - WebGL: use case-insensitive comparisons rather than lower-case versions of extension strings - r=jgilbert --- content/canvas/src/WebGLContext.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/content/canvas/src/WebGLContext.cpp b/content/canvas/src/WebGLContext.cpp index 04b2df64b676..fc5c8174da78 100644 --- a/content/canvas/src/WebGLContext.cpp +++ b/content/canvas/src/WebGLContext.cpp @@ -889,32 +889,39 @@ WebGLContext::GetExtension(const nsAString& aName) { if (!IsContextStable()) return nsnull; - + if (mDisableExtensions) { return nsnull; } - nsString lowerCaseName(aName); - ToLowerCase(lowerCaseName); - WebGLExtensionID ei = WebGLExtensionID_Max; - if (lowerCaseName.EqualsLiteral("oes_texture_float")) { + if (aName.Equals(NS_LITERAL_STRING("OES_texture_float"), + nsCaseInsensitiveStringComparator())) + { if (IsExtensionSupported(WebGL_OES_texture_float)) ei = WebGL_OES_texture_float; } - else if (lowerCaseName.EqualsLiteral("oes_standard_derivatives")) { + else if (aName.Equals(NS_LITERAL_STRING("OES_standard_derivatives"), + nsCaseInsensitiveStringComparator())) + { if (IsExtensionSupported(WebGL_OES_standard_derivatives)) ei = WebGL_OES_standard_derivatives; } - else if (lowerCaseName.EqualsLiteral("moz_ext_texture_filter_anisotropic")) { + else if (aName.Equals(NS_LITERAL_STRING("MOZ_EXT_texture_filter_anisotropic"), + nsCaseInsensitiveStringComparator())) + { if (IsExtensionSupported(WebGL_EXT_texture_filter_anisotropic)) ei = WebGL_EXT_texture_filter_anisotropic; } - else if (lowerCaseName.EqualsLiteral("moz_webgl_lose_context")) { + else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"), + nsCaseInsensitiveStringComparator())) + { if (IsExtensionSupported(WebGL_WEBGL_lose_context)) ei = WebGL_WEBGL_lose_context; } - else if (lowerCaseName.EqualsLiteral("moz_webgl_compressed_texture_s3tc")) { + else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"), + nsCaseInsensitiveStringComparator())) + { if (IsExtensionSupported(WebGL_WEBGL_compressed_texture_s3tc)) ei = WebGL_WEBGL_compressed_texture_s3tc; }