зеркало из https://github.com/mozilla/gecko-dev.git
IsJavascript should handle leading spaces. Bug 197345, patch by
bugzilla@jellycan.com (Brodie Thiesfield), r=brade, sr=bzbarsky
This commit is contained in:
Родитель
62c1c6702e
Коммит
bdbb61ee9e
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче