IsJavascript should handle leading spaces. Bug 197345, patch by
bugzilla@jellycan.com (Brodie Thiesfield), r=brade, sr=bzbarsky git-svn-id: svn://10.0.0.236/trunk@139624 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user