Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam.

This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.

These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.

- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>

- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
  - Count() --> Length()
  - ObjectAt() --> ElementAt()
  - AppendObject() --> AppendElement()
  - RemoveObjectAt() --> RemoveElementAt()

- ns*Hashtable<nsISupportsHashKey, ...> -->
  ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>

- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
  - This requires adding a Get() method to nsRefPtrHashtable that it lacks but
    nsInterfaceHashtable has.

- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
  - nsArrayBase::Create() --> nsTArray()
  - GetLength() --> Length()
  - do_QueryElementAt() --> operator[]

The patch also has some changes to Rust code that manipulates nsIAtom.

MozReview-Commit-ID: DykOl8aEnUJ

--HG--
extra : rebase_source : 254404e318e94b4c93ec8d4081ff0f0fda8aa7d1
This commit is contained in:
Nicholas Nethercote 2017-09-26 08:33:21 +10:00
Родитель f5c40383ca
Коммит dfd3b7e7aa
210 изменённых файлов: 694 добавлений и 710 удалений

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

@ -531,7 +531,7 @@ public:
nsIAtom* GetAttribute() const { return mAttribute; }
private:
nsCOMPtr<nsIAtom> mAttribute;
RefPtr<nsIAtom> mAttribute;
virtual ~AccObjectAttrChangedEvent() { }
};

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

@ -158,8 +158,8 @@ private:
CreateCodebasePrincipal(nsIURI* aURI, const OriginAttributes& aAttrs,
const nsACString& aOriginNoSuffix);
nsCOMPtr<nsIAtom> mOriginNoSuffix;
nsCOMPtr<nsIAtom> mOriginSuffix;
RefPtr<nsIAtom> mOriginNoSuffix;
RefPtr<nsIAtom> mOriginSuffix;
OriginAttributes mOriginAttributes;
PrincipalKind mKind;

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

@ -363,7 +363,7 @@ ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback, void* aClosure)
return;
}
nsCOMPtr<nsIAtom> pingAtom = NS_Atomize("ping");
RefPtr<nsIAtom> pingAtom = NS_Atomize("ping");
if (!pingAtom) {
return;
}

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

