зеркало из https://github.com/mozilla/pjs.git
don't try to extract characters from an empty string
This commit is contained in:
Родитель
e15e22ba38
Коммит
7d08825730
|
@ -611,20 +611,22 @@ HTMLContentSink::GetAttributeValueAt(const nsIParserNode& aNode,
|
|||
aResult.Append(value);
|
||||
aResult.Trim("\b\r\t\n",PR_TRUE,PR_TRUE,PR_TRUE);
|
||||
|
||||
// Strip quotes if present
|
||||
PRUnichar first = aResult.First();
|
||||
if ((first == '\"') || (first == '\'')) {
|
||||
if (aResult.Last() == first) {
|
||||
aResult.Cut(0, 1);
|
||||
PRInt32 pos = aResult.Length() - 1;
|
||||
if (pos >= 0) {
|
||||
aResult.Cut(pos, 1);
|
||||
if ( !aResult.IsEmpty() ) {
|
||||
// Strip quotes if present
|
||||
PRUnichar first = aResult.First();
|
||||
if ((first == '\"') || (first == '\'')) {
|
||||
if (aResult.Last() == first) {
|
||||
aResult.Cut(0, 1);
|
||||
PRInt32 pos = aResult.Length() - 1;
|
||||
if (pos >= 0) {
|
||||
aResult.Cut(pos, 1);
|
||||
}
|
||||
} else {
|
||||
// Mismatched quotes - leave them in
|
||||
}
|
||||
} else {
|
||||
// Mismatched quotes - leave them in
|
||||
}
|
||||
ReduceEntities(aResult);
|
||||
}
|
||||
ReduceEntities(aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -611,20 +611,22 @@ HTMLContentSink::GetAttributeValueAt(const nsIParserNode& aNode,
|
|||
aResult.Append(value);
|
||||
aResult.Trim("\b\r\t\n",PR_TRUE,PR_TRUE,PR_TRUE);
|
||||
|
||||
// Strip quotes if present
|
||||
PRUnichar first = aResult.First();
|
||||
if ((first == '\"') || (first == '\'')) {
|
||||
if (aResult.Last() == first) {
|
||||
aResult.Cut(0, 1);
|
||||
PRInt32 pos = aResult.Length() - 1;
|
||||
if (pos >= 0) {
|
||||
aResult.Cut(pos, 1);
|
||||
if ( !aResult.IsEmpty() ) {
|
||||
// Strip quotes if present
|
||||
PRUnichar first = aResult.First();
|
||||
if ((first == '\"') || (first == '\'')) {
|
||||
if (aResult.Last() == first) {
|
||||
aResult.Cut(0, 1);
|
||||
PRInt32 pos = aResult.Length() - 1;
|
||||
if (pos >= 0) {
|
||||
aResult.Cut(pos, 1);
|
||||
}
|
||||
} else {
|
||||
// Mismatched quotes - leave them in
|
||||
}
|
||||
} else {
|
||||
// Mismatched quotes - leave them in
|
||||
}
|
||||
ReduceEntities(aResult);
|
||||
}
|
||||
ReduceEntities(aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
Загрузка…
Ссылка в новой задаче