IsJavascript should handle leading spaces. Bug 197345, patch by

bugzilla@jellycan.com (Brodie Thiesfield), r=brade, sr=bzbarsky
This commit is contained in:
bzbarsky%mit.edu 2003-03-17 23:18:57 +00:00
Родитель 62c1c6702e
Коммит bdbb61ee9e
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -201,12 +201,13 @@ nsHTMLContentSerializer::IsJavaScript(nsIAtom* aAttrNameAtom, const nsAString& a
{
if (aAttrNameAtom == nsHTMLAtoms::href
|| aAttrNameAtom == nsHTMLAtoms::src) {
// note that there is a problem in that if this value starts with leading spaces we won't do the right thing
// this is covered in bug #59604
static const char kJavaScript[] = "javascript";
PRInt32 pos = aValueString.FindChar(':');
const nsAutoString scheme(Substring(aValueString, 0, pos));
if ((pos == (PRInt32)(sizeof kJavaScript - 1)) &&
if ( pos < (PRInt32)(sizeof kJavaScript - 1) )
return PR_FALSE;
nsAutoString scheme(Substring(aValueString, 0, pos));
scheme.StripWhitespace();
if ((scheme.Length() == (sizeof kJavaScript - 1)) &&
scheme.EqualsIgnoreCase(kJavaScript))
return PR_TRUE;
else