From b258dfaa89983714430ae4c82b58b116fc440d85 Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Wed, 24 Aug 2016 14:09:12 -0400 Subject: [PATCH] Bug 1297802 - Remove unused RefPtr<> and COMPtr<> types in dom/, r=baku MozReview-Commit-ID: CLUJZdbN7sW --- dom/base/nsDocument.cpp | 7 - dom/base/nsDocumentEncoder.cpp | 174 +++++++++--------- dom/base/nsGlobalWindow.cpp | 1 - dom/base/nsHostObjectProtocolHandler.cpp | 1 - dom/base/nsLocation.cpp | 1 - dom/base/nsScriptLoader.cpp | 1 - dom/devicestorage/nsDeviceStorage.cpp | 2 - dom/html/HTMLSelectElement.cpp | 1 - dom/html/nsGenericHTMLElement.cpp | 3 - dom/ipc/ContentParent.cpp | 1 - dom/media/MediaDecoderReader.cpp | 2 - .../base/nsPluginStreamListenerPeer.cpp | 1 - dom/plugins/ipc/PluginInstanceChild.cpp | 3 +- dom/quota/ActorsParent.cpp | 2 - dom/storage/DOMStorageDBThread.cpp | 1 - dom/xml/nsXMLFragmentContentSink.cpp | 2 - .../nsXULTemplateQueryProcessorStorage.cpp | 1 - 17 files changed, 87 insertions(+), 117 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 9b36a7cacdc9..db12218f0554 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -4842,8 +4842,6 @@ nsDocument::SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject) NS_ASSERTION(!mScriptGlobalObject || mScriptGlobalObject == aScriptObject, "Wrong script object!"); - // XXXkhuey why bother? - nsCOMPtr win = do_QueryInterface(aScriptObject); if (aScriptObject) { mScopeObject = do_GetWeakReference(aScriptObject); mHasHadScriptHandlingObject = true; @@ -7708,8 +7706,6 @@ nsDOMAttributeMap::BlastSubtreeToPieces(nsINode *aNode) Element *element = aNode->AsElement(); const nsDOMAttributeMap *map = element->GetAttributeMap(); if (map) { - nsCOMPtr attr; - // This non-standard style of iteration is presumably used because some // of the code in the loop body can trigger element removal, which // invalidates the iterator. @@ -8762,7 +8758,6 @@ nsDocument::Sanitize() RefPtr nodes = GetElementsByTagName(NS_LITERAL_STRING("input")); - nsCOMPtr item; nsAutoString value; uint32_t length = nodes->Length(true); @@ -10437,7 +10432,6 @@ nsDocument::GetStateObject(nsIVariant** aState) // mStateObjectContainer may be null; this just means that there's no // current state object. - nsCOMPtr stateObj; if (!mStateObjectCached && mStateObjectContainer) { AutoJSContext cx; nsIGlobalObject* sgo = GetScopeObject(); @@ -10878,7 +10872,6 @@ nsIDocument::CaretPositionFromPoint(float aX, float aY) if (nodeIsAnonymous) { node = ptFrame->GetContent(); nsIContent* nonanon = node->FindFirstNonChromeOnlyAccessContent(); - nsCOMPtr input = do_QueryInterface(nonanon); nsCOMPtr textArea = do_QueryInterface(nonanon); nsITextControlFrame* textFrame = do_QueryFrame(nonanon->GetPrimaryFrame()); nsNumberControlFrame* numberFrame = do_QueryFrame(nonanon->GetPrimaryFrame()); diff --git a/dom/base/nsDocumentEncoder.cpp b/dom/base/nsDocumentEncoder.cpp index b278bf1df832..5e400e1102b1 100644 --- a/dom/base/nsDocumentEncoder.cpp +++ b/dom/base/nsDocumentEncoder.cpp @@ -8,7 +8,7 @@ * Object that can be used to serialize selections, ranges, or nodes * to strings in a gazillion different ways. */ - + #include "nsIDocumentEncoder.h" #include "nscore.h" @@ -89,8 +89,8 @@ protected: nsAString& aStr); nsresult SerializeRangeToString(nsRange *aRange, nsAString& aOutputString); - nsresult SerializeRangeNodes(nsRange* aRange, - nsINode* aNode, + nsresult SerializeRangeNodes(nsRange* aRange, + nsINode* aNode, nsAString& aString, int32_t aDepth); nsresult SerializeRangeContextStart(const nsTArray& aAncestorArray, @@ -167,7 +167,7 @@ protected: AutoTArray mStartOffsets; AutoTArray mEndNodes; AutoTArray mEndOffsets; - bool mHaltRangeHint; + bool mHaltRangeHint; // Used when context has already been serialized for // table cell selections (where parent is ) bool mDisableContextSerialize; @@ -412,14 +412,14 @@ nsDocumentEncoder::SerializeNodeStart(nsINode* aNode, { if (!IsVisibleNode(aNode)) return NS_OK; - + nsINode* node = nullptr; nsCOMPtr fixedNodeKungfuDeathGrip; // Caller didn't do fixup, so we'll do it ourselves if (!aOriginalNode) { aOriginalNode = aNode; - if (mNodeFixup) { + if (mNodeFixup) { bool dummy; nsCOMPtr domNodeIn = do_QueryInterface(aNode); nsCOMPtr domNodeOut; @@ -433,7 +433,7 @@ nsDocumentEncoder::SerializeNodeStart(nsINode* aNode, // or the caller did fixup themselves and aNode is already fixed if (!node) node = aNode; - + if (node->IsElement()) { if ((mFlags & (nsIDocumentEncoder::OutputPreformatted | nsIDocumentEncoder::OutputDropInvisibleBreak)) && @@ -655,7 +655,7 @@ ConvertAndWrite(const nsAString& aString, // If the converter couldn't convert a chraacer we replace the // character with a characre entity. if (convert_rv == NS_ERROR_UENC_NOMAPPING) { - // Finishes the conversion. + // Finishes the conversion. // The converter has the possibility to write some extra data and flush its final state. char finish_buf[33]; charLength = sizeof(finish_buf) - 1; @@ -671,7 +671,7 @@ ConvertAndWrite(const nsAString& aString, NS_ENSURE_SUCCESS(rv, rv); nsAutoCString entString("&#"); - if (NS_IS_HIGH_SURROGATE(unicodeBuf[unicodeLength - 1]) && + if (NS_IS_HIGH_SURROGATE(unicodeBuf[unicodeLength - 1]) && unicodeLength < startLength && NS_IS_LOW_SURROGATE(unicodeBuf[unicodeLength])) { entString.AppendInt(SURROGATE_TO_UCS4(unicodeBuf[unicodeLength - 1], unicodeBuf[unicodeLength])); @@ -859,7 +859,7 @@ nsDocumentEncoder::SerializeRangeNodes(nsRange* aRange, } else { - // due to implementation it is impossible for text node to be both start and end of + // due to implementation it is impossible for text node to be both start and end of // range. We would have handled that case without getting here. //XXXsmaug What does this all mean? if (IsTextNode(aNode)) @@ -889,12 +889,12 @@ nsDocumentEncoder::SerializeRangeNodes(nsRange* aRange, } if ((startNode == content) && !mHaltRangeHint) mStartDepth++; if ((endNode == content) && !mHaltRangeHint) mEndDepth++; - + // serialize the start of this node rv = SerializeNodeStart(aNode, 0, -1, aString); NS_ENSURE_SUCCESS(rv, rv); } - + // do some calculations that will tell us which children of this // node are in the range. nsIContent* childAsNode = nullptr; @@ -903,7 +903,7 @@ nsDocumentEncoder::SerializeRangeNodes(nsRange* aRange, startOffset = mStartOffsets[mStartRootIndex - aDepth]; if (endNode == content && mEndRootIndex >= aDepth) endOffset = mEndOffsets[mEndRootIndex - aDepth]; - // generated content will cause offset values of -1 to be returned. + // generated content will cause offset values of -1 to be returned. int32_t j; uint32_t childCount = content->GetChildCount(); @@ -914,7 +914,7 @@ nsDocumentEncoder::SerializeRangeNodes(nsRange* aRange, // if we are at the "tip" of the selection, endOffset is fine. // otherwise, we need to add one. This is because of the semantics // of the offset list created by GetAncestorsAndOffsets(). The - // intermediate points on the list use the endOffset of the + // intermediate points on the list use the endOffset of the // location of the ancestor, rather than just past it. So we need // to add one here in order to include it in the children we serialize. if (aNode != aRange->GetEndParent()) @@ -939,7 +939,7 @@ nsDocumentEncoder::SerializeRangeNodes(nsRange* aRange, if (aNode != mCommonParent) { rv = SerializeNodeEnd(aNode, aString); - NS_ENSURE_SUCCESS(rv, rv); + NS_ENSURE_SUCCESS(rv, rv); } } } @@ -1020,7 +1020,7 @@ nsDocumentEncoder::SerializeRangeToString(nsRange *aRange, if (!mCommonParent) return NS_OK; - + nsINode* startParent = aRange->GetStartParent(); NS_ENSURE_TRUE(startParent, NS_ERROR_FAILURE); int32_t startOffset = aRange->StartOffset(); @@ -1047,7 +1047,7 @@ nsDocumentEncoder::SerializeRangeToString(nsRange *aRange, nsCOMPtr commonContent = do_QueryInterface(mCommonParent); mStartRootIndex = mStartNodes.IndexOf(commonContent); mEndRootIndex = mEndNodes.IndexOf(commonContent); - + nsresult rv = NS_OK; rv = SerializeRangeContextStart(mCommonAncestors, aOutputString); @@ -1108,7 +1108,7 @@ nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength, mCachedBuffer->ToString(0, output, true); // output owns the buffer now! mCachedBuffer = nullptr; - + if (!mSerializer) { nsAutoCString progId(NS_CONTENTSERIALIZER_CONTRACTID_PREFIX); @@ -1120,8 +1120,6 @@ nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength, nsresult rv = NS_OK; - nsCOMPtr charsetAtom; - bool rewriteEncodingDeclaration = !(mSelection || mRange || mNode) && !(mFlags & OutputDontRewriteEncodingDeclaration); mSerializer->Init(mFlags, mWrapColumn, mCharset.get(), mIsCopying, rewriteEncodingDeclaration); @@ -1195,13 +1193,13 @@ nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength, NS_ENSURE_SUCCESS(rv, rv); mCommonAncestors.Clear(); nsContentUtils::GetAncestors(p->GetParentNode(), mCommonAncestors); - mDisableContextSerialize = false; + mDisableContextSerialize = false; rv = SerializeRangeContextEnd(mCommonAncestors, output); NS_ENSURE_SUCCESS(rv, rv); } // Just to be safe - mDisableContextSerialize = false; + mDisableContextSerialize = false; mSelection = nullptr; } else if (mRange) { @@ -1226,7 +1224,7 @@ nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength, NS_ENSURE_SUCCESS(rv, rv); rv = mSerializer->Flush(output); - + mCachedBuffer = nsStringBuffer::FromString(output); // We have to be careful how we set aOutputString, because we don't // want it to end up sharing mCachedBuffer if we plan to reuse it. @@ -1335,12 +1333,12 @@ protected: kStart, kEnd }; - + nsresult PromoteRange(nsIDOMRange *inRange); - nsresult PromoteAncestorChain(nsCOMPtr *ioNode, - int32_t *ioStartOffset, + nsresult PromoteAncestorChain(nsCOMPtr *ioNode, + int32_t *ioStartOffset, int32_t *ioEndOffset); - nsresult GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t aOffset, + nsresult GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t aOffset, nsCOMPtr *outNode, int32_t *outOffset, nsIDOMNode *aCommon); nsCOMPtr GetChildAt(nsIDOMNode *aParent, int32_t aOffset); bool IsMozBR(nsIDOMNode* aNode); @@ -1406,10 +1404,10 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection) // check for text widgets: we need to recognize these so that // we don't tweak the selection to be outside of the magic // div that ender-lite text widgets are embedded in. - - if (!aSelection) + + if (!aSelection) return NS_ERROR_NULL_POINTER; - + nsCOMPtr range; nsCOMPtr commonParent; Selection* selection = aSelection->AsSelection(); @@ -1418,7 +1416,7 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection) // if selection is uninitialized return if (!rangeCount) return NS_ERROR_FAILURE; - + // we'll just use the common parent of the first range. Implicit assumption // here that multi-range selections are table cell selections, in which case // the common parent is somewhere in the table and we don't really care where. @@ -1481,7 +1479,7 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection) } // normalize selection if we are not in a widget - if (mIsTextWidget) + if (mIsTextWidget) { mSelection = aSelection; mMimeType.AssignLiteral("text/plain"); @@ -1496,13 +1494,13 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection) // mMimeType is set to text/plain when encoding starts. return NS_OK; } - + // there's no Clone() for selection! fix... //nsresult rv = aSelection->Clone(getter_AddRefs(mSelection); //NS_ENSURE_SUCCESS(rv, rv); NS_NewDomSelection(getter_AddRefs(mSelection)); NS_ENSURE_TRUE(mSelection, NS_ERROR_FAILURE); - + // loop thru the ranges in the selection for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) { range = selection->GetRangeAt(rangeIdx); @@ -1514,7 +1512,7 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection) // adjust range to include any ancestors who's children are entirely selected rv = PromoteRange(myRange); NS_ENSURE_SUCCESS(rv, rv); - + rv = mSelection->AddRange(myRange); NS_ENSURE_SUCCESS(rv, rv); } @@ -1544,7 +1542,7 @@ nsHTMLCopyEncoder::EncodeToStringWithContext(nsAString& aContextString, // now encode common ancestors into aContextString. Note that the common ancestors // will be for the last range in the selection in the case of multirange selections. - // encoding ancestors every range in a multirange selection in a way that could be + // encoding ancestors every range in a multirange selection in a way that could be // understood by the paste code would be a lot more work to do. As a practical matter, // selections are single range, and the ones that aren't are table cell selections // where all the cells are in the same table. @@ -1556,7 +1554,7 @@ nsHTMLCopyEncoder::EncodeToStringWithContext(nsAString& aContextString, if (count > 0) node = mCommonAncestors.ElementAt(0); - if (node && IsTextNode(node)) + if (node && IsTextNode(node)) { mCommonAncestors.RemoveElementAt(0); // don't forget to adjust range depth info @@ -1565,7 +1563,7 @@ nsHTMLCopyEncoder::EncodeToStringWithContext(nsAString& aContextString, // and the count count--; } - + i = count; while (i > 0) { @@ -1579,7 +1577,7 @@ nsHTMLCopyEncoder::EncodeToStringWithContext(nsAString& aContextString, SerializeNodeEnd(node, aContextString); } - // encode range info : the start and end depth of the selection, where the depth is + // encode range info : the start and end depth of the selection, where the depth is // distance down in the parent hierarchy. Later we will need to add leading/trailing // whitespace info to this. nsAutoString infoString; @@ -1587,7 +1585,7 @@ nsHTMLCopyEncoder::EncodeToStringWithContext(nsAString& aContextString, infoString.Append(char16_t(',')); infoString.AppendInt(mEndDepth); aInfoString = infoString; - + return NS_OK; } @@ -1629,14 +1627,14 @@ nsHTMLCopyEncoder::IncludeInContext(nsINode *aNode) } -nsresult +nsresult nsHTMLCopyEncoder::PromoteRange(nsIDOMRange *inRange) { if (!inRange) return NS_ERROR_NULL_POINTER; nsresult rv; nsCOMPtr startNode, endNode, common; int32_t startOffset, endOffset; - + rv = inRange->GetCommonAncestorContainer(getter_AddRefs(common)); NS_ENSURE_SUCCESS(rv, rv); rv = inRange->GetStartContainer(getter_AddRefs(startNode)); @@ -1647,18 +1645,17 @@ nsHTMLCopyEncoder::PromoteRange(nsIDOMRange *inRange) NS_ENSURE_SUCCESS(rv, rv); rv = inRange->GetEndOffset(&endOffset); NS_ENSURE_SUCCESS(rv, rv); - + nsCOMPtr opStartNode; nsCOMPtr opEndNode; int32_t opStartOffset, opEndOffset; - nsCOMPtr opRange; - - // examine range endpoints. + + // examine range endpoints. rv = GetPromotedPoint( kStart, startNode, startOffset, address_of(opStartNode), &opStartOffset, common); NS_ENSURE_SUCCESS(rv, rv); rv = GetPromotedPoint( kEnd, endNode, endOffset, address_of(opEndNode), &opEndOffset, common); NS_ENSURE_SUCCESS(rv, rv); - + // if both range endpoints are at the common ancestor, check for possible inclusion of ancestors if ( (opStartNode == common) && (opEndNode == common) ) { @@ -1666,22 +1663,22 @@ nsHTMLCopyEncoder::PromoteRange(nsIDOMRange *inRange) NS_ENSURE_SUCCESS(rv, rv); opEndNode = opStartNode; } - + // set the range to the new values rv = inRange->SetStart(opStartNode, opStartOffset); NS_ENSURE_SUCCESS(rv, rv); rv = inRange->SetEnd(opEndNode, opEndOffset); return rv; -} +} // PromoteAncestorChain will promote a range represented by [{*ioNode,*ioStartOffset} , {*ioNode,*ioEndOffset}] // The promotion is different from that found in getPromotedPoint: it will only promote one endpoint if it can // promote the other. Thus, instead of having a startnode/endNode, there is just the one ioNode. nsresult -nsHTMLCopyEncoder::PromoteAncestorChain(nsCOMPtr *ioNode, - int32_t *ioStartOffset, - int32_t *ioEndOffset) +nsHTMLCopyEncoder::PromoteAncestorChain(nsCOMPtr *ioNode, + int32_t *ioStartOffset, + int32_t *ioEndOffset) { if (!ioNode || !ioStartOffset || !ioEndOffset) return NS_ERROR_NULL_POINTER; @@ -1694,7 +1691,7 @@ nsHTMLCopyEncoder::PromoteAncestorChain(nsCOMPtr *ioNode, //save the editable state of the ioNode, so we don't promote an ancestor if it has different editable state nsCOMPtr node = do_QueryInterface(*ioNode); bool isEditable = node->IsEditable(); - + // loop for as long as we can promote both endpoints while (!done) { @@ -1712,13 +1709,13 @@ nsHTMLCopyEncoder::PromoteAncestorChain(nsCOMPtr *ioNode, NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr frontINode = do_QueryInterface(frontNode); - // if both endpoints were promoted one level and isEditable is the same as the original node, + // if both endpoints were promoted one level and isEditable is the same as the original node, // keep looping - otherwise we are done. if ( (frontNode != parent) || (endNode != parent) || (frontINode->IsEditable() != isEditable) ) done = true; else { - *ioNode = frontNode; + *ioNode = frontNode; *ioStartOffset = frontOffset; *ioEndOffset = endOffset; } @@ -1728,7 +1725,7 @@ nsHTMLCopyEncoder::PromoteAncestorChain(nsCOMPtr *ioNode, } nsresult -nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t aOffset, +nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t aOffset, nsCOMPtr *outNode, int32_t *outOffset, nsIDOMNode *common) { nsresult rv = NS_OK; @@ -1736,14 +1733,14 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t nsCOMPtr parent = aNode; int32_t offset = aOffset; bool bResetPromotion = false; - + // default values *outNode = node; *outOffset = offset; - if (common == node) + if (common == node) return NS_OK; - + if (aWhere == kStart) { // some special casing for text nodes @@ -1751,7 +1748,7 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t if (IsTextNode(t)) { // if not at beginning of text node, we are done - if (offset > 0) + if (offset > 0) { // unless everything before us in just whitespace. NOTE: we need a more // general solution that truly detects all cases of non-significant @@ -1774,7 +1771,7 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t } if (!node) node = parent; - // finding the real start for this point. look up the tree for as long as we are the + // finding the real start for this point. look up the tree for as long as we are the // first node in the container, and as long as we haven't hit the body node. if (!IsRoot(node) && (parent != common)) { @@ -1798,9 +1795,9 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t { bResetPromotion = false; } - } + } } - + node = parent; rv = GetNodeLocation(node, address_of(parent), &offset); NS_ENSURE_SUCCESS(rv, rv); @@ -1811,7 +1808,7 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t offset = 0; break; } - } + } if (bResetPromotion) { *outNode = aNode; @@ -1825,7 +1822,7 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t return rv; } } - + if (aWhere == kEnd) { // some special casing for text nodes @@ -1856,8 +1853,8 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t node = GetChildAt(parent,offset); } if (!node) node = parent; - - // finding the real end for this point. look up the tree for as long as we are the + + // finding the real end for this point. look up the tree for as long as we are the // last node in the container, and as long as we haven't hit the body node. if (!IsRoot(node) && (parent != common)) { @@ -1881,9 +1878,9 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t { bResetPromotion = false; } - } + } } - + node = parent; rv = GetNodeLocation(node, address_of(parent), &offset); NS_ENSURE_SUCCESS(rv, rv); @@ -1894,7 +1891,7 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t offset = 0; break; } - } + } if (bResetPromotion) { *outNode = aNode; @@ -1909,18 +1906,18 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t return rv; } } - + return rv; } -nsCOMPtr +nsCOMPtr nsHTMLCopyEncoder::GetChildAt(nsIDOMNode *aParent, int32_t aOffset) { nsCOMPtr resultNode; - - if (!aParent) + + if (!aParent) return resultNode; - + nsCOMPtr content = do_QueryInterface(aParent); NS_PRECONDITION(content, "null content in nsHTMLCopyEncoder::GetChildAt"); @@ -1929,7 +1926,7 @@ nsHTMLCopyEncoder::GetChildAt(nsIDOMNode *aParent, int32_t aOffset) return resultNode; } -bool +bool nsHTMLCopyEncoder::IsMozBR(nsIDOMNode* aNode) { MOZ_ASSERT(aNode); @@ -1940,7 +1937,7 @@ nsHTMLCopyEncoder::IsMozBR(nsIDOMNode* aNode) NS_LITERAL_STRING("_moz"), eIgnoreCase); } -nsresult +nsresult nsHTMLCopyEncoder::GetNodeLocation(nsIDOMNode *inChild, nsCOMPtr *outParent, int32_t *outOffset) @@ -1986,26 +1983,26 @@ nsHTMLCopyEncoder::IsFirstNode(nsIDOMNode *aNode) nsCOMPtr parent; int32_t offset, j=0; nsresult rv = GetNodeLocation(aNode, address_of(parent), &offset); - if (NS_FAILED(rv)) + if (NS_FAILED(rv)) { NS_NOTREACHED("failure in IsFirstNode"); return false; } if (offset == 0) // easy case, we are first dom child return true; - if (!parent) + if (!parent) return true; - + // need to check if any nodes before us are really visible. // Mike wrote something for me along these lines in nsSelectionController, // but I don't think it's ready for use yet - revisit. - // HACK: for now, simply consider all whitespace text nodes to be + // HACK: for now, simply consider all whitespace text nodes to be // invisible formatting nodes. nsCOMPtr childList; nsCOMPtr child; rv = parent->GetChildNodes(getter_AddRefs(childList)); - if (NS_FAILED(rv) || !childList) + if (NS_FAILED(rv) || !childList) { NS_NOTREACHED("failure in IsFirstNode"); return true; @@ -2013,7 +2010,7 @@ nsHTMLCopyEncoder::IsFirstNode(nsIDOMNode *aNode) while (j < offset) { childList->Item(j, getter_AddRefs(child)); - if (!IsEmptyTextContent(child)) + if (!IsEmptyTextContent(child)) return false; j++; } @@ -2027,7 +2024,7 @@ nsHTMLCopyEncoder::IsLastNode(nsIDOMNode *aNode) nsCOMPtr parent; int32_t offset,j; nsresult rv = GetNodeLocation(aNode, address_of(parent), &offset); - if (NS_FAILED(rv)) + if (NS_FAILED(rv)) { NS_NOTREACHED("failure in IsLastNode"); return false; @@ -2043,13 +2040,13 @@ nsHTMLCopyEncoder::IsLastNode(nsIDOMNode *aNode) // need to check if any nodes after us are really visible. // Mike wrote something for me along these lines in nsSelectionController, // but I don't think it's ready for use yet - revisit. - // HACK: for now, simply consider all whitespace text nodes to be + // HACK: for now, simply consider all whitespace text nodes to be // invisible formatting nodes. j = (int32_t)numChildren-1; nsCOMPtrchildList; nsCOMPtr child; rv = parent->GetChildNodes(getter_AddRefs(childList)); - if (NS_FAILED(rv) || !childList) + if (NS_FAILED(rv) || !childList) { NS_NOTREACHED("failure in IsLastNode"); return true; @@ -2058,9 +2055,9 @@ nsHTMLCopyEncoder::IsLastNode(nsIDOMNode *aNode) { childList->Item(j, getter_AddRefs(child)); j--; - if (IsMozBR(child)) // we ignore trailing moz BRs. + if (IsMozBR(child)) // we ignore trailing moz BRs. continue; - if (!IsEmptyTextContent(child)) + if (!IsEmptyTextContent(child)) return false; } return true; @@ -2105,4 +2102,3 @@ nsHTMLCopyEncoder::GetImmediateContextCount(const nsTArray& aAncestorA } return j; } - diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 4fae12cdca3b..5c07cff3fa1f 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -14019,7 +14019,6 @@ nsGlobalModalWindow::GetReturnValue(nsIVariant **aRetVal) { FORWARD_TO_OUTER_MODAL_CONTENT_WINDOW(GetReturnValue, (aRetVal), NS_OK); - nsCOMPtr result; if (!mReturnValue) { nsCOMPtr variant = CreateVoidVariant(); variant.forget(aRetVal); diff --git a/dom/base/nsHostObjectProtocolHandler.cpp b/dom/base/nsHostObjectProtocolHandler.cpp index cc2f64723649..d4490af7d019 100644 --- a/dom/base/nsHostObjectProtocolHandler.cpp +++ b/dom/base/nsHostObjectProtocolHandler.cpp @@ -220,7 +220,6 @@ class BlobURLsReporter final : public nsIMemoryReporter "blob cannot be freed until all URLs for it have been explicitly " "invalidated with URL.revokeObjectURL."); nsAutoCString path, url, owner, specialDesc; - nsCOMPtr principalURI; uint64_t size = 0; uint32_t refCount = 1; DebugOnly blobImplWasCounted; diff --git a/dom/base/nsLocation.cpp b/dom/base/nsLocation.cpp index 39338d51b070..04e1d2a7f08a 100644 --- a/dom/base/nsLocation.cpp +++ b/dom/base/nsLocation.cpp @@ -263,7 +263,6 @@ nsLocation::SetURI(nsIURI* aURI, bool aReplace) nsCOMPtr docShell(do_QueryReferent(mDocShell)); if (docShell) { nsCOMPtr loadInfo; - nsCOMPtr webNav(do_QueryInterface(docShell)); if(NS_FAILED(CheckURL(aURI, getter_AddRefs(loadInfo)))) return NS_ERROR_FAILURE; diff --git a/dom/base/nsScriptLoader.cpp b/dom/base/nsScriptLoader.cpp index 4a3750de6309..ea60c62a778a 100644 --- a/dom/base/nsScriptLoader.cpp +++ b/dom/base/nsScriptLoader.cpp @@ -2660,7 +2660,6 @@ nsScriptLoader::PrepareLoadedRequest(nsScriptLoadRequest* aRequest, return NS_ERROR_FAILURE; } - nsCOMPtr baseURL; channel->GetURI(getter_AddRefs(request->mBaseURL)); // Attempt to compile off main thread. diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 8c9e0d48111f..3f720f94114e 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -3118,8 +3118,6 @@ nsDOMDeviceStorage::AddOrAppendNamed(Blob* aBlob, const nsAString& aPath, return nullptr; } - nsCOMPtr r; - if (IsFullPath(aPath)) { nsString storagePath; RefPtr ds = GetStorage(aPath, storagePath); diff --git a/dom/html/HTMLSelectElement.cpp b/dom/html/HTMLSelectElement.cpp index 1cc44912acb3..dbac898a85e8 100644 --- a/dom/html/HTMLSelectElement.cpp +++ b/dom/html/HTMLSelectElement.cpp @@ -614,7 +614,6 @@ HTMLSelectElement::Add(nsIDOMHTMLElement* aElement, } nsCOMPtr supports; - nsCOMPtr beforeElement; // whether aBefore is nsIDOMHTMLElement... if (NS_SUCCEEDED(aBefore->GetAsISupports(getter_AddRefs(supports)))) { diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 0dc144e666e0..05a94e90416d 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -3123,9 +3123,6 @@ nsGenericHTMLElement::GetInnerText(mozilla::dom::DOMString& aValue, void nsGenericHTMLElement::SetInnerText(const nsAString& aValue) { - // Fire DOMNodeRemoved mutation events before we do anything else. - nsCOMPtr kungFuDeathGrip; - // Batch possible DOMSubtreeModified events. mozAutoSubtreeModified subtree(OwnerDoc(), nullptr); FireNodeRemovedForChildren(); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 5ddd47d3450b..1deba5535e37 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1085,7 +1085,6 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext, } if (aContext.IsMozBrowserElement() || !aContext.HasOwnApp()) { - RefPtr tp; RefPtr constructorSender; if (isInContentProcess) { MOZ_ASSERT(aContext.IsMozBrowserElement()); diff --git a/dom/media/MediaDecoderReader.cpp b/dom/media/MediaDecoderReader.cpp index cf9495b36613..677be8141182 100644 --- a/dom/media/MediaDecoderReader.cpp +++ b/dom/media/MediaDecoderReader.cpp @@ -528,8 +528,6 @@ MediaDecoderReader::Shutdown() // Shut down the watch manager before shutting down our task queue. mWatchManager.Shutdown(); - RefPtr p; - mDecoder = nullptr; ReaderQueue::Instance().Remove(this); diff --git a/dom/plugins/base/nsPluginStreamListenerPeer.cpp b/dom/plugins/base/nsPluginStreamListenerPeer.cpp index 07f7d0567be5..a778df4694ed 100644 --- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp +++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp @@ -411,7 +411,6 @@ nsPluginStreamListenerPeer::SetupPluginCacheFile(nsIChannel* channel) return rv; // create a file output stream to write to... - nsCOMPtr outstream; rv = NS_NewLocalFileOutputStream(getter_AddRefs(mFileCacheOutputStream), pluginTmp, -1, 00600); if (NS_FAILED(rv)) return rv; diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 00aac104d7ae..3dc717fac8ab 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -3355,7 +3355,6 @@ PluginInstanceChild::CreateOptSurface(void) "Need a valid surface type here"); NS_ASSERTION(!mCurrentSurface, "mCurrentSurfaceActor can get out of sync."); - RefPtr retsurf; // Use an opaque surface unless we're transparent and *don't* have // a background to source from. gfxImageFormat format = @@ -3581,7 +3580,9 @@ PluginInstanceChild::EnsureCurrentBuffer(void) void PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow) { +#if defined(MOZ_X11) || defined(XP_WIN) RefPtr curSurface = mHelperSurface ? mHelperSurface : mCurrentSurface; +#endif // Only used within MOZ_X11 or XP_WIN blocks. Unused variable otherwise bool needWindowUpdate = aForceSetWindow; #ifdef MOZ_X11 Visual* visual = nullptr; diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index 67fafa1ac559..6f7e4033887f 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -7488,8 +7488,6 @@ UpgradeDirectoryMetadataFrom1To2Helper::DoProcessOriginDirectories() { AssertIsOnIOThread(); - nsCOMPtr permanentStorageDir; - for (uint32_t count = mOriginProps.Length(), index = 0; index < count; index++) { diff --git a/dom/storage/DOMStorageDBThread.cpp b/dom/storage/DOMStorageDBThread.cpp index 66790011f622..d479fbb783f4 100644 --- a/dom/storage/DOMStorageDBThread.cpp +++ b/dom/storage/DOMStorageDBThread.cpp @@ -457,7 +457,6 @@ DOMStorageDBThread::OpenDatabaseConnection() = do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr connection; rv = service->OpenUnsharedDatabase(mDatabaseFile, getter_AddRefs(mWorkerConnection)); if (rv == NS_ERROR_FILE_CORRUPTED) { // delete the db and try opening again diff --git a/dom/xml/nsXMLFragmentContentSink.cpp b/dom/xml/nsXMLFragmentContentSink.cpp index 2cf8ae8a8f14..7c2c1ce612c9 100644 --- a/dom/xml/nsXMLFragmentContentSink.cpp +++ b/dom/xml/nsXMLFragmentContentSink.cpp @@ -167,8 +167,6 @@ nsXMLFragmentContentSink::WillBuildModel(nsDTDMode aDTDMode) NS_IMETHODIMP nsXMLFragmentContentSink::DidBuildModel(bool aTerminated) { - RefPtr kungFuDeathGrip(mParser); - // Drop our reference to the parser to get rid of a circular // reference. mParser = nullptr; diff --git a/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp b/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp index 7a368a9969b1..a70307bf5331 100644 --- a/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp +++ b/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp @@ -225,7 +225,6 @@ nsXULTemplateQueryProcessorStorage::GetDatasource(nsIArray* aDataSources, return rv; } - nsCOMPtr file; rv = fileChannel->GetFile(getter_AddRefs(databaseFile)); NS_ENSURE_SUCCESS(rv, rv); }