Bug 375457 - "toDataURL has incorrect type-checking logic" [p=joe@drew.ca (Joe Drew [JOEDREW!]) r+a1.9=vlad]
--- a/content/html/content/src/nsHTMLCanvasElement.cpp
+++ b/content/html/content/src/nsHTMLCanvasElement.cpp
@@ -325,17 +325,17 @@ nsHTMLCanvasElement::ToDataURL(nsAString
return NS_ERROR_DOM_SYNTAX_ERR;
JSString *type = JS_ValueToString(ctx, argv[0]);
return ToDataURLImpl (nsDependentString(reinterpret_cast<PRUnichar*>((JS_GetStringChars(type)))),
EmptyString(), aDataURL);
}
// 2-arg case; trusted only (checked above), convert to mime type with params
if (argc == 2) {
- if (!JSVAL_IS_STRING(argv[0]) && !JSVAL_IS_STRING(argv[1]))
+ if (!JSVAL_IS_STRING(argv[0]) || !JSVAL_IS_STRING(argv[1]))
return NS_ERROR_DOM_SYNTAX_ERR;
JSString *type, *params;
type = JS_ValueToString(ctx, argv[0]);
params = JS_ValueToString(ctx, argv[1]);
return ToDataURLImpl (nsDependentString(reinterpret_cast<PRUnichar*>(JS_GetStringChars(type))),
nsDependentString(reinterpret_cast<PRUnichar*>(JS_GetStringChars(params))),