@ -187,7 +187,7 @@ Element*
AnonymousContent::GetElementById(const nsAString& aElementId)
{
// This can be made faster in the future if needed.
nsCOMPtr<nsIAtom> elementId = NS_Atomize(aElementId);
RefPtr<nsIAtom> elementId = NS_Atomize(aElementId);
for (nsIContent* node = mContentNode; node;
node = node->GetNextNode(mContentNode)) {
if (!node->IsElement()) {

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

@ -164,7 +164,7 @@ Attr::GetValue(nsAString& aValue)
{
Element* element = GetElement();
if (element) {
nsCOMPtr<nsIAtom> nameAtom = mNodeInfo->NameAtom();
RefPtr<nsIAtom> nameAtom = mNodeInfo->NameAtom();
element->GetAttr(mNodeInfo->NamespaceID(), nameAtom, aValue);
}
else {
@ -183,7 +183,7 @@ Attr::SetValue(const nsAString& aValue, ErrorResult& aRv)
return;
}
nsCOMPtr<nsIAtom> nameAtom = mNodeInfo->NameAtom();
RefPtr<nsIAtom> nameAtom = mNodeInfo->NameAtom();
aRv = element->SetAttr(mNodeInfo->NamespaceID(),
nameAtom,
mNodeInfo->GetPrefixAtom(),

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

@ -225,8 +225,8 @@ CustomElementDefinition*
CustomElementRegistry::LookupCustomElementDefinition(const nsAString& aLocalName,
const nsAString* aIs) const
{
nsCOMPtr<nsIAtom> localNameAtom = NS_Atomize(aLocalName);
nsCOMPtr<nsIAtom> typeAtom = aIs ? NS_Atomize(*aIs) : localNameAtom;
RefPtr<nsIAtom> localNameAtom = NS_Atomize(aLocalName);
RefPtr<nsIAtom> typeAtom = aIs ? NS_Atomize(*aIs) : localNameAtom;
CustomElementDefinition* data = mCustomDefinitions.GetWeak(typeAtom);
if (data && data->mLocalName == localNameAtom) {
@ -261,7 +261,7 @@ CustomElementRegistry::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTy
// Candidate may be a custom element through extension,
// in which case the custom element type name will not
// match the element tag name. e.g. <button is="x-button">.
nsCOMPtr<nsIAtom> typeName = aTypeName;
RefPtr<nsIAtom> typeName = aTypeName;
if (!typeName) {
typeName = info->NameAtom();
}
@ -280,8 +280,8 @@ void
CustomElementRegistry::SetupCustomElement(Element* aElement,
const nsAString* aTypeExtension)
{
nsCOMPtr<nsIAtom> tagAtom = aElement->NodeInfo()->NameAtom();
nsCOMPtr<nsIAtom> typeAtom = aTypeExtension ?
RefPtr<nsIAtom> tagAtom = aElement->NodeInfo()->NameAtom();
RefPtr<nsIAtom> typeAtom = aTypeExtension ?
NS_Atomize(*aTypeExtension) : tagAtom;
if (aTypeExtension && !aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::is)) {
@ -430,7 +430,7 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType
}
if (aType == nsIDocument::eAttributeChanged) {
nsCOMPtr<nsIAtom> attrName = NS_Atomize(aArgs->name);
RefPtr<nsIAtom> attrName = NS_Atomize(aArgs->name);
if (definition->mObservedAttributes.IsEmpty() ||
!definition->mObservedAttributes.Contains(attrName)) {
return;
@ -576,7 +576,7 @@ CustomElementRegistry::Define(const nsAString& aName,
* 2. If name is not a valid custom element name, then throw a "SyntaxError"
* DOMException and abort these steps.
*/
nsCOMPtr<nsIAtom> nameAtom(NS_Atomize(aName));
RefPtr<nsIAtom> nameAtom(NS_Atomize(aName));
if (!nsContentUtils::IsCustomElementName(nameAtom)) {
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return;
@ -618,7 +618,7 @@ CustomElementRegistry::Define(const nsAString& aName,
*/
nsAutoString localName(aName);
if (aOptions.mExtends.WasPassed()) {
nsCOMPtr<nsIAtom> extendsAtom(NS_Atomize(aOptions.mExtends.Value()));
RefPtr<nsIAtom> extendsAtom(NS_Atomize(aOptions.mExtends.Value()));
if (nsContentUtils::IsCustomElementName(extendsAtom)) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
@ -647,7 +647,7 @@ CustomElementRegistry::Define(const nsAString& aName,
JS::Rooted<JSObject*> constructorPrototype(cx);
nsAutoPtr<LifecycleCallbacks> callbacksHolder(new LifecycleCallbacks());
nsCOMArray<nsIAtom> observedAttributes;
nsTArray<RefPtr<nsIAtom>> observedAttributes;
{ // Set mIsCustomDefinitionRunning.
/**
* 9. Set this CustomElementRegistry's element definition is running flag.
@ -778,7 +778,7 @@ CustomElementRegistry::Define(const nsAString& aName,
* lifecycleCallbacks.
*/
// Associate the definition with the custom element.
nsCOMPtr<nsIAtom> localNameAtom(NS_Atomize(localName));
RefPtr<nsIAtom> localNameAtom(NS_Atomize(localName));
LifecycleCallbacks* callbacks = callbacksHolder.forget();
/**
@ -829,7 +829,7 @@ void
CustomElementRegistry::Get(JSContext* aCx, const nsAString& aName,
JS::MutableHandle<JS::Value> aRetVal)
{
nsCOMPtr<nsIAtom> nameAtom(NS_Atomize(aName));
RefPtr<nsIAtom> nameAtom(NS_Atomize(aName));
CustomElementDefinition* data = mCustomDefinitions.GetWeak(nameAtom);
if (!data) {
@ -850,7 +850,7 @@ CustomElementRegistry::WhenDefined(const nsAString& aName, ErrorResult& aRv)
return nullptr;
}
nsCOMPtr<nsIAtom> nameAtom(NS_Atomize(aName));
RefPtr<nsIAtom> nameAtom(NS_Atomize(aName));
if (!nsContentUtils::IsCustomElementName(nameAtom)) {
promise->MaybeReject(NS_ERROR_DOM_SYNTAX_ERR);
return promise.forget();
@ -1165,7 +1165,7 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CustomElementDefinition, Release)
CustomElementDefinition::CustomElementDefinition(nsIAtom* aType,
nsIAtom* aLocalName,
Function* aConstructor,
nsCOMArray<nsIAtom>&& aObservedAttributes,
nsTArray<RefPtr<nsIAtom>>&& aObservedAttributes,
JSObject* aPrototype,
LifecycleCallbacks* aCallbacks,
uint32_t aDocOrder)

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

@ -102,7 +102,7 @@ struct CustomElementData
CustomElementData(nsIAtom* aType, State aState);
// Custom element type, for <button is="x-button"> or <x-button>
// this would be x-button.
nsCOMPtr<nsIAtom> mType;
RefPtr<nsIAtom> mType;
// Element is being created flag as described in the custom elements spec.
bool mElementIsBeingCreated;
// Flag to determine if the created callback has been invoked, thus it
@ -150,22 +150,22 @@ struct CustomElementDefinition
CustomElementDefinition(nsIAtom* aType,
nsIAtom* aLocalName,
Function* aConstructor,
nsCOMArray<nsIAtom>&& aObservedAttributes,
nsTArray<RefPtr<nsIAtom>>&& aObservedAttributes,
JSObject* aPrototype,
mozilla::dom::LifecycleCallbacks* aCallbacks,
uint32_t aDocOrder);
// The type (name) for this custom element.
nsCOMPtr<nsIAtom> mType;
RefPtr<nsIAtom> mType;
// The localname to (e.g. <button is=type> -- this would be button).
nsCOMPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mLocalName;
// The custom element constructor.
RefPtr<CustomElementConstructor> mConstructor;
// The list of attributes that this custom element observes.
nsCOMArray<nsIAtom> mObservedAttributes;
nsTArray<RefPtr<nsIAtom>> mObservedAttributes;
// The prototype to use for new custom elements of this type.
JS::Heap<JSObject *> mPrototype;
@ -411,12 +411,12 @@ private:
CustomElementDefinition* aDefinition,
ErrorResult& aRv);
typedef nsRefPtrHashtable<nsISupportsHashKey, CustomElementDefinition>
typedef nsRefPtrHashtable<nsRefPtrHashKey<nsIAtom>, CustomElementDefinition>
DefinitionMap;
typedef nsClassHashtable<nsISupportsHashKey, nsTArray<nsWeakPtr>>
typedef nsClassHashtable<nsRefPtrHashKey<nsIAtom>, nsTArray<nsWeakPtr>>
CandidateMap;
typedef JS::GCHashMap<JS::Heap<JSObject*>,
nsCOMPtr<nsIAtom>,
RefPtr<nsIAtom>,
js::MovableCellHasher<JS::Heap<JSObject*>>,
js::SystemAllocPolicy> ConstructorMap;
@ -430,7 +430,7 @@ private:
// mCustomDefinitions again to get definitions.
ConstructorMap mConstructors;
typedef nsRefPtrHashtable<nsISupportsHashKey, Promise>
typedef nsRefPtrHashtable<nsRefPtrHashKey<nsIAtom>, Promise>
WhenDefinedPromiseMap;
WhenDefinedPromiseMap mWhenDefinedPromiseMap;

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

@ -61,7 +61,7 @@ DOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
return nullptr;
}
nsCOMPtr<nsIAtom> name = NS_Atomize(aQualifiedName);
RefPtr<nsIAtom> name = NS_Atomize(aQualifiedName);
if (!name) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;

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

@ -1268,7 +1268,7 @@ Element::SetAttribute(const nsAString& aName,
nsAutoString nameToUse;
const nsAttrName* name = InternalGetAttrNameFromQName(aName, &nameToUse);
if (!name) {
nsCOMPtr<nsIAtom> nameAtom = NS_AtomizeMainThread(nameToUse);
RefPtr<nsIAtom> nameAtom = NS_AtomizeMainThread(nameToUse);
if (!nameAtom) {
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
@ -1349,7 +1349,7 @@ Element::GetAttributeNS(const nsAString& aNamespaceURI,
return;
}
nsCOMPtr<nsIAtom> name = NS_AtomizeMainThread(aLocalName);
RefPtr<nsIAtom> name = NS_AtomizeMainThread(aLocalName);
bool hasAttr = GetAttr(nsid, name, aReturn);
if (!hasAttr) {
SetDOMStringToNull(aReturn);
@ -1381,7 +1381,7 @@ Element::RemoveAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
ErrorResult& aError)
{
nsCOMPtr<nsIAtom> name = NS_AtomizeMainThread(aLocalName);
RefPtr<nsIAtom> name = NS_AtomizeMainThread(aLocalName);
int32_t nsid =
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI,
nsContentUtils::IsChromeDoc(OwnerDoc()));
@ -1454,7 +1454,7 @@ Element::HasAttributeNS(const nsAString& aNamespaceURI,
return false;
}
nsCOMPtr<nsIAtom> name = NS_AtomizeMainThread(aLocalName);
RefPtr<nsIAtom> name = NS_AtomizeMainThread(aLocalName);
return HasAttr(nsid, name);
}
@ -2628,7 +2628,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
data->mType,
aName)) {
nsCOMPtr<nsIAtom> oldValueAtom;
RefPtr<nsIAtom> oldValueAtom;
if (oldValue) {
oldValueAtom = oldValue->GetAsAtom();
} else {
@ -2636,7 +2636,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
// attribute that was swapped with aParsedValue.
oldValueAtom = aParsedValue.GetAsAtom();
}
nsCOMPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
RefPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
nsAutoString ns;
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
@ -2935,7 +2935,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsAutoString ns;
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
nsCOMPtr<nsIAtom> oldValueAtom = oldValue.GetAsAtom();
RefPtr<nsIAtom> oldValueAtom = oldValue.GetAsAtom();
LifecycleCallbackArgs args = {
nsDependentAtomString(aName),
nsDependentAtomString(oldValueAtom),

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

@ -331,7 +331,7 @@ nsIContent::LookupNamespaceURIInternal(const nsAString& aNamespacePrefix,
return NS_OK;
}
nsCOMPtr<nsIAtom> name;
RefPtr<nsIAtom> name;
if (!aNamespacePrefix.IsEmpty()) {
name = NS_Atomize(aNamespacePrefix);
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);

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

@ -754,7 +754,7 @@ nsAttrValue::GetAsAtom() const
case eAtom:
{
nsCOMPtr<nsIAtom> atom = GetAtomValue();
RefPtr<nsIAtom> atom = GetAtomValue();
return atom.forget();
}
@ -913,7 +913,7 @@ nsAttrValue::HashValue() const
{
uint32_t hash = 0;
uint32_t count = cont->mValue.mAtomArray->Length();
for (nsCOMPtr<nsIAtom> *cur = cont->mValue.mAtomArray->Elements(),
for (RefPtr<nsIAtom> *cur = cont->mValue.mAtomArray->Elements(),
*end = cur + count;
cur != end; ++cur) {
hash = AddToHash(hash, cur->get());
@ -1193,7 +1193,7 @@ nsAttrValue::Contains(nsIAtom* aValue, nsCaseTreatment aCaseSensitive) const
nsDependentAtomString val1(aValue);
for (nsCOMPtr<nsIAtom> *cur = array->Elements(),
for (RefPtr<nsIAtom> *cur = array->Elements(),
*end = cur + array->Length();
cur != end; ++cur) {
// For performance reasons, don't do a full on unicode case
@ -1243,7 +1243,7 @@ nsAttrValue::ParseAtom(const nsAString& aValue)
{
ResetIfSet();
nsCOMPtr<nsIAtom> atom = NS_Atomize(aValue);
RefPtr<nsIAtom> atom = NS_Atomize(aValue);
if (atom) {
SetPtrValueAndType(atom.forget().take(), eAtomBase);
}
@ -1275,7 +1275,7 @@ nsAttrValue::ParseAtomArray(const nsAString& aValue)
++iter;
} while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter));
nsCOMPtr<nsIAtom> classAtom = NS_AtomizeMainThread(Substring(start, iter));
RefPtr<nsIAtom> classAtom = NS_AtomizeMainThread(Substring(start, iter));
if (!classAtom) {
Reset();
return;
@ -1796,7 +1796,7 @@ nsAttrValue::SetMiscAtomOrString(const nsAString* aValue)
"Empty string?");
MiscContainer* cont = GetMiscContainer();
if (len <= NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM) {
nsCOMPtr<nsIAtom> atom = NS_AtomizeMainThread(*aValue);
RefPtr<nsIAtom> atom = NS_AtomizeMainThread(*aValue);
if (atom) {
cont->mStringBits =
reinterpret_cast<uintptr_t>(atom.forget().take()) | eAtomBase;

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

@ -84,7 +84,7 @@ public:
class nsAttrValue {
friend struct MiscContainer;
public:
typedef nsTArray< nsCOMPtr<nsIAtom> > AtomArray;
typedef nsTArray< RefPtr<nsIAtom> > AtomArray;
// This has to be the same as in ValueBaseType
enum ValueType {

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

@ -289,8 +289,8 @@ NS_GetContentList(nsINode* aRootNode,
if (!list) {
// We need to create a ContentList and add it to our new entry, if
// we have an entry
nsCOMPtr<nsIAtom> xmlAtom = NS_Atomize(aTagname);
nsCOMPtr<nsIAtom> htmlAtom;
RefPtr<nsIAtom> xmlAtom = NS_Atomize(aTagname);
RefPtr<nsIAtom> htmlAtom;
if (aMatchNameSpaceId == kNameSpaceID_Unknown) {
nsAutoString lowercaseName;
nsContentUtils::ASCIIToLower(aTagname, lowercaseName);
@ -562,7 +562,7 @@ nsContentList::NamedItem(const nsAString& aName, bool aDoFlush)
uint32_t i, count = mElements.Length();
// Typically IDs and names are atomized
nsCOMPtr<nsIAtom> name = NS_Atomize(aName);
RefPtr<nsIAtom> name = NS_Atomize(aName);
NS_ENSURE_TRUE(name, nullptr);
for (i = 0; i < count; i++) {

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

@ -472,8 +472,8 @@ protected:
nsINode* mRootNode; // Weak ref
int32_t mMatchNameSpaceId;
nsCOMPtr<nsIAtom> mHTMLMatchAtom;
nsCOMPtr<nsIAtom> mXMLMatchAtom;
RefPtr<nsIAtom> mHTMLMatchAtom;
RefPtr<nsIAtom> mXMLMatchAtom;
/**
* Function to use to determine whether a piece of content matches

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

@ -852,7 +852,7 @@ nsContentSink::ProcessMETATag(nsIContent* aContent)
nsAutoString result;
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::content, result);
if (!result.IsEmpty()) {
nsCOMPtr<nsIAtom> fieldAtom(NS_Atomize(header));
RefPtr<nsIAtom> fieldAtom(NS_Atomize(header));
rv = ProcessHeaderData(fieldAtom, result, aContent);
}
}

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

@ -255,9 +255,9 @@ nsNameSpaceManager *nsContentUtils::sNameSpaceManager;
nsIIOService *nsContentUtils::sIOService;
nsIUUIDGenerator *nsContentUtils::sUUIDGenerator;
nsIConsoleService *nsContentUtils::sConsoleService;
nsDataHashtable<nsISupportsHashKey, EventNameMapping>* nsContentUtils::sAtomEventTable = nullptr;
nsDataHashtable<nsRefPtrHashKey<nsIAtom>, EventNameMapping>* nsContentUtils::sAtomEventTable = nullptr;
nsDataHashtable<nsStringHashKey, EventNameMapping>* nsContentUtils::sStringEventTable = nullptr;
nsCOMArray<nsIAtom>* nsContentUtils::sUserDefinedEvents = nullptr;
nsTArray<RefPtr<nsIAtom>>* nsContentUtils::sUserDefinedEvents = nullptr;
nsIStringBundleService *nsContentUtils::sStringBundleService;
nsIStringBundle *nsContentUtils::sStringBundles[PropertiesFile_COUNT];
nsIContentPolicy *nsContentUtils::sContentPolicyService;
@ -953,11 +953,11 @@ nsContentUtils::InitializeEventTable() {
{ nullptr }
};
sAtomEventTable = new nsDataHashtable<nsISupportsHashKey, EventNameMapping>(
sAtomEventTable = new nsDataHashtable<nsRefPtrHashKey<nsIAtom>, EventNameMapping>(
ArrayLength(eventArray));
sStringEventTable = new nsDataHashtable<nsStringHashKey, EventNameMapping>(
ArrayLength(eventArray));
sUserDefinedEvents = new nsCOMArray<nsIAtom>(64);
sUserDefinedEvents = new nsTArray<RefPtr<nsIAtom>>(64);
// Subtract one from the length because of the trailing null
for (uint32_t i = 0; i < ArrayLength(eventArray) - 1; ++i) {
@ -3416,7 +3416,7 @@ nsContentUtils::GetNodeInfoFromQName(const nsAString& aNamespaceURI,
const char16_t* end;
qName.EndReading(end);
nsCOMPtr<nsIAtom> prefix =
RefPtr<nsIAtom> prefix =
NS_AtomizeMainThread(Substring(qName.get(), colon));
rv = aNodeInfoManager->GetNodeInfo(Substring(colon + 1, end), prefix,
@ -4386,18 +4386,18 @@ nsContentUtils::GetEventMessageAndAtom(const nsAString& aName,
}
// If we have cached lots of user defined event names, clear some of them.
if (sUserDefinedEvents->Count() > 127) {
while (sUserDefinedEvents->Count() > 64) {
nsIAtom* first = sUserDefinedEvents->ObjectAt(0);
if (sUserDefinedEvents->Length() > 127) {
while (sUserDefinedEvents->Length() > 64) {
nsIAtom* first = sUserDefinedEvents->ElementAt(0);
sStringEventTable->Remove(Substring(nsDependentAtomString(first), 2));
sUserDefinedEvents->RemoveObjectAt(0);
sUserDefinedEvents->RemoveElementAt(0);
}
}
*aEventMessage = eUnidentifiedEvent;
nsCOMPtr<nsIAtom> atom =
RefPtr<nsIAtom> atom =
NS_AtomizeMainThread(NS_LITERAL_STRING("on") + aName);
sUserDefinedEvents->AppendObject(atom);
sUserDefinedEvents->AppendElement(atom);
mapping.mAtom = atom;
mapping.mMessage = eUnidentifiedEvent;
mapping.mType = EventNameType_None;
@ -4424,7 +4424,7 @@ nsContentUtils::GetEventMessageAndAtomForListener(const nsAString& aName,
// lookups, start from it.
EventNameMapping mapping;
EventMessage msg = eUnidentifiedEvent;
nsCOMPtr<nsIAtom> atom;
RefPtr<nsIAtom> atom;
if (sStringEventTable->Get(aName, &mapping)) {
if (mapping.mMaybeSpecialSVGorSMILEvent) {
// Try the atom version so that we should get the right message for
@ -4630,7 +4630,7 @@ nsContentUtils::MatchElementId(nsIContent *aContent, const nsAString& aId)
NS_PRECONDITION(!aId.IsEmpty(), "Will match random elements");
// ID attrs are generally stored as atoms, so just atomize this up front
nsCOMPtr<nsIAtom> id(NS_Atomize(aId));
RefPtr<nsIAtom> id(NS_Atomize(aId));
if (!id) {
// OOM, so just bail
return nullptr;
@ -5824,7 +5824,7 @@ static void ProcessViewportToken(nsIDocument *aDocument,
/* Check for known keys. If we find a match, insert the appropriate
* information into the document header. */
nsCOMPtr<nsIAtom> key_atom = NS_Atomize(key);
RefPtr<nsIAtom> key_atom = NS_Atomize(key);
if (key_atom == nsGkAtoms::height)
aDocument->SetHeaderData(nsGkAtoms::viewport_height, value);
else if (key_atom == nsGkAtoms::width)

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

@ -3290,9 +3290,9 @@ private:
static nsIConsoleService* sConsoleService;
static nsDataHashtable<nsISupportsHashKey, EventNameMapping>* sAtomEventTable;
static nsDataHashtable<nsRefPtrHashKey<nsIAtom>, EventNameMapping>* sAtomEventTable;
static nsDataHashtable<nsStringHashKey, EventNameMapping>* sStringEventTable;
static nsCOMArray<nsIAtom>* sUserDefinedEvents;
static nsTArray<RefPtr<nsIAtom>>* sUserDefinedEvents;
static nsIStringBundleService* sStringBundleService;
static nsIStringBundle* sStringBundles[PropertiesFile_COUNT];

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

@ -683,7 +683,7 @@ nsDOMMutationObserver::Observe(nsINode& aTarget,
return;
}
nsCOMArray<nsIAtom> filters;
nsTArray<RefPtr<nsIAtom>> filters;
bool allAttrs = true;
if (aOptions.mAttributeFilter.WasPassed()) {
allAttrs = false;
@ -767,18 +767,18 @@ nsDOMMutationObserver::GetObservingInfo(
info.mCharacterDataOldValue.Construct(mr->CharacterDataOldValue());
info.mNativeAnonymousChildList = mr->NativeAnonymousChildList();
info.mAnimations = mr->Animations();
nsCOMArray<nsIAtom>& filters = mr->AttributeFilter();
if (filters.Count()) {
nsTArray<RefPtr<nsIAtom>>& filters = mr->AttributeFilter();
if (filters.Length()) {
info.mAttributeFilter.Construct();
mozilla::dom::Sequence<nsString>& filtersAsStrings =
info.mAttributeFilter.Value();
nsString* strings = filtersAsStrings.AppendElements(filters.Count(),
nsString* strings = filtersAsStrings.AppendElements(filters.Length(),
mozilla::fallible);
if (!strings) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
for (int32_t j = 0; j < filters.Count(); ++j) {
for (size_t j = 0; j < filters.Length(); ++j) {
filters[j]->ToString(strings[j]);
}
}

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

@ -111,8 +111,8 @@ public:
}
nsCOMPtr<nsINode> mTarget;
nsCOMPtr<nsIAtom> mType;
nsCOMPtr<nsIAtom> mAttrName;
RefPtr<nsIAtom> mType;
RefPtr<nsIAtom> mAttrName;
nsString mAttrNamespace;
nsString mPrevValue;
RefPtr<nsSimpleContentList> mAddedNodes;
@ -217,8 +217,8 @@ public:
mAttributeOldValue = aOldValue;
}
nsCOMArray<nsIAtom>& AttributeFilter() { return mAttributeFilter; }
void SetAttributeFilter(nsCOMArray<nsIAtom>&& aFilter)
nsTArray<RefPtr<nsIAtom>>& AttributeFilter() { return mAttributeFilter; }
void SetAttributeFilter(nsTArray<RefPtr<nsIAtom>>&& aFilter)
{
NS_ASSERTION(!mParent, "Shouldn't have parent");
mAttributeFilter.Clear();
@ -305,8 +305,8 @@ protected:
return false;
}
nsCOMArray<nsIAtom>& filters = AttributeFilter();
for (int32_t i = 0; i < filters.Count(); ++i) {
nsTArray<RefPtr<nsIAtom>>& filters = AttributeFilter();
for (size_t i = 0; i < filters.Length(); ++i) {
if (filters[i] == aAttr) {
return true;
}
@ -336,7 +336,7 @@ private:
bool mAllAttributes;
bool mAttributeOldValue;
bool mAnimations;
nsCOMArray<nsIAtom> mAttributeFilter;
nsTArray<RefPtr<nsIAtom>> mAttributeFilter;
};

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

@ -88,7 +88,7 @@ protected:
nsresult CheckToken(const nsAString& aStr);
nsresult CheckTokens(const nsTArray<nsString>& aStr);
void RemoveDuplicatesInternal(nsTArray<nsCOMPtr<nsIAtom>>* aArray,
void RemoveDuplicatesInternal(nsTArray<RefPtr<nsIAtom>>* aArray,
uint32_t aStart);
void AddInternal(const nsAttrValue* aAttr,
const nsTArray<nsString>& aTokens);
@ -100,7 +100,7 @@ protected:
inline const nsAttrValue* GetParsedAttr();
nsCOMPtr<Element> mElement;
nsCOMPtr<nsIAtom> mAttrAtom;
RefPtr<nsIAtom> mAttrAtom;
const mozilla::dom::DOMTokenListSupportedTokenArray mSupportedTokens;
};

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

@ -329,7 +329,7 @@ nsDOMWindowUtils::GetDocumentMetadata(const nsAString& aName,
{
nsIDocument* doc = GetDocument();
if (doc) {
nsCOMPtr<nsIAtom> name = NS_Atomize(aName);
RefPtr<nsIAtom> name = NS_Atomize(aName);
doc->GetHeaderData(name, aValue);
return NS_OK;
}
@ -2971,7 +2971,7 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIAtom> pseudo = nsCSSPseudoElements::GetPseudoAtom(aPseudoElement);
RefPtr<nsIAtom> pseudo = nsCSSPseudoElements::GetPseudoAtom(aPseudoElement);
RefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetUnanimatedStyleContextNoFlush(element,
pseudo, shell);

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

@ -600,7 +600,7 @@ public:
bool& aFound) override
{
aFound = false;
nsCOMPtr<nsIAtom> name = NS_Atomize(aName);
RefPtr<nsIAtom> name = NS_Atomize(aName);
for (uint32_t i = 0; i < mElements.Length(); i++) {
MOZ_DIAGNOSTIC_ASSERT(mElements[i]);
Element* element = mElements[i]->AsElement();
@ -5973,7 +5973,7 @@ GetPseudoElementType(const nsString& aString, ErrorResult& aRv)
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return CSSPseudoElementType::NotPseudo;
}
nsCOMPtr<nsIAtom> pseudo = NS_Atomize(Substring(aString, 1));
RefPtr<nsIAtom> pseudo = NS_Atomize(Substring(aString, 1));
return nsCSSPseudoElements::GetPseudoType(pseudo,
nsCSSProps::EnabledState::eInUASheets);
}
@ -6312,7 +6312,7 @@ nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value*
return true;
}
nsCOMPtr<nsIAtom> typeAtom(NS_Atomize(elemName));
RefPtr<nsIAtom> typeAtom(NS_Atomize(elemName));
CustomElementDefinition* definition =
registry->mCustomDefinitions.GetWeak(typeAtom);
if (!definition) {
@ -7007,7 +7007,7 @@ nsIDocument::GetAnonymousElementByAttribute(Element& aElement,
const nsAString& aAttrName,
const nsAString& aAttrValue)
{
nsCOMPtr<nsIAtom> attribute = NS_Atomize(aAttrName);
RefPtr<nsIAtom> attribute = NS_Atomize(aAttrName);
return GetAnonymousElementByAttribute(&aElement, attribute, aAttrValue);
}
@ -7413,7 +7413,7 @@ nsDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
}
int32_t namespaceID;
nsCOMPtr<nsIAtom> tag = BindingManager()->ResolveTag(aElement, &namespaceID);
RefPtr<nsIAtom> tag = BindingManager()->ResolveTag(aElement, &namespaceID);
#ifdef MOZ_XUL
if (namespaceID == kNameSpaceID_XUL) {
if (tag == nsGkAtoms::browser ||
@ -8711,7 +8711,7 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
rv =
httpChannel->GetResponseHeader(nsDependentCString(*name), headerVal);
if (NS_SUCCEEDED(rv) && !headerVal.IsEmpty()) {
nsCOMPtr<nsIAtom> key = NS_Atomize(*name);
RefPtr<nsIAtom> key = NS_Atomize(*name);
SetHeaderData(key, NS_ConvertASCIItoUTF16(headerVal));
}
++name;

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

@ -144,7 +144,7 @@ public:
delete mNext;
}
nsCOMPtr<nsIAtom> mField;
RefPtr<nsIAtom> mField;
nsString mData;
nsDocHeaderData* mNext;
};

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

@ -297,7 +297,7 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED,
this);
nsCOMPtr<nsIAtom> oldValue;
RefPtr<nsIAtom> oldValue;
if (haveMutationListeners) {
oldValue = GetCurrentValueAtom();
}

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

@ -811,7 +811,7 @@ nsINode::SetUserData(const nsAString &aKey, nsIVariant *aData, nsIVariant **aRes
OwnerDoc()->WarnOnceAbout(nsIDocument::eGetSetUserData);
*aResult = nullptr;
nsCOMPtr<nsIAtom> key = NS_Atomize(aKey);
RefPtr<nsIAtom> key = NS_Atomize(aKey);
if (!key) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -864,7 +864,7 @@ nsIVariant*
nsINode::GetUserData(const nsAString& aKey)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eGetSetUserData);
nsCOMPtr<nsIAtom> key = NS_Atomize(aKey);
RefPtr<nsIAtom> key = NS_Atomize(aKey);
if (!key) {
return nullptr;
}

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

@ -59,7 +59,7 @@ public:
{
}
nsCOMPtr<nsIAtom> mAtom;
RefPtr<nsIAtom> mAtom;
const nsString mString;
};

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

@ -99,7 +99,7 @@ nsNameSpaceManager::RegisterNameSpace(const nsAString& aURI,
return NS_OK;
}
nsCOMPtr<nsIAtom> atom = NS_Atomize(aURI);
RefPtr<nsIAtom> atom = NS_Atomize(aURI);
nsresult rv = NS_OK;
if (!mURIToIDTable.Get(atom, &aNameSpaceID)) {
aNameSpaceID = mURIArray.Length();
@ -141,7 +141,7 @@ nsNameSpaceManager::GetNameSpaceID(const nsAString& aURI,
return kNameSpaceID_None; // xmlns="", see bug 75700 for details
}
nsCOMPtr<nsIAtom> atom = NS_Atomize(aURI);
RefPtr<nsIAtom> atom = NS_Atomize(aURI);
return GetNameSpaceID(atom, aInChromeDoc);
}
@ -234,7 +234,7 @@ nsNameSpaceManager::HasElementCreator(int32_t aNameSpaceID)
nsresult nsNameSpaceManager::AddNameSpace(already_AddRefed<nsIAtom> aURI,
const int32_t aNameSpaceID)
{
nsCOMPtr<nsIAtom> uri = aURI;
RefPtr<nsIAtom> uri = aURI;
if (aNameSpaceID < 0) {
// We've wrapped... Can't do anything else here; just bail.
return NS_ERROR_OUT_OF_MEMORY;
@ -251,7 +251,7 @@ nsresult
nsNameSpaceManager::AddDisabledNameSpace(already_AddRefed<nsIAtom> aURI,
const int32_t aNameSpaceID)
{
nsCOMPtr<nsIAtom> uri = aURI;
RefPtr<nsIAtom> uri = aURI;
if (aNameSpaceID < 0) {
// We've wrapped... Can't do anything else here; just bail.
return NS_ERROR_OUT_OF_MEMORY;

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

@ -73,9 +73,9 @@ private:
nsresult AddDisabledNameSpace(already_AddRefed<nsIAtom> aURI, const int32_t aNameSpaceID);
~nsNameSpaceManager() {};
nsDataHashtable<nsISupportsHashKey, int32_t> mURIToIDTable;
nsDataHashtable<nsISupportsHashKey, int32_t> mDisabledURIToIDTable;
nsTArray<nsCOMPtr<nsIAtom>> mURIArray;
nsDataHashtable<nsRefPtrHashKey<nsIAtom>, int32_t> mURIToIDTable;
nsDataHashtable<nsRefPtrHashKey<nsIAtom>, int32_t> mDisabledURIToIDTable;
nsTArray<RefPtr<nsIAtom>> mURIArray;
static mozilla::StaticRefPtr<nsNameSpaceManager> sInstance;
};

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

@ -281,7 +281,7 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
{
#ifdef DEBUG
{
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(aName);
RefPtr<nsIAtom> nameAtom = NS_Atomize(aName);
CheckValidNodeInfo(aNodeType, nameAtom, aNamespaceID, nullptr);
}
#endif
@ -307,7 +307,7 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
return NS_OK;
}
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(aName);
RefPtr<nsIAtom> nameAtom = NS_Atomize(aName);
NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY);
RefPtr<NodeInfo> newNodeInfo =

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

@ -48,7 +48,7 @@ public:
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
nsCOMPtr<nsIAtom> mName; // property name
RefPtr<nsIAtom> mName; // property name
PLDHashTable mObjectValueMap; // map of object/value pairs
NSPropertyDtorFunc mDtorFunc; // property specific value dtor function
void* mDtorData; // pointer to pass to dtor

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

@ -115,7 +115,7 @@ nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI,
}
if (aWatch) {
nsCOMPtr<nsIAtom> atom = NS_Atomize(ref);
RefPtr<nsIAtom> atom = NS_Atomize(ref);
if (!atom)
return;
atom.swap(mWatchID);
@ -137,7 +137,7 @@ nsReferencedElement::ResetWithID(nsIContent* aFromContent, const nsString& aID,
// XXX Need to take care of XBL/XBL2
if (aWatch) {
nsCOMPtr<nsIAtom> atom = NS_Atomize(aID);
RefPtr<nsIAtom> atom = NS_Atomize(aID);
if (!atom)
return;
atom.swap(mWatchID);

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

@ -182,7 +182,7 @@ private:
};
friend class DocumentLoadNotification;
nsCOMPtr<nsIAtom> mWatchID;
RefPtr<nsIAtom> mWatchID;
nsCOMPtr<nsIDocument> mWatchDocument;
RefPtr<Element> mElement;
RefPtr<Notification> mPendingNotification;

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

@ -90,7 +90,7 @@ private:
nsIContent* mGrandparent;
// What attribute we're showing
int32_t mNameSpaceID;
nsCOMPtr<nsIAtom> mAttrName;
RefPtr<nsIAtom> mAttrName;
};
nsTextNode::~nsTextNode()

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

@ -924,13 +924,13 @@ nsIAtom** const kURLAttributesMathML[] = {
nullptr
};
nsTHashtable<nsISupportsHashKey>* nsTreeSanitizer::sElementsHTML = nullptr;
nsTHashtable<nsISupportsHashKey>* nsTreeSanitizer::sAttributesHTML = nullptr;
nsTHashtable<nsISupportsHashKey>* nsTreeSanitizer::sPresAttributesHTML = nullptr;
nsTHashtable<nsISupportsHashKey>* nsTreeSanitizer::sElementsSVG = nullptr;
nsTHashtable<nsISupportsHashKey>* nsTreeSanitizer::sAttributesSVG = nullptr;
nsTHashtable<nsISupportsHashKey>* nsTreeSanitizer::sElementsMathML = nullptr;
nsTHashtable<nsISupportsHashKey>* nsTreeSanitizer::sAttributesMathML = nullptr;
nsTHashtable<nsRefPtrHashKey<nsIAtom>>* nsTreeSanitizer::sElementsHTML = nullptr;
nsTHashtable<nsRefPtrHashKey<nsIAtom>>* nsTreeSanitizer::sAttributesHTML = nullptr;
nsTHashtable<nsRefPtrHashKey<nsIAtom>>* nsTreeSanitizer::sPresAttributesHTML = nullptr;
nsTHashtable<nsRefPtrHashKey<nsIAtom>>* nsTreeSanitizer::sElementsSVG = nullptr;
nsTHashtable<nsRefPtrHashKey<nsIAtom>>* nsTreeSanitizer::sAttributesSVG = nullptr;
nsTHashtable<nsRefPtrHashKey<nsIAtom>>* nsTreeSanitizer::sElementsMathML = nullptr;
nsTHashtable<nsRefPtrHashKey<nsIAtom>>* nsTreeSanitizer::sAttributesMathML = nullptr;
nsIPrincipal* nsTreeSanitizer::sNullPrincipal = nullptr;
nsTreeSanitizer::nsTreeSanitizer(uint32_t aFlags)
@ -1145,7 +1145,7 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
void
nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
nsTHashtable<nsISupportsHashKey>* aAllowed,
nsTHashtable<nsRefPtrHashKey<nsIAtom>>* aAllowed,
nsIAtom*** aURLs,
bool aAllowXLink,
bool aAllowStyle,
@ -1156,7 +1156,7 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
for (int32_t i = ac - 1; i >= 0; --i) {
const nsAttrName* attrName = aElement->GetAttrNameAt(i);
int32_t attrNs = attrName->NamespaceID();
nsCOMPtr<nsIAtom> attrLocal = attrName->LocalName();
RefPtr<nsIAtom> attrLocal = attrName->LocalName();
if (kNameSpaceID_None == attrNs) {
if (aAllowStyle && nsGkAtoms::style == attrLocal) {
@ -1478,7 +1478,7 @@ nsTreeSanitizer::RemoveAllAttributes(nsIContent* aElement)
const nsAttrName* attrName;
while ((attrName = aElement->GetAttrNameAt(0))) {
int32_t attrNs = attrName->NamespaceID();
nsCOMPtr<nsIAtom> attrLocal = attrName->LocalName();
RefPtr<nsIAtom> attrLocal = attrName->LocalName();
aElement->UnsetAttr(attrNs, attrLocal, false);
}
}
@ -1488,37 +1488,44 @@ nsTreeSanitizer::InitializeStatics()
{
NS_PRECONDITION(!sElementsHTML, "Initializing a second time.");
sElementsHTML = new nsTHashtable<nsISupportsHashKey>(ArrayLength(kElementsHTML));
sElementsHTML =
new nsTHashtable<nsRefPtrHashKey<nsIAtom>>(ArrayLength(kElementsHTML));
for (uint32_t i = 0; kElementsHTML[i]; i++) {
sElementsHTML->PutEntry(*kElementsHTML[i]);
}
sAttributesHTML = new nsTHashtable<nsISupportsHashKey>(ArrayLength(kAttributesHTML));
sAttributesHTML =
new nsTHashtable<nsRefPtrHashKey<nsIAtom>>(ArrayLength(kAttributesHTML));
for (uint32_t i = 0; kAttributesHTML[i]; i++) {
sAttributesHTML->PutEntry(*kAttributesHTML[i]);
}
sPresAttributesHTML = new nsTHashtable<nsISupportsHashKey>(ArrayLength(kPresAttributesHTML));
sPresAttributesHTML =
new nsTHashtable<nsRefPtrHashKey<nsIAtom>>(ArrayLength(kPresAttributesHTML));
for (uint32_t i = 0; kPresAttributesHTML[i]; i++) {
sPresAttributesHTML->PutEntry(*kPresAttributesHTML[i]);
}
sElementsSVG = new nsTHashtable<nsISupportsHashKey>(ArrayLength(kElementsSVG));
sElementsSVG =
new nsTHashtable<nsRefPtrHashKey<nsIAtom>>(ArrayLength(kElementsSVG));
for (uint32_t i = 0; kElementsSVG[i]; i++) {
sElementsSVG->PutEntry(*kElementsSVG[i]);
}
sAttributesSVG = new nsTHashtable<nsISupportsHashKey>(ArrayLength(kAttributesSVG));
sAttributesSVG =
new nsTHashtable<nsRefPtrHashKey<nsIAtom>>(ArrayLength(kAttributesSVG));
for (uint32_t i = 0; kAttributesSVG[i]; i++) {
sAttributesSVG->PutEntry(*kAttributesSVG[i]);
}
sElementsMathML = new nsTHashtable<nsISupportsHashKey>(ArrayLength(kElementsMathML));
sElementsMathML =
new nsTHashtable<nsRefPtrHashKey<nsIAtom>>(ArrayLength(kElementsMathML));
for (uint32_t i = 0; kElementsMathML[i]; i++) {
sElementsMathML->PutEntry(*kElementsMathML[i]);
}
sAttributesMathML = new nsTHashtable<nsISupportsHashKey>(ArrayLength(kAttributesMathML));
sAttributesMathML =
new nsTHashtable<nsRefPtrHashKey<nsIAtom>>(ArrayLength(kAttributesMathML));
for (uint32_t i = 0; kAttributesMathML[i]; i++) {
sAttributesMathML->PutEntry(*kAttributesMathML[i]);
}

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

@ -130,7 +130,7 @@ class MOZ_STACK_CLASS nsTreeSanitizer {
* attribute unsanitized
*/
void SanitizeAttributes(mozilla::dom::Element* aElement,
nsTHashtable<nsISupportsHashKey>* aAllowed,
nsTHashtable<nsRefPtrHashKey<nsIAtom>>* aAllowed,
nsIAtom*** aURLs,
bool aAllowXLink,
bool aAllowStyle,
@ -186,37 +186,37 @@ class MOZ_STACK_CLASS nsTreeSanitizer {
/**
* The whitelist of HTML elements.
*/
static nsTHashtable<nsISupportsHashKey>* sElementsHTML;
static nsTHashtable<nsRefPtrHashKey<nsIAtom>>* sElementsHTML;
/**
* The whitelist of non-presentational HTML attributes.
*/
static nsTHashtable<nsISupportsHashKey>* sAttributesHTML;
static nsTHashtable<nsRefPtrHashKey<nsIAtom>>* sAttributesHTML;
/**
* The whitelist of presentational HTML attributes.
*/
static nsTHashtable<nsISupportsHashKey>* sPresAttributesHTML;
static nsTHashtable<nsRefPtrHashKey<nsIAtom>>* sPresAttributesHTML;
/**
* The whitelist of SVG elements.
*/
static nsTHashtable<nsISupportsHashKey>* sElementsSVG;
static nsTHashtable<nsRefPtrHashKey<nsIAtom>>* sElementsSVG;
/**
* The whitelist of SVG attributes.
*/
static nsTHashtable<nsISupportsHashKey>* sAttributesSVG;
static nsTHashtable<nsRefPtrHashKey<nsIAtom>>* sAttributesSVG;
/**
* The whitelist of SVG elements.
*/
static nsTHashtable<nsISupportsHashKey>* sElementsMathML;
static nsTHashtable<nsRefPtrHashKey<nsIAtom>>* sElementsMathML;
/**
* The whitelist of MathML attributes.
*/
static nsTHashtable<nsISupportsHashKey>* sAttributesMathML;
static nsTHashtable<nsRefPtrHashKey<nsIAtom>>* sAttributesMathML;
/**
* Reusable null principal for URL checks.

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

@ -17,7 +17,7 @@ struct nsNameSpaceEntry
explicit nsNameSpaceEntry(nsIAtom* aPrefix)
: prefix(aPrefix) {}
nsCOMPtr<nsIAtom> prefix;
RefPtr<nsIAtom> prefix;
MOZ_INIT_OUTSIDE_CTOR int32_t nameSpaceID;
};

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

@ -1076,7 +1076,7 @@ protected:
nsTArray<ClipState> clipsAndTransforms;
RefPtr<gfxFontGroup> fontGroup;
nsCOMPtr<nsIAtom> fontLanguage;
RefPtr<nsIAtom> fontLanguage;
nsFont fontFont;
EnumeratedArray<Style, Style::MAX, RefPtr<CanvasGradient>> gradientStyles;

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

@ -208,7 +208,7 @@ private:
struct {
nsTArray<nsString> mStrings;
nsTArray<nsCOMPtr<nsIAtom>> mAtoms;
nsTArray<RefPtr<nsIAtom>> mAtoms;
} mKeepingAliveTypes;
bool mIsKeptAlive;

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

@ -204,7 +204,7 @@ DataTransfer::Constructor(const GlobalObject& aGlobal,
{
nsAutoCString onEventType("on");
AppendUTF16toUTF8(aEventType, onEventType);
nsCOMPtr<nsIAtom> eventTypeAtom = NS_Atomize(onEventType);
RefPtr<nsIAtom> eventTypeAtom = NS_Atomize(onEventType);
if (!eventTypeAtom) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
@ -697,7 +697,7 @@ DataTransfer::TypesListMayHaveChanged()
already_AddRefed<DataTransfer>
DataTransfer::MozCloneForEvent(const nsAString& aEvent, ErrorResult& aRv)
{
nsCOMPtr<nsIAtom> atomEvt = NS_Atomize(aEvent);
RefPtr<nsIAtom> atomEvt = NS_Atomize(aEvent);
if (!atomEvt) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;

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

@ -690,7 +690,7 @@ EventListenerManager::AddEventListenerByType(
const nsAString& aType,
const EventListenerFlags& aFlags)
{
nsCOMPtr<nsIAtom> atom;
RefPtr<nsIAtom> atom;
EventMessage message = mIsMainThreadELM ?
nsContentUtils::GetEventMessageAndAtomForListener(aType,
getter_AddRefs(atom)) :
@ -705,7 +705,7 @@ EventListenerManager::RemoveEventListenerByType(
const nsAString& aType,
const EventListenerFlags& aFlags)
{
nsCOMPtr<nsIAtom> atom;
RefPtr<nsIAtom> atom;
EventMessage message = mIsMainThreadELM ?
nsContentUtils::GetEventMessageAndAtomForListener(aType,
getter_AddRefs(atom)) :
@ -932,7 +932,7 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
}
JSContext* cx = jsapi.cx();
nsCOMPtr<nsIAtom> typeAtom = aListener->mTypeAtom;
RefPtr<nsIAtom> typeAtom = aListener->mTypeAtom;
nsIAtom* attrName = typeAtom;
// Flag us as not a string so we don't keep trying to compile strings which
@ -1498,7 +1498,7 @@ bool
EventListenerManager::HasListenersFor(const nsAString& aEventName)
{
if (mIsMainThreadELM) {
nsCOMPtr<nsIAtom> atom = NS_Atomize(NS_LITERAL_STRING("on") + aEventName);
RefPtr<nsIAtom> atom = NS_Atomize(NS_LITERAL_STRING("on") + aEventName);
return HasListenersFor(atom);
}

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

@ -183,7 +183,7 @@ public:
struct Listener
{
EventListenerHolder mListener;
nsCOMPtr<nsIAtom> mTypeAtom; // for the main thread
RefPtr<nsIAtom> mTypeAtom; // for the main thread
nsString mTypeString; // for non-main-threads
EventMessage mEventMessage;
@ -631,7 +631,7 @@ protected:
nsAutoTObserverArray<Listener, 2> mListeners;
dom::EventTarget* MOZ_NON_OWNING_REF mTarget;
nsCOMPtr<nsIAtom> mNoListenerForEventAtom;
RefPtr<nsIAtom> mNoListenerForEventAtom;
friend class ELMCreationDetector;
static uint32_t sMainThreadCreatedCount;

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

@ -37,13 +37,12 @@ EventListenerChange::~EventListenerChange()
EventListenerChange::EventListenerChange(dom::EventTarget* aTarget) :
mTarget(aTarget)
{
mChangedListenerNames = nsArrayBase::Create();
}
void
EventListenerChange::AddChangedListenerName(nsIAtom* aEventName)
{
mChangedListenerNames->AppendElement(aEventName, false);
mChangedListenerNames.AppendElement(aEventName);
}
NS_IMETHODIMP
@ -60,13 +59,9 @@ EventListenerChange::GetCountOfEventListenerChangesAffectingAccessibility(
{
*aCount = 0;
uint32_t length;
nsresult rv = mChangedListenerNames->GetLength(&length);
NS_ENSURE_SUCCESS(rv, rv);
size_t length = mChangedListenerNames.Length();
for (size_t i = 0; i < length; i++) {
nsCOMPtr<nsIAtom> listenerName =
do_QueryElementAt(mChangedListenerNames, i);
RefPtr<nsIAtom> listenerName = mChangedListenerNames[i];
// These are the event listener changes which may make an element
// accessible or inaccessible.

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

@ -41,8 +41,7 @@ public:
protected:
virtual ~EventListenerChange();
nsCOMPtr<dom::EventTarget> mTarget;
nsCOMPtr<nsIMutableArray> mChangedListenerNames;
nsTArray<RefPtr<nsIAtom>> mChangedListenerNames;
};
class EventListenerInfo final : public nsIEventListenerInfo

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

@ -41,7 +41,7 @@ EventTarget::SetEventHandler(const nsAString& aType,
return;
}
if (NS_IsMainThread()) {
nsCOMPtr<nsIAtom> type = NS_Atomize(aType);
RefPtr<nsIAtom> type = NS_Atomize(aType);
SetEventHandler(type, EmptyString(), aHandler);
return;
}

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

@ -60,7 +60,7 @@ public:
// Note, this takes the type in onfoo form!
EventHandlerNonNull* GetEventHandler(const nsAString& aType)
{
nsCOMPtr<nsIAtom> type = NS_Atomize(aType);
RefPtr<nsIAtom> type = NS_Atomize(aType);
return GetEventHandler(type, EmptyString());
}

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

@ -37,9 +37,9 @@ public:
}
nsCOMPtr<nsIDOMNode> mRelatedNode;
nsCOMPtr<nsIAtom> mAttrName;
nsCOMPtr<nsIAtom> mPrevAttrValue;
nsCOMPtr<nsIAtom> mNewAttrValue;
RefPtr<nsIAtom> mAttrName;
RefPtr<nsIAtom> mPrevAttrValue;
RefPtr<nsIAtom> mNewAttrValue;
unsigned short mAttrChange;
void AssignMutationEventData(const InternalMutationEvent& aEvent,

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

@ -260,7 +260,7 @@ protected:
virtual ~JSEventHandler();
nsISupports* mTarget;
nsCOMPtr<nsIAtom> mEventName;
RefPtr<nsIAtom> mEventName;
TypedEventHandler mTypedHandler;
};

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

@ -112,7 +112,7 @@ HTMLAllCollection::GetDocumentAllList(const nsAString& aID)
{
return mNamedMap.LookupForAdd(aID).OrInsert(
[this, &aID] () {
nsCOMPtr<nsIAtom> id = NS_Atomize(aID);
RefPtr<nsIAtom> id = NS_Atomize(aID);
return new nsContentList(mDocument, DocAllResultMatch, nullptr,
nullptr, true, id);
});

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

@ -258,7 +258,7 @@ TableRowsCollection::GetFirstNamedElement(const nsAString& aName, bool& aFound)
{
EnsureInitialized();
aFound = false;
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(aName);
RefPtr<nsIAtom> nameAtom = NS_Atomize(aName);
NS_ENSURE_TRUE(nameAtom, nullptr);
for (auto& node : mRows) {

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

@ -100,7 +100,7 @@ nsDOMStringMap::NamedSetter(const nsAString& aProp,
return;
}
nsCOMPtr<nsIAtom> attrAtom = NS_Atomize(attr);
RefPtr<nsIAtom> attrAtom = NS_Atomize(attr);
MOZ_ASSERT(attrAtom, "Should be infallible");
res = mElement->SetAttr(kNameSpaceID_None, attrAtom, aValue, true);
@ -124,7 +124,7 @@ nsDOMStringMap::NamedDeleter(const nsAString& aProp, bool& found)
return;
}
nsCOMPtr<nsIAtom> attrAtom = NS_Atomize(attr);
RefPtr<nsIAtom> attrAtom = NS_Atomize(attr);
MOZ_ASSERT(attrAtom, "Should be infallible");
found = mElement->HasAttr(kNameSpaceID_None, attrAtom);

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

@ -2200,7 +2200,7 @@ nsGenericHTMLFormElement::AddFormIdObserver()
GetAttr(kNameSpaceID_None, nsGkAtoms::form, formId);
NS_ASSERTION(!formId.IsEmpty(),
"@form value should not be the empty string!");
nsCOMPtr<nsIAtom> atom = NS_Atomize(formId);
RefPtr<nsIAtom> atom = NS_Atomize(formId);
return doc->AddIDTargetObserver(atom, FormIdUpdated, this, false);
}
@ -2229,7 +2229,7 @@ nsGenericHTMLFormElement::RemoveFormIdObserver()
GetAttr(kNameSpaceID_None, nsGkAtoms::form, formId);
NS_ASSERTION(!formId.IsEmpty(),
"@form value should not be the empty string!");
nsCOMPtr<nsIAtom> atom = NS_Atomize(formId);
RefPtr<nsIAtom> atom = NS_Atomize(formId);
doc->RemoveIDTargetObserver(atom, FormIdUpdated, this, false);
}

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

@ -301,8 +301,8 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
// SetupCustomElement() should be called with an element that don't have
// CustomElementData setup, if not we will hit the assertion in
// SetCustomElementData().
nsCOMPtr<nsIAtom> tagAtom = nodeInfo->NameAtom();
nsCOMPtr<nsIAtom> typeAtom = aIs ? NS_Atomize(*aIs) : tagAtom;
RefPtr<nsIAtom> tagAtom = nodeInfo->NameAtom();
RefPtr<nsIAtom> typeAtom = aIs ? NS_Atomize(*aIs) : tagAtom;
// Built-in element
*aResult = CreateHTMLElement(tag, nodeInfo.forget(), aFromParser).take();
(*aResult)->SetCustomElementData(new CustomElementData(typeAtom));

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

@ -676,7 +676,7 @@ nsSMILAnimationController::GetTargetIdentifierForAnimation(
// Look up target (animated) attribute
// SMILANIM section 3.1, attributeName may
// have an XMLNS prefix to indicate the XML namespace.
nsCOMPtr<nsIAtom> attributeName;
RefPtr<nsIAtom> attributeName;
int32_t attributeNamespaceID;
if (!aAnimElem->GetTargetAttributeName(&attributeNamespaceID,
getter_AddRefs(attributeName)))

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

@ -550,7 +550,7 @@ nsSVGElement::ParseAttribute(int32_t aNamespaceID,
EnumAttributesInfo enumInfo = GetEnumInfo();
for (i = 0; i < enumInfo.mEnumCount; i++) {
if (aAttribute == *enumInfo.mEnumInfo[i].mName) {
nsCOMPtr<nsIAtom> valAtom = NS_Atomize(aValue);
RefPtr<nsIAtom> valAtom = NS_Atomize(aValue);
rv = enumInfo.mEnums[i].SetBaseValueAtom(valAtom, this);
if (NS_FAILED(rv)) {
enumInfo.Reset(i);
@ -1290,7 +1290,7 @@ MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName,
mDecl->AsGecko()->ValueAppended(propertyID);
mDecl->AsGecko()->CompressFrom(&block);
} else {
nsCOMPtr<nsIAtom> atom = NS_Atomize(aMappedAttrValue);
RefPtr<nsIAtom> atom = NS_Atomize(aMappedAttrValue);
Servo_DeclarationBlock_SetIdentStringValue(mDecl->AsServo()->Raw(), propertyID, atom);
}
}

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

@ -145,7 +145,7 @@ protected:
private:
nsTArray<nsIContent*> mInsertedChildren; // WEAK
nsTArray<nsCOMPtr<nsIAtom> > mIncludes;
nsTArray<RefPtr<nsIAtom> > mIncludes;
};
} // namespace dom

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

@ -405,7 +405,7 @@ nsXBLBinding::GenerateAnonymousContent()
int32_t namespaceID = attrInfo.mName->NamespaceID();
// Hold a strong reference here so that the atom doesn't go away during
// UnsetAttr.
nsCOMPtr<nsIAtom> name = attrInfo.mName->LocalName();
RefPtr<nsIAtom> name = attrInfo.mName->LocalName();
if (name != nsGkAtoms::includes) {
if (!nsContentUtils::HasNonEmptyAttr(mBoundElement, namespaceID, name)) {
@ -505,7 +505,7 @@ nsXBLBinding::InstallEventHandlers()
nsXBLPrototypeHandler* curr;
for (curr = handlerChain; curr; curr = curr->GetNextHandler()) {
// Fetch the event type.
nsCOMPtr<nsIAtom> eventAtom = curr->GetEventName();
RefPtr<nsIAtom> eventAtom = curr->GetEventName();
if (!eventAtom ||
eventAtom == nsGkAtoms::keyup ||
eventAtom == nsGkAtoms::keydown ||
@ -657,7 +657,7 @@ nsXBLBinding::UnhookEventHandlers()
continue;
}
nsCOMPtr<nsIAtom> eventAtom = curr->GetEventName();
RefPtr<nsIAtom> eventAtom = curr->GetEventName();
if (!eventAtom ||
eventAtom == nsGkAtoms::keyup ||
eventAtom == nsGkAtoms::keydown ||

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

@ -274,7 +274,7 @@ nsXBLContentSink::HandleEndElement(const char16_t *aName)
if (mState != eXBL_InDocument) {
int32_t nameSpaceID;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
nsContentUtils::SplitExpatName(aName, getter_AddRefs(prefix),
getter_AddRefs(localName), &nameSpaceID);
@ -574,7 +574,7 @@ nsXBLContentSink::ConstructBinding(uint32_t aLineNumber)
static bool
FindValue(const char16_t **aAtts, nsIAtom *aAtom, const char16_t **aResult)
{
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
for (; *aAtts; aAtts += 2) {
int32_t nameSpaceID;
nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix),
@ -607,7 +607,7 @@ nsXBLContentSink::ConstructHandler(const char16_t **aAtts, uint32_t aLineNumber)
const char16_t* preventdefault = nullptr;
const char16_t* allowuntrusted = nullptr;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
for (; *aAtts; aAtts += 2) {
int32_t nameSpaceID;
nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix),
@ -705,7 +705,7 @@ nsXBLContentSink::ConstructImplementation(const char16_t **aAtts)
const char16_t* name = nullptr;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
for (; *aAtts; aAtts += 2) {
int32_t nameSpaceID;
nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix),
@ -737,7 +737,7 @@ nsXBLContentSink::ConstructField(const char16_t **aAtts, uint32_t aLineNumber)
const char16_t* name = nullptr;
const char16_t* readonly = nullptr;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
for (; *aAtts; aAtts += 2) {
int32_t nameSpaceID;
nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix),
@ -774,7 +774,7 @@ nsXBLContentSink::ConstructProperty(const char16_t **aAtts, uint32_t aLineNumber
const char16_t* onset = nullptr;
bool exposeToUntrustedContent = false;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
for (; *aAtts; aAtts += 2) {
int32_t nameSpaceID;
nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix),
@ -908,7 +908,7 @@ nsXBLContentSink::AddAttributesToXULPrototype(const char16_t **aAtts,
aElement->mNumAttributes = aAttsCount;
// Copy the attributes into the prototype
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
uint32_t i;
for (i = 0; i < aAttsCount; ++i) {

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

@ -105,7 +105,7 @@ private:
const IgnoreModifierState& aIgnoreModifierState);
nsTArray<nsXBLPrototypeHandler*> mProtoHandlers;
nsCOMPtr<nsIAtom> mEventType;
RefPtr<nsIAtom> mEventType;
uint8_t mPhase;
uint8_t mType;
bool mIsBoundToChrome;

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

@ -85,8 +85,8 @@ public:
protected:
nsIContent* mElement;
nsCOMPtr<nsIAtom> mSrcAttribute;
nsCOMPtr<nsIAtom> mDstAttribute;
RefPtr<nsIAtom> mSrcAttribute;
RefPtr<nsIAtom> mDstAttribute;
int32_t mDstNameSpace;
nsXBLAttributeEntry* mNext;
};
@ -350,7 +350,7 @@ nsXBLPrototypeBinding::AttributeChanged(nsIAtom* aAttribute,
if (realElement) {
// Hold a strong reference here so that the atom doesn't go away during
// UnsetAttr.
nsCOMPtr<nsIAtom> dstAttr = xblAttr->GetDstAttribute();
RefPtr<nsIAtom> dstAttr = xblAttr->GetDstAttribute();
int32_t dstNs = xblAttr->GetDstNameSpace();
if (aRemoveFlag)
@ -637,9 +637,9 @@ nsXBLPrototypeBinding::ConstructAttributeTable(nsIContent* aElement)
char* token = nsCRT::strtok( str, ", ", &newStr );
while( token != nullptr ) {
// Build an atom out of this attribute.
nsCOMPtr<nsIAtom> atom;
RefPtr<nsIAtom> atom;
int32_t atomNsID = kNameSpaceID_None;
nsCOMPtr<nsIAtom> attribute;
RefPtr<nsIAtom> attribute;
int32_t attributeNsID = kNameSpaceID_None;
// Figure out if this token contains a :.
@ -773,7 +773,7 @@ nsXBLPrototypeBinding::CreateKeyHandlers()
{
nsXBLPrototypeHandler* curr = mPrototypeHandler;
while (curr) {
nsCOMPtr<nsIAtom> eventAtom = curr->GetEventName();
RefPtr<nsIAtom> eventAtom = curr->GetEventName();
if (eventAtom == nsGkAtoms::keyup ||
eventAtom == nsGkAtoms::keydown ||
eventAtom == nsGkAtoms::keypress) {
@ -980,8 +980,8 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
rv = aStream->ReadString(attrValue);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAtom> atomPrefix = NS_Atomize(attrPrefix);
nsCOMPtr<nsIAtom> atomName = NS_Atomize(attrName);
RefPtr<nsIAtom> atomPrefix = NS_Atomize(attrPrefix);
RefPtr<nsIAtom> atomName = NS_Atomize(attrName);
mBinding->SetAttr(attrNamespace, atomName, atomPrefix, attrValue, false);
}
}
@ -1229,14 +1229,14 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
rv = aStream->ReadString(prefix);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAtom> prefixAtom;
RefPtr<nsIAtom> prefixAtom;
if (!prefix.IsEmpty())
prefixAtom = NS_Atomize(prefix);
rv = aStream->ReadString(tag);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAtom> tagAtom = NS_Atomize(tag);
RefPtr<nsIAtom> tagAtom = NS_Atomize(tag);
RefPtr<NodeInfo> nodeInfo =
aNim->GetNodeInfo(tagAtom, prefixAtom, namespaceID, nsIDOMNode::ELEMENT_NODE);
@ -1274,12 +1274,12 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
rv = aStream->ReadString(val);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(name);
RefPtr<nsIAtom> nameAtom = NS_Atomize(name);
if (namespaceID == kNameSpaceID_None) {
attrs[i].mName.SetTo(nameAtom);
}
else {
nsCOMPtr<nsIAtom> prefixAtom;
RefPtr<nsIAtom> prefixAtom;
if (!prefix.IsEmpty())
prefixAtom = NS_Atomize(prefix);
@ -1317,11 +1317,11 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
rv = aStream->ReadString(val);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAtom> prefixAtom;
RefPtr<nsIAtom> prefixAtom;
if (!prefix.IsEmpty())
prefixAtom = NS_Atomize(prefix);
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(name);
RefPtr<nsIAtom> nameAtom = NS_Atomize(name);
content->SetAttr(namespaceID, nameAtom, prefixAtom, val, false);
}
@ -1344,8 +1344,8 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
rv = aStream->ReadString(destAttribute);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAtom> srcAtom = NS_Atomize(srcAttribute);
nsCOMPtr<nsIAtom> destAtom = NS_Atomize(destAttribute);
RefPtr<nsIAtom> srcAtom = NS_Atomize(srcAttribute);
RefPtr<nsIAtom> destAtom = NS_Atomize(destAttribute);
EnsureAttributeTable();
AddToAttributeTable(srcNamespaceID, srcAtom, destNamespaceID, destAtom, content);
@ -1615,7 +1615,7 @@ nsXBLPrototypeBinding::ResolveBaseBinding()
nsContentUtils::NameSpaceManager()->GetNameSpaceID(nameSpace,
nsContentUtils::IsChromeDoc(doc));
nsCOMPtr<nsIAtom> tagName = NS_Atomize(display);
RefPtr<nsIAtom> tagName = NS_Atomize(display);
// Check the white list
if (!CheckTagNameWhiteList(nameSpaceID, tagName)) {
const char16_t* params[] = { display.get() };

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

@ -268,7 +268,7 @@ public:
bool ChromeOnlyContent() { return mChromeOnlyContent; }
bool BindToUntrustedContent() { return mBindToUntrustedContent; }
typedef nsClassHashtable<nsISupportsHashKey, nsXBLAttributeEntry> InnerAttributeTable;
typedef nsClassHashtable<nsRefPtrHashKey<nsIAtom>, nsXBLAttributeEntry> InnerAttributeTable;
protected:
// Ensure that mAttributeTable has been created.
@ -355,7 +355,7 @@ protected:
nsInterfaceHashtable<IIDHashKey, nsIContent> mInterfaceTable; // A table of cached interfaces that we support.
int32_t mBaseNameSpaceID; // If we extend a tagname/namespace, then that information will
nsCOMPtr<nsIAtom> mBaseTag; // be stored in here.
RefPtr<nsIAtom> mBaseTag; // be stored in here.
nsCOMArray<nsXBLKeyEventHandler> mKeyHandlers;
};

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

@ -294,7 +294,7 @@ nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
// Look for a compiled handler on the element.
// Should be compiled and bound with "on" in front of the name.
nsCOMPtr<nsIAtom> onEventAtom = NS_Atomize(NS_LITERAL_STRING("onxbl") +
RefPtr<nsIAtom> onEventAtom = NS_Atomize(NS_LITERAL_STRING("onxbl") +
nsDependentAtomString(mEventName));
// Compile the handler and bind it to the element.
@ -661,7 +661,7 @@ nsXBLPrototypeHandler::GetModifiersMask() const
already_AddRefed<nsIAtom>
nsXBLPrototypeHandler::GetEventName()
{
nsCOMPtr<nsIAtom> eventName = mEventName;
RefPtr<nsIAtom> eventName = mEventName;
return eventName.forget();
}

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

@ -244,7 +244,7 @@ protected:
// Prototype handlers are chained. We own the next handler in the chain.
nsXBLPrototypeHandler* mNextHandler;
nsCOMPtr<nsIAtom> mEventName; // The type of the event, e.g., "keypress"
RefPtr<nsIAtom> mEventName; // The type of the event, e.g., "keypress"
RefPtr<nsXBLEventHandler> mHandler;
nsXBLPrototypeBinding* mPrototypeBinding; // the binding owns us
};

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

@ -510,7 +510,7 @@ nsXBLWindowKeyHandler::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
nsCOMPtr<nsIAtom> eventTypeAtom =
RefPtr<nsIAtom> eventTypeAtom =
ConvertEventToDOMEventType(*widgetKeyboardEvent);
return WalkHandlers(keyEvent, eventTypeAtom);
}
@ -810,7 +810,7 @@ nsXBLWindowKeyHandler::HasHandlerForEvent(nsIDOMKeyEvent* aEvent,
return false;
}
nsCOMPtr<nsIAtom> eventTypeAtom =
RefPtr<nsIAtom> eventTypeAtom =
ConvertEventToDOMEventType(*widgetKeyboardEvent);
return WalkHandlersInternal(aEvent, eventTypeAtom, mHandler, false,
aOutReservedForChrome);

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

@ -22,7 +22,7 @@ NS_NewXMLProcessingInstruction(nsNodeInfoManager *aNodeInfoManager,
NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");
nsCOMPtr<nsIAtom> target = NS_Atomize(aTarget);
RefPtr<nsIAtom> target = NS_Atomize(aTarget);
MOZ_ASSERT(target);
if (target == nsGkAtoms::xml_stylesheet) {

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

@ -945,7 +945,7 @@ nsXMLContentSink::HandleStartElement(const char16_t *aName,
mState = eXMLContentSinkState_InDocumentElement;
int32_t nameSpaceID;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
nsContentUtils::SplitExpatName(aName, getter_AddRefs(prefix),
getter_AddRefs(localName), &nameSpaceID);
@ -1051,7 +1051,7 @@ nsXMLContentSink::HandleEndElement(const char16_t *aName,
NS_ASSERTION(content, "failed to pop content");
#ifdef DEBUG
// Check that we're closing the right thing
nsCOMPtr<nsIAtom> debugNameSpacePrefix, debugTagAtom;
RefPtr<nsIAtom> debugNameSpacePrefix, debugTagAtom;
int32_t debugNameSpaceID;
nsContentUtils::SplitExpatName(aName, getter_AddRefs(debugNameSpacePrefix),
getter_AddRefs(debugTagAtom),
@ -1154,7 +1154,7 @@ nsXMLContentSink::HandleDoctypeDecl(const nsAString & aSubset,
NS_ASSERTION(mDocument, "Shouldn't get here from a document fragment");
nsCOMPtr<nsIAtom> name = NS_Atomize(aName);
RefPtr<nsIAtom> name = NS_Atomize(aName);
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
// Create a new doctype node
@ -1403,7 +1403,7 @@ nsXMLContentSink::AddAttributes(const char16_t** aAtts,
nsIContent* aContent)
{
// Add tag attributes to the content attributes
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
while (*aAtts) {
int32_t nameSpaceID;
nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix),

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

@ -22,7 +22,7 @@ txExpandedName::init(const nsAString& aQName, txNamespaceMap* aResolver,
}
if (colon) {
nsCOMPtr<nsIAtom> prefix = NS_Atomize(Substring(qName.get(), colon));
RefPtr<nsIAtom> prefix = NS_Atomize(Substring(qName.get(), colon));
int32_t namespaceID = aResolver->lookupNamespace(prefix);
if (namespaceID == kNameSpaceID_Unknown)
return NS_ERROR_FAILURE;

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

@ -64,7 +64,7 @@ public:
}
int32_t mNamespaceID;
nsCOMPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mLocalName;
};
#endif

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

@ -94,7 +94,7 @@ protected:
friend class txMapItemComparator;
struct MapItem {
int32_t mNamespaceID;
nsCOMPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mLocalName;
void* mValue;
};

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

@ -27,7 +27,7 @@ txNamespaceMap::mapNamespace(nsIAtom* aPrefix, const nsAString& aNamespaceURI)
// Remove the mapping
int32_t index = mPrefixes.IndexOf(prefix);
if (index >= 0) {
mPrefixes.RemoveObjectAt(index);
mPrefixes.RemoveElementAt(index);
mNamespaces.RemoveElementAt(index);
}
@ -52,12 +52,12 @@ txNamespaceMap::mapNamespace(nsIAtom* aPrefix, const nsAString& aNamespaceURI)
}
// New mapping
if (!mPrefixes.AppendObject(prefix)) {
if (!mPrefixes.AppendElement(prefix)) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (mNamespaces.AppendElement(nsId) == nullptr) {
mPrefixes.RemoveObjectAt(mPrefixes.Count() - 1);
mPrefixes.RemoveElementAt(mPrefixes.Length() - 1);
return NS_ERROR_OUT_OF_MEMORY;
}
@ -89,7 +89,7 @@ txNamespaceMap::lookupNamespace(nsIAtom* aPrefix)
int32_t
txNamespaceMap::lookupNamespaceWithDefault(const nsAString& aPrefix)
{
nsCOMPtr<nsIAtom> prefix = NS_Atomize(aPrefix);
RefPtr<nsIAtom> prefix = NS_Atomize(aPrefix);
if (prefix != nsGkAtoms::_poundDefault) {
return lookupNamespace(prefix);
}

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

@ -36,7 +36,7 @@ public:
private:
nsAutoRefCnt mRefCnt;
nsCOMArray<nsIAtom> mPrefixes;
nsTArray<RefPtr<nsIAtom>> mPrefixes;
nsTArray<int32_t> mNamespaces;
};

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

@ -449,8 +449,8 @@ public:
TX_DECL_NODE_TEST
nsCOMPtr<nsIAtom> mPrefix;
nsCOMPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mLocalName;
int32_t mNamespace;
private:
uint16_t mNodeType;
@ -496,7 +496,7 @@ public:
private:
NodeType mNodeType;
nsCOMPtr<nsIAtom> mNodeName;
RefPtr<nsIAtom> mNodeName;
};
/**
@ -831,8 +831,8 @@ public:
TX_DECL_EXPR
private:
nsCOMPtr<nsIAtom> mPrefix;
nsCOMPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mLocalName;
int32_t mNamespace;
};
@ -980,8 +980,8 @@ public:
private:
int32_t mNamespace;
nsCOMPtr<nsIAtom> mPrefix;
nsCOMPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mLocalName;
};
/**

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

@ -363,7 +363,7 @@ txExprParser::createFilterOrStep(txExprLexer& lexer, txIParseContext* aContext,
case Token::VAR_REFERENCE :
lexer.nextToken();
{
nsCOMPtr<nsIAtom> prefix, lName;
RefPtr<nsIAtom> prefix, lName;
int32_t nspace;
nsresult rv = resolveQName(tok->Value(), getter_AddRefs(prefix),
aContext, getter_AddRefs(lName),
@ -424,7 +424,7 @@ txExprParser::createFunctionCall(txExprLexer& lexer, txIParseContext* aContext,
"FunctionCall expected");
//-- compare function names
nsCOMPtr<nsIAtom> prefix, lName;
RefPtr<nsIAtom> prefix, lName;
int32_t namespaceID;
nsresult rv = resolveQName(tok->Value(), getter_AddRefs(prefix), aContext,
getter_AddRefs(lName), namespaceID);
@ -482,7 +482,7 @@ txExprParser::createLocationStep(txExprLexer& lexer, txIParseContext* aContext,
{
//-- eat token
lexer.nextToken();
nsCOMPtr<nsIAtom> axis = NS_Atomize(tok->Value());
RefPtr<nsIAtom> axis = NS_Atomize(tok->Value());
if (axis == nsGkAtoms::ancestor) {
axisIdentifier = LocationStep::ANCESTOR_AXIS;
}
@ -556,7 +556,7 @@ txExprParser::createLocationStep(txExprLexer& lexer, txIParseContext* aContext,
if (tok->mType == Token::CNAME) {
lexer.nextToken();
// resolve QName
nsCOMPtr<nsIAtom> prefix, lName;
RefPtr<nsIAtom> prefix, lName;
int32_t nspace;
rv = resolveQName(tok->Value(), getter_AddRefs(prefix),
aContext, getter_AddRefs(lName),

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

@ -112,7 +112,7 @@ FunctionCall::argsSensitiveTo(ContextSensitivity aContext)
void
FunctionCall::toString(nsAString& aDest)
{
nsCOMPtr<nsIAtom> functionNameAtom;
RefPtr<nsIAtom> functionNameAtom;
if (NS_FAILED(getNameAtom(getter_AddRefs(functionNameAtom)))) {
NS_ERROR("Can't get function name.");
return;

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

@ -294,7 +294,7 @@ txXPathNodeUtils::getLocalName(const txXPathNode& aNode)
if (aNode.isContent()) {
if (aNode.mNode->IsElement()) {
nsCOMPtr<nsIAtom> localName =
RefPtr<nsIAtom> localName =
aNode.Content()->NodeInfo()->NameAtom();
return localName.forget();
}
@ -310,7 +310,7 @@ txXPathNodeUtils::getLocalName(const txXPathNode& aNode)
return nullptr;
}
nsCOMPtr<nsIAtom> localName = aNode.Content()->
RefPtr<nsIAtom> localName = aNode.Content()->
GetAttrNameAt(aNode.mIndex)->LocalName();
return localName.forget();

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

@ -120,7 +120,7 @@ private:
nsIID mIID;
uint16_t mMethodIndex;
#ifdef TX_TO_STRING
nsCOMPtr<nsIAtom> mName;
RefPtr<nsIAtom> mName;
#endif
nsCOMPtr<nsISupports> mState;
};

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

@ -205,7 +205,7 @@ txXPathNodeUtils::localNameEquals(const txXPathNode& aNode,
return aNode.Content()->NodeInfo()->Equals(aLocalName);
}
nsCOMPtr<nsIAtom> localName = txXPathNodeUtils::getLocalName(aNode);
RefPtr<nsIAtom> localName = txXPathNodeUtils::getLocalName(aNode);
return localName == aLocalName;
}

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

@ -100,9 +100,9 @@ public:
{
MOZ_COUNT_DTOR_INHERITED(txStartElementAtomTransaction, txOutputTransaction);
}
nsCOMPtr<nsIAtom> mPrefix;
nsCOMPtr<nsIAtom> mLocalName;
nsCOMPtr<nsIAtom> mLowercaseLocalName;
RefPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mLowercaseLocalName;
int32_t mNsID;
};
@ -122,7 +122,7 @@ public:
{
MOZ_COUNT_DTOR_INHERITED(txStartElementTransaction, txOutputTransaction);
}
nsCOMPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mPrefix;
nsString mLocalName;
int32_t mNsID;
};
@ -145,7 +145,7 @@ public:
{
MOZ_COUNT_DTOR_INHERITED(txAttributeTransaction, txOutputTransaction);
}
nsCOMPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mPrefix;
nsString mLocalName;
int32_t mNsID;
nsString mValue;
@ -170,9 +170,9 @@ public:
{
MOZ_COUNT_DTOR_INHERITED(txAttributeAtomTransaction, txOutputTransaction);
}
nsCOMPtr<nsIAtom> mPrefix;
nsCOMPtr<nsIAtom> mLocalName;
nsCOMPtr<nsIAtom> mLowercaseLocalName;
RefPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mLowercaseLocalName;
int32_t mNsID;
nsString mValue;
};

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

@ -87,7 +87,7 @@ public:
public:
txStylesheet::ImportFrame* mFrame;
int32_t mModeNsId;
nsCOMPtr<nsIAtom> mModeLocalName;
RefPtr<nsIAtom> mModeLocalName;
txVariableMap* mParams;
};

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

@ -113,7 +113,7 @@ txAttribute::execute(txExecutionState& aEs)
return NS_OK;
}
nsCOMPtr<nsIAtom> prefix;
RefPtr<nsIAtom> prefix;
uint32_t lnameStart = 0;
if (colon) {
prefix = NS_Atomize(Substring(name.get(), colon));
@ -229,7 +229,7 @@ txCopyBase::copyNode(const txXPathNode& aNode, txExecutionState& aEs)
nsAutoString nodeValue;
txXPathNodeUtils::appendNodeValue(aNode, nodeValue);
nsCOMPtr<nsIAtom> localName =
RefPtr<nsIAtom> localName =
txXPathNodeUtils::getLocalName(aNode);
return aEs.mResultHandler->
attribute(txXPathNodeUtils::getPrefix(aNode),
@ -257,7 +257,7 @@ txCopyBase::copyNode(const txXPathNode& aNode, txExecutionState& aEs)
}
case txXPathNodeType::ELEMENT_NODE:
{
nsCOMPtr<nsIAtom> localName =
RefPtr<nsIAtom> localName =
txXPathNodeUtils::getLocalName(aNode);
nsresult rv = aEs.mResultHandler->
startElement(txXPathNodeUtils::getPrefix(aNode),
@ -340,7 +340,7 @@ txCopy::execute(txExecutionState& aEs)
}
case txXPathNodeType::ELEMENT_NODE:
{
nsCOMPtr<nsIAtom> localName =
RefPtr<nsIAtom> localName =
txXPathNodeUtils::getLocalName(node);
rv = aEs.mResultHandler->
startElement(txXPathNodeUtils::getPrefix(node),
@ -826,7 +826,7 @@ txStartElement::execute(txExecutionState& aEs)
int32_t nsId = kNameSpaceID_None;
nsCOMPtr<nsIAtom> prefix;
RefPtr<nsIAtom> prefix;
uint32_t lnameStart = 0;
const char16_t* colon;

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

@ -191,9 +191,9 @@ public:
TX_DECL_TXINSTRUCTION
int32_t mNamespaceID;
nsCOMPtr<nsIAtom> mLocalName;
nsCOMPtr<nsIAtom> mLowercaseLocalName;
nsCOMPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mLowercaseLocalName;
RefPtr<nsIAtom> mPrefix;
nsAutoPtr<Expr> mValue;
};
@ -358,9 +358,9 @@ public:
TX_DECL_TXINSTRUCTION
int32_t mNamespaceID;
nsCOMPtr<nsIAtom> mLocalName;
nsCOMPtr<nsIAtom> mLowercaseLocalName;
nsCOMPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mLowercaseLocalName;
RefPtr<nsIAtom> mPrefix;
};
class txText : public txInstruction

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

@ -105,7 +105,7 @@ txMozillaXMLOutput::attribute(nsIAtom* aPrefix,
const int32_t aNsID,
const nsString& aValue)
{
nsCOMPtr<nsIAtom> owner;
RefPtr<nsIAtom> owner;
if (mOpenedElementIsHTML && aNsID == kNameSpaceID_None) {
if (aLowercaseLocalName) {
aLocalName = aLowercaseLocalName;
@ -127,7 +127,7 @@ txMozillaXMLOutput::attribute(nsIAtom* aPrefix,
const int32_t aNsID,
const nsString& aValue)
{
nsCOMPtr<nsIAtom> lname;
RefPtr<nsIAtom> lname;
if (mOpenedElementIsHTML && aNsID == kNameSpaceID_None) {
nsAutoString lnameStr;
@ -436,7 +436,7 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix, nsIAtom* aLocalName,
"Can't have prefix without namespace");
if (mOutputFormat.mMethod == eHTMLOutput && aNsID == kNameSpaceID_None) {
nsCOMPtr<nsIAtom> owner;
RefPtr<nsIAtom> owner;
if (!aLowercaseLocalName) {
owner = TX_ToLowerCaseAtom(aLocalName);
NS_ENSURE_TRUE(owner, NS_ERROR_OUT_OF_MEMORY);
@ -457,7 +457,7 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix,
const int32_t aNsID)
{
int32_t nsId = aNsID;
nsCOMPtr<nsIAtom> lname;
RefPtr<nsIAtom> lname;
if (mOutputFormat.mMethod == eHTMLOutput && aNsID == kNameSpaceID_None) {
nsId = kNameSpaceID_XHTML;
@ -758,7 +758,7 @@ txMozillaXMLOutput::endHTMLElement(nsIContent* aElement)
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::content, value);
if (!value.IsEmpty()) {
nsContentUtils::ASCIIToLower(httpEquiv);
nsCOMPtr<nsIAtom> header = NS_Atomize(httpEquiv);
RefPtr<nsIAtom> header = NS_Atomize(httpEquiv);
processHTTPEquiv(header, value);
}
}
@ -893,7 +893,7 @@ txMozillaXMLOutput::createResultDocument(const nsAString& aName, int32_t aNsID,
nsresult rv = nsContentUtils::CheckQName(qName);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIAtom> doctypeName = NS_Atomize(qName);
RefPtr<nsIAtom> doctypeName = NS_Atomize(qName);
if (!doctypeName) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -397,7 +397,7 @@ NS_IMETHODIMP
txMozillaXSLTProcessor::AddXSLTParamNamespace(const nsString& aPrefix,
const nsString& aNamespace)
{
nsCOMPtr<nsIAtom> pre = NS_Atomize(aPrefix);
RefPtr<nsIAtom> pre = NS_Atomize(aPrefix);
return mParamNamespaceMap.mapNamespace(pre, aNamespace);
}
@ -521,7 +521,7 @@ txMozillaXSLTProcessor::AddXSLTParam(const nsString& aName,
value = new StringResult(aValue, nullptr);
}
nsCOMPtr<nsIAtom> name = NS_Atomize(aName);
RefPtr<nsIAtom> name = NS_Atomize(aName);
int32_t nsId = kNameSpaceID_Unknown;
rv = nsContentUtils::NameSpaceManager()->
RegisterNameSpace(aNamespace, nsId);
@ -944,7 +944,7 @@ txMozillaXSLTProcessor::SetParameter(const nsAString & aNamespaceURI,
nsresult rv = nsContentUtils::NameSpaceManager()->
RegisterNameSpace(aNamespaceURI, nsId);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAtom> localName = NS_Atomize(aLocalName);
RefPtr<nsIAtom> localName = NS_Atomize(aLocalName);
txExpandedName varName(nsId, localName);
txVariable* var = static_cast<txVariable*>(mVariables.get(varName));
@ -966,7 +966,7 @@ txMozillaXSLTProcessor::GetParameter(const nsAString& aNamespaceURI,
nsresult rv = nsContentUtils::NameSpaceManager()->
RegisterNameSpace(aNamespaceURI, nsId);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAtom> localName = NS_Atomize(aLocalName);
RefPtr<nsIAtom> localName = NS_Atomize(aLocalName);
txExpandedName varName(nsId, localName);
txVariable* var = static_cast<txVariable*>(mVariables.get(varName));
@ -984,7 +984,7 @@ txMozillaXSLTProcessor::RemoveParameter(const nsAString& aNamespaceURI,
nsresult rv = nsContentUtils::NameSpaceManager()->
RegisterNameSpace(aNamespaceURI, nsId);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAtom> localName = NS_Atomize(aLocalName);
RefPtr<nsIAtom> localName = NS_Atomize(aLocalName);
txExpandedName varName(nsId, localName);
mVariables.remove(varName);

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

@ -129,7 +129,7 @@ nsresult txPatternParser::createLocPathPattern(txExprLexer& aLexer,
case Token::FUNCTION_NAME_AND_PAREN:
// id(Literal) or key(Literal, Literal)
{
nsCOMPtr<nsIAtom> nameAtom =
RefPtr<nsIAtom> nameAtom =
NS_Atomize(aLexer.nextToken()->Value());
if (nameAtom == nsGkAtoms::id) {
rv = createIdPattern(aLexer, stepPattern);
@ -239,7 +239,7 @@ nsresult txPatternParser::createKeyPattern(txExprLexer& aLexer,
const char16_t* colon;
if (!XMLUtils::isValidQName(PromiseFlatString(key), &colon))
return NS_ERROR_XPATH_PARSE_FAILURE;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
int32_t namespaceID;
nsresult rv = resolveQName(key, getter_AddRefs(prefix), aContext,
getter_AddRefs(localName), namespaceID);
@ -278,7 +278,7 @@ nsresult txPatternParser::createStepPattern(txExprLexer& aLexer,
tok = aLexer.nextToken();
// resolve QName
nsCOMPtr<nsIAtom> prefix, lName;
RefPtr<nsIAtom> prefix, lName;
int32_t nspace;
rv = resolveQName(tok->Value(), getter_AddRefs(prefix), aContext,
getter_AddRefs(lName), nspace, true);

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

@ -317,7 +317,7 @@ getYesNoAttr(txStylesheetAttr* aAttributes,
txThreeState& aRes)
{
aRes = eNotSet;
nsCOMPtr<nsIAtom> atom;
RefPtr<nsIAtom> atom;
nsresult rv = getAtomAttr(aAttributes, aAttrCount, aName, aRequired,
aState, getter_AddRefs(atom));
if (!atom) {
@ -1014,7 +1014,7 @@ txFnStartStripSpace(int32_t aNamespaceID,
while (tokenizer.hasMoreTokens()) {
const nsAString& name = tokenizer.nextToken();
int32_t ns = kNameSpaceID_None;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
rv = XMLUtils::splitQName(name, getter_AddRefs(prefix),
getter_AddRefs(localName));
if (NS_FAILED(rv)) {
@ -1960,7 +1960,7 @@ txFnStartNumber(int32_t aNamespaceID,
{
nsresult rv = NS_OK;
nsCOMPtr<nsIAtom> levelAtom;
RefPtr<nsIAtom> levelAtom;
rv = getAtomAttr(aAttributes, aAttrCount, nsGkAtoms::level, false,
aState, getter_AddRefs(levelAtom));
NS_ENSURE_SUCCESS(rv, rv);
@ -2854,7 +2854,7 @@ txHandlerTable::init(const txElementHandler* aHandlers, uint32_t aCount)
uint32_t i;
for (i = 0; i < aCount; ++i) {
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(aHandlers->mLocalName);
RefPtr<nsIAtom> nameAtom = NS_Atomize(aHandlers->mLocalName);
txExpandedName name(aHandlers->mNamespaceID, nameAtom);
rv = mHandlers.add(name, aHandlers);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -132,7 +132,7 @@ txStylesheetCompiler::startElement(const char16_t *aName,
NS_ENSURE_SUCCESS(rv, rv);
atts[i].mValue.Append(aAttrs[i * 2 + 1]);
nsCOMPtr<nsIAtom> prefixToBind;
RefPtr<nsIAtom> prefixToBind;
if (atts[i].mPrefix == nsGkAtoms::xmlns) {
prefixToBind = atts[i].mLocalName;
}
@ -156,7 +156,7 @@ txStylesheetCompiler::startElement(const char16_t *aName,
}
}
nsCOMPtr<nsIAtom> prefix, localname;
RefPtr<nsIAtom> prefix, localname;
int32_t namespaceID;
rv = XMLUtils::splitExpatName(aName, getter_AddRefs(prefix),
getter_AddRefs(localname), &namespaceID);
@ -862,7 +862,7 @@ public:
TX_DECL_FUNCTION
private:
nsCOMPtr<nsIAtom> mName;
RefPtr<nsIAtom> mName;
};
nsresult

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

@ -194,8 +194,8 @@ private:
struct txStylesheetAttr
{
int32_t mNamespaceID;
nsCOMPtr<nsIAtom> mLocalName;
nsCOMPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mLocalName;
RefPtr<nsIAtom> mPrefix;
nsString mValue;
};

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

@ -122,7 +122,7 @@ txUnknownHandler::startElement(nsIAtom* aPrefix, nsIAtom* aLocalName,
NS_ASSERTION(mEs->mResultHandler == this,
"We're leaking mEs->mResultHandler.");
nsCOMPtr<nsIAtom> owner;
RefPtr<nsIAtom> owner;
if (!aLowercaseLocalName) {
owner = TX_ToLowerCaseAtom(aLocalName);
NS_ENSURE_TRUE(owner, NS_ERROR_OUT_OF_MEMORY);

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

@ -119,7 +119,7 @@ txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
switch (nodeType) {
case txXPathNodeType::ELEMENT_NODE:
{
nsCOMPtr<nsIAtom> localName =
RefPtr<nsIAtom> localName =
txXPathNodeUtils::getLocalName(currNode);
int32_t namespaceID = txXPathNodeUtils::getNamespaceID(currNode);
nodeTest = new txNameTest(0, localName, namespaceID,

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

@ -305,8 +305,8 @@ txIdPattern::txIdPattern(const nsAString& aString)
nsWhitespaceTokenizer tokenizer(aString);
while (tokenizer.hasMoreTokens()) {
// this can fail, XXX move to a Init(aString) method
nsCOMPtr<nsIAtom> atom = NS_Atomize(tokenizer.nextToken());
mIds.AppendObject(atom);
RefPtr<nsIAtom> atom = NS_Atomize(tokenizer.nextToken());
mIds.AppendElement(atom);
}
}
@ -325,7 +325,7 @@ txIdPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext,
NS_ASSERTION(content, "a Element without nsIContent");
nsIAtom* id = content->GetID();
aMatched = id && mIds.IndexOf(id) > -1;
aMatched = id && mIds.IndexOf(id) != mIds.NoIndex;
return NS_OK;
}
@ -346,7 +346,7 @@ txIdPattern::toString(nsAString& aDest)
aDest.AppendLiteral("txIdPattern{");
#endif
aDest.AppendLiteral("id('");
uint32_t k, count = mIds.Count() - 1;
uint32_t k, count = mIds.Length() - 1;
for (k = 0; k < count; ++k) {
nsAutoString str;
mIds[k]->ToString(str);

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

@ -193,7 +193,7 @@ public:
TX_DECL_PATTERN;
private:
nsCOMArray<nsIAtom> mIds;
nsTArray<RefPtr<nsIAtom>> mIds;
};
class txKeyPattern : public txPattern
@ -214,7 +214,7 @@ public:
private:
txExpandedName mName;
#ifdef TX_TO_STRING
nsCOMPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mPrefix;
#endif
nsString mValue;
};

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

@ -142,7 +142,7 @@ LazyLogModule XULDocument::gXULLog("XULDocument");
struct BroadcastListener {
nsWeakPtr mListener;
nsCOMPtr<nsIAtom> mAttribute;
RefPtr<nsIAtom> mAttribute;
};
struct BroadcasterMapEntry : public PLDHashEntryHdr
@ -654,8 +654,8 @@ struct nsAttrNameInfo
mNamespaceID(aOther.mNamespaceID), mName(aOther.mName),
mPrefix(aOther.mPrefix) {}
int32_t mNamespaceID;
nsCOMPtr<nsIAtom> mName;
nsCOMPtr<nsIAtom> mPrefix;
RefPtr<nsIAtom> mName;
RefPtr<nsIAtom> mPrefix;
};
void
@ -710,7 +710,7 @@ XULDocument::SynchronizeBroadcastListener(Element *aBroadcaster,
}
else {
// Find out if the attribute is even present at all.
nsCOMPtr<nsIAtom> name = NS_Atomize(aAttr);
RefPtr<nsIAtom> name = NS_Atomize(aAttr);
nsAutoString value;
if (aBroadcaster->GetAttr(kNameSpaceID_None, name, value)) {
@ -791,7 +791,7 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
}
// Only add the listener if it's not there already!
nsCOMPtr<nsIAtom> attr = NS_Atomize(aAttr);
RefPtr<nsIAtom> attr = NS_Atomize(aAttr);
for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
BroadcastListener* bl = entry->mListeners[i];
@ -835,7 +835,7 @@ XULDocument::RemoveBroadcastListenerFor(Element& aBroadcaster,
auto entry = static_cast<BroadcasterMapEntry*>
(mBroadcasterMap->Search(&aBroadcaster));
if (entry) {
nsCOMPtr<nsIAtom> attr = NS_Atomize(aAttr);
RefPtr<nsIAtom> attr = NS_Atomize(aAttr);
for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
BroadcastListener* bl = entry->mListeners[i];
nsCOMPtr<Element> blListener = do_QueryReferent(bl->mListener);
@ -1209,7 +1209,7 @@ already_AddRefed<nsINodeList>
XULDocument::GetElementsByAttribute(const nsAString& aAttribute,
const nsAString& aValue)
{
nsCOMPtr<nsIAtom> attrAtom(NS_Atomize(aAttribute));
RefPtr<nsIAtom> attrAtom(NS_Atomize(aAttribute));
void* attrValue = new nsString(aValue);
RefPtr<nsContentList> list = new nsContentList(this,
MatchAttribute,
@ -1240,7 +1240,7 @@ XULDocument::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aValue,
ErrorResult& aRv)
{
nsCOMPtr<nsIAtom> attrAtom(NS_Atomize(aAttribute));
RefPtr<nsIAtom> attrAtom(NS_Atomize(aAttribute));
void* attrValue = new nsString(aValue);
int32_t nameSpaceId = kNameSpaceID_Wildcard;
@ -1277,7 +1277,7 @@ XULDocument::Persist(const nsAString& aID,
if (!element)
return NS_OK;
nsCOMPtr<nsIAtom> tag;
RefPtr<nsIAtom> tag;
int32_t nameSpaceID;
RefPtr<mozilla::dom::NodeInfo> ni = element->GetExistingAttrNameFromQName(aAttr);
@ -2142,7 +2142,7 @@ XULDocument::ApplyPersistentAttributesToElements(const nsAString &aID,
return rv;
}
nsCOMPtr<nsIAtom> attr = NS_Atomize(attrstr);
RefPtr<nsIAtom> attr = NS_Atomize(attrstr);
if (NS_WARN_IF(!attr)) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -763,7 +763,7 @@ protected:
// Note if mAttrName isn't used, this is the name of the attr, otherwise
// this is the value of the attribute.
nsString mAttr;
nsCOMPtr<nsIAtom> mAttrName;
RefPtr<nsIAtom> mAttrName;
bool mSetAttr;
bool mNeedsAttrChange;

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

@ -396,7 +396,7 @@ XULContentSinkImpl::NormalizeAttributeString(const char16_t *aExpatName,
nsAttrName &aName)
{
int32_t nameSpaceID;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
nsContentUtils::SplitExpatName(aExpatName, getter_AddRefs(prefix),
getter_AddRefs(localName), &nameSpaceID);
@ -450,7 +450,7 @@ XULContentSinkImpl::HandleStartElement(const char16_t *aName,
}
int32_t nameSpaceID;
nsCOMPtr<nsIAtom> prefix, localName;
RefPtr<nsIAtom> prefix, localName;
nsContentUtils::SplitExpatName(aName, getter_AddRefs(prefix),
getter_AddRefs(localName), &nameSpaceID);

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

@ -384,7 +384,7 @@ already_AddRefed<nsINodeList>
nsXULElement::GetElementsByAttribute(const nsAString& aAttribute,
const nsAString& aValue)
{
nsCOMPtr<nsIAtom> attrAtom(NS_Atomize(aAttribute));
RefPtr<nsIAtom> attrAtom(NS_Atomize(aAttribute));
void* attrValue = new nsString(aValue);
RefPtr<nsContentList> list =
new nsContentList(this,
@ -403,7 +403,7 @@ nsXULElement::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aValue,
ErrorResult& rv)
{
nsCOMPtr<nsIAtom> attrAtom(NS_Atomize(aAttribute));
RefPtr<nsIAtom> attrAtom(NS_Atomize(aAttribute));
int32_t nameSpaceId = kNameSpaceID_Wildcard;
if (!aNamespaceURI.EqualsLiteral("*")) {

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

@ -156,7 +156,7 @@ nsXULPrototypeDocument::Read(nsIObjectInputStream* aStream)
}
nsAutoString namespaceURI, prefixStr, localName;
bool prefixIsNull;
nsCOMPtr<nsIAtom> prefix;
RefPtr<nsIAtom> prefix;
for (i = 0; i < count; ++i) {
tmp = aStream->ReadString(namespaceURI);
if (NS_FAILED(tmp)) {

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

@ -40,8 +40,8 @@ public:
protected:
nsXULTemplateQueryProcessorRDF *mProcessor;
nsIDOMDocument* mDocument;
nsCOMPtr<nsIAtom> mRefVariable;
nsCOMPtr<nsIAtom> mTag;
RefPtr<nsIAtom> mRefVariable;
RefPtr<nsIAtom> mTag;
};
#endif // nsContentTestNode_h__

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

@ -24,9 +24,9 @@ class RDFBinding {
public:
nsCOMPtr<nsIAtom> mSubjectVariable;
RefPtr<nsIAtom> mSubjectVariable;
nsCOMPtr<nsIRDFResource> mPredicate;
nsCOMPtr<nsIAtom> mTargetVariable;
RefPtr<nsIAtom> mTargetVariable;
// indicates whether a binding is dependant on the result from a
// previous binding

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

@ -79,7 +79,7 @@ public:
protected:
nsXULTemplateQueryProcessorRDF* mProcessor;
nsCOMPtr<nsIAtom> mContainerVariable;
RefPtr<nsIAtom> mContainerVariable;
Test mContainer;
Test mEmpty;
};

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

@ -70,8 +70,8 @@ public:
protected:
nsXULTemplateQueryProcessorRDF* mProcessor;
nsCOMPtr<nsIAtom> mContainerVariable;
nsCOMPtr<nsIAtom> mMemberVariable;
RefPtr<nsIAtom> mContainerVariable;
RefPtr<nsIAtom> mMemberVariable;
};
#endif // nsRDFConMemberTestNode_h__

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

@ -94,10 +94,10 @@ public:
protected:
nsXULTemplateQueryProcessorRDF* mProcessor;
nsCOMPtr<nsIAtom> mSourceVariable;
RefPtr<nsIAtom> mSourceVariable;
nsCOMPtr<nsIRDFResource> mSource;
nsCOMPtr<nsIRDFResource> mProperty;
nsCOMPtr<nsIAtom> mTargetVariable;
RefPtr<nsIAtom> mTargetVariable;
nsCOMPtr<nsIRDFNode> mTarget;
};

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше