b=623394; [webgl] don't allow non-ascii characters in GLSL source; r=bjacob

This commit is contained in:
Vladimir Vukicevic 2011-01-06 14:07:13 -08:00
parent 146f5d0b4d
commit 1549e9ac38

View File

@ -3626,6 +3626,9 @@ WebGLContext::ShaderSource(nsIWebGLShader *sobj, const nsAString& source)
if (!GetConcreteObjectAndGLName("shaderSource: shader", sobj, &shader, &shadername)) if (!GetConcreteObjectAndGLName("shaderSource: shader", sobj, &shader, &shadername))
return NS_OK; return NS_OK;
if (!NS_IsAscii(nsPromiseFlatString(source).get()))
return ErrorInvalidValue("shaderSource: non-ascii characters found in source");
shader->SetSource(NS_LossyConvertUTF16toASCII(source)); shader->SetSource(NS_LossyConvertUTF16toASCII(source));
shader->SetNeedsTranslation(); shader->SetNeedsTranslation();