bug 319847: xul:persist doesn't really deal with namespaces; check that the argument is a valid NCName, though. r=bsmedberg sr=jst

This commit is contained in:
mrbkap%gmail.com 2005-12-19 21:13:59 +00:00
Родитель 5b0d3052c6
Коммит d8a5fa7ae3
1 изменённых файлов: 17 добавлений и 0 удалений

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

@ -114,6 +114,7 @@
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
#include "nsIParser.h"
#include "nsIParserService.h"
#include "nsICSSStyleSheet.h"
#include "nsIScriptError.h"
@ -1378,6 +1379,22 @@ nsXULDocument::Persist(const nsAString& aID,
nameSpaceID = ni->NamespaceID();
}
else {
// Make sure that this QName is going to be valid.
nsIParserService *parserService = nsContentUtils::GetParserService();
NS_ASSERTION(parserService, "Running scripts during shutdown?");
const PRUnichar *colon;
rv = parserService->CheckQName(PromiseFlatString(aAttr), PR_TRUE, &colon);
if (NS_FAILED(rv)) {
// There was an invalid character or it was malformed.
return NS_ERROR_INVALID_ARG;
}
if (colon) {
// We don't really handle namespace qualifiers in attribute names.
return NS_ERROR_NOT_IMPLEMENTED;
}
tag = do_GetAtom(aAttr);
NS_ENSURE_TRUE(tag, NS_ERROR_OUT_OF_MEMORY);