Bug 1294100 - Part 2: Modify CheckCustomElementName be 'const nsString*' and remove the const_cast. r=bz

This commit is contained in:
John Dai 2016-09-01 18:08:50 +08:00
parent 7a7550e6d5
commit 84e1621068
6 changed files with 11 additions and 11 deletions

View File

@ -31,7 +31,7 @@ nsresult
NS_NewElement(mozilla::dom::Element** aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser,
nsAString* aIs = nullptr);
const nsAString* aIs = nullptr);
nsresult
NS_NewXMLElement(mozilla::dom::Element** aResult,
@ -41,7 +41,7 @@ nsresult
NS_NewHTMLElement(mozilla::dom::Element** aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser,
nsAString* aIs = nullptr);
const nsAString* aIs = nullptr);
// First argument should be nsHTMLTag, but that adds dependency to parser
// for a bunch of files.

View File

@ -5477,7 +5477,7 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
}
// Throw NotFoundError if 'is' is not-null and definition is null
nsString* is = CheckCustomElementName(
const nsString* is = CheckCustomElementName(
aOptions, aQualifiedName, nodeInfo->NamespaceID(), rv);
if (rv.Failed()) {
return nullptr;
@ -8150,7 +8150,7 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
already_AddRefed<Element>
nsDocument::CreateElem(const nsAString& aName, nsIAtom *aPrefix,
int32_t aNamespaceID, nsAString* aIs)
int32_t aNamespaceID, const nsAString* aIs)
{
#ifdef DEBUG
nsAutoString qName;
@ -12890,7 +12890,7 @@ nsIDocument::UpdateStyleBackendType()
#endif
}
nsString*
const nsString*
nsDocument::CheckCustomElementName(const ElementCreationOptions& aOptions,
const nsAString& aLocalName,
uint32_t aNamespaceID,
@ -12903,7 +12903,7 @@ nsDocument::CheckCustomElementName(const ElementCreationOptions& aOptions,
return nullptr;
}
nsString* is = const_cast<nsString*>(&(aOptions.mIs.Value()));
const nsString* is = &aOptions.mIs.Value();
// Throw NotFoundError if 'is' is not-null and definition is null
if (!nsContentUtils::LookupCustomElementDefinition(this, aLocalName,

View File

@ -828,7 +828,7 @@ public:
virtual already_AddRefed<Element> CreateElem(const nsAString& aName,
nsIAtom* aPrefix,
int32_t aNamespaceID,
nsAString* aIs = nullptr) override;
const nsAString* aIs = nullptr) override;
virtual void Sanitize() override;
@ -1378,7 +1378,7 @@ private:
* If there is no existing custom element definition for this name, throw a
* NotFoundError.
*/
nsString* CheckCustomElementName(
const nsString* CheckCustomElementName(
const mozilla::dom::ElementCreationOptions& aOptions,
const nsAString& aLocalName,
uint32_t aNamespaceID,

View File

@ -1513,7 +1513,7 @@ public:
virtual already_AddRefed<Element> CreateElem(const nsAString& aName,
nsIAtom* aPrefix,
int32_t aNamespaceID,
nsAString* aIs = nullptr) = 0;
const nsAString* aIs = nullptr) = 0;
/**
* Get the security info (i.e. SSL state etc) that the document got

View File

@ -169,7 +169,7 @@ nsresult
NS_NewElement(Element** aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
FromParser aFromParser,
nsAString* aIs)
const nsAString* aIs)
{
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
int32_t ns = ni->NamespaceID();

View File

@ -236,7 +236,7 @@ public:
nsresult
NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
FromParser aFromParser, nsAString* aIs)
FromParser aFromParser, const nsAString* aIs)
{
*aResult = nullptr;