Backed out 2 changesets (bug 1026008, bug 1025264) for debug crashtest leaks on a CLOSED TREE

Backed out changeset d7ab14487c62 (bug 1026008)
Backed out changeset 0b04aefdd3e3 (bug 1025264)
This commit is contained in:
Wes Kocher 2014-06-19 17:13:12 -07:00
parent 7565fe4dbe
commit c640e2a966
8 changed files with 33 additions and 32 deletions

View File

@ -294,7 +294,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURI, nsIURI* *aResult)
if (!baseURI) {
LogMessage("No chrome package registered for chrome://%s/%s/%s",
package.get(), provider.get(), path.get());
return NS_ERROR_FILE_NOT_FOUND;
return NS_ERROR_FAILURE;
}
return NS_NewURI(aResult, path, nullptr, baseURI);

View File

@ -272,7 +272,7 @@ nsChromeRegistryChrome::GetSelectedLocale(const nsACString& aPackage,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_FREE(entry))
return NS_ERROR_FILE_NOT_FOUND;
return NS_ERROR_FAILURE;
aLocale = entry->locales.GetSelected(mSelectedLocale, nsProviderArray::LOCALE);
if (aLocale.IsEmpty())
@ -560,7 +560,7 @@ nsChromeRegistryChrome::GetFlagsFromPackage(const nsCString& aPackage,
& (nsACString&) aPackage,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_FREE(entry))
return NS_ERROR_FILE_NOT_FOUND;
return NS_ERROR_NOT_AVAILABLE;
*aFlags = entry->flags;
return NS_OK;

View File

@ -25,19 +25,19 @@ public:
uint32_t Length() const
{
return mIsContentElement ? mContentElement->MatchedNodes().Length()
: mChildrenElement->InsertedChildrenLength();
: mChildrenElement->mInsertedChildren.Length();
}
nsIContent* operator[](int32_t aIndex) const
{
return mIsContentElement ? mContentElement->MatchedNodes()[aIndex]
: mChildrenElement->InsertedChild(aIndex);
: mChildrenElement->mInsertedChildren[aIndex];
}
bool IsEmpty() const
{
return mIsContentElement ? mContentElement->MatchedNodes().IsEmpty()
: !mChildrenElement->HasInsertedChildren();
: mChildrenElement->mInsertedChildren.IsEmpty();
}
protected:
bool mIsContentElement;

View File

@ -103,8 +103,8 @@ nsAnonymousContentList::GetLength(uint32_t* aLength)
child = child->GetNextSibling()) {
if (child->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
XBLChildrenElement* point = static_cast<XBLChildrenElement*>(child);
if (point->HasInsertedChildren()) {
count += point->InsertedChildrenLength();
if (!point->mInsertedChildren.IsEmpty()) {
count += point->mInsertedChildren.Length();
}
else {
count += point->GetChildCount();
@ -144,11 +144,11 @@ nsAnonymousContentList::Item(uint32_t aIndex)
child = child->GetNextSibling()) {
if (child->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
XBLChildrenElement* point = static_cast<XBLChildrenElement*>(child);
if (point->HasInsertedChildren()) {
if (remIndex < point->InsertedChildrenLength()) {
return point->InsertedChild(remIndex);
if (!point->mInsertedChildren.IsEmpty()) {
if (remIndex < point->mInsertedChildren.Length()) {
return point->mInsertedChildren[remIndex];
}
remIndex -= point->InsertedChildrenLength();
remIndex -= point->mInsertedChildren.Length();
}
else {
if (remIndex < point->GetChildCount()) {
@ -179,23 +179,23 @@ nsAnonymousContentList::IndexOf(nsIContent* aContent)
return -1;
}
int32_t index = 0;
size_t index = 0;
for (nsIContent* child = mParent->GetFirstChild();
child;
child = child->GetNextSibling()) {
if (child->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
XBLChildrenElement* point = static_cast<XBLChildrenElement*>(child);
if (point->HasInsertedChildren()) {
int32_t insIndex = point->IndexOfInsertedChild(aContent);
if (insIndex != -1) {
if (!point->mInsertedChildren.IsEmpty()) {
size_t insIndex = point->mInsertedChildren.IndexOf(aContent);
if (insIndex != point->mInsertedChildren.NoIndex) {
return index + insIndex;
}
index += point->InsertedChildrenLength();
index += point->mInsertedChildren.Length();
}
else {
int32_t insIndex = point->IndexOf(aContent);
if (insIndex != -1) {
return index + insIndex;
return index + (size_t)insIndex;
}
index += point->GetChildCount();
}

View File

@ -22,6 +22,8 @@ class ExplicitChildIterator;
class XBLChildrenElement : public nsXMLElement
{
public:
friend class mozilla::dom::ExplicitChildIterator;
friend class nsAnonymousContentList;
XBLChildrenElement(already_AddRefed<nsINodeInfo>& aNodeInfo)
: nsXMLElement(aNodeInfo)
{
@ -113,7 +115,10 @@ public:
return !mInsertedChildren.IsEmpty();
}
int32_t IndexOfInsertedChild(nsIContent* aChild)
enum {
NoIndex = uint32_t(-1)
};
uint32_t IndexOfInsertedChild(nsIContent* aChild)
{
return mInsertedChildren.IndexOf(aChild);
}
@ -130,13 +135,9 @@ public:
return mIncludes.IsEmpty();
}
nsIContent* InsertedChild(uint32_t aIndex)
{
return mInsertedChildren[aIndex];
}
nsTArray<nsIContent*> mInsertedChildren;
private:
nsCOMArray<nsIContent> mInsertedChildren;
nsTArray<nsCOMPtr<nsIAtom> > mIncludes;
};

View File

@ -834,12 +834,12 @@ static void
InsertAppendedContent(XBLChildrenElement* aPoint,
nsIContent* aFirstNewContent)
{
int32_t insertionIndex;
size_t insertionIndex;
if (nsIContent* prevSibling = aFirstNewContent->GetPreviousSibling()) {
// If we have a previous sibling, then it must already be in aPoint. Find
// it and insert after it.
insertionIndex = aPoint->IndexOfInsertedChild(prevSibling);
MOZ_ASSERT(insertionIndex != -1);
MOZ_ASSERT(insertionIndex != aPoint->NoIndex);
// Our insertion index is one after our previous sibling's index.
++insertionIndex;
@ -847,7 +847,7 @@ InsertAppendedContent(XBLChildrenElement* aPoint,
// Otherwise, we append.
// TODO This is wrong for nested insertion points. In that case, we need to
// keep track of the right index to insert into.
insertionIndex = aPoint->InsertedChildrenLength();
insertionIndex = aPoint->mInsertedChildren.Length();
}
// Do the inserting.
@ -1077,15 +1077,15 @@ nsBindingManager::HandleChildInsertion(nsIContent* aContainer,
// TODO If there were multiple insertion points, this approximation can be
// wrong. We need to re-run the distribution algorithm. In the meantime,
// this should work well enough.
uint32_t index = aAppend ? point->InsertedChildrenLength() : 0;
size_t index = aAppend ? point->mInsertedChildren.Length() : 0;
for (nsIContent* currentSibling = aChild->GetPreviousSibling();
currentSibling;
currentSibling = currentSibling->GetPreviousSibling()) {
// If we find one of our previous siblings in the insertion point, the
// index following it is the correct insertion point. Otherwise, we guess
// based on whether we're appending or inserting.
int32_t pointIndex = point->IndexOfInsertedChild(currentSibling);
if (pointIndex != -1) {
size_t pointIndex = point->IndexOfInsertedChild(currentSibling);
if (pointIndex != point->NoIndex) {
index = pointIndex + 1;
break;
}

View File

@ -702,7 +702,7 @@ UpdateInsertionParent(XBLChildrenElement* aPoint,
}
for (size_t i = 0; i < aPoint->InsertedChildrenLength(); ++i) {
nsIContent* child = aPoint->InsertedChild(i);
nsIContent* child = aPoint->mInsertedChildren[i];
MOZ_ASSERT(child->GetParentNode());

View File

@ -28,7 +28,7 @@ function run_test() {
test_BrokenFile("chrome://test/content/test.jsm",
true,
"NS_ERROR_FILE_NOT_FOUND");
"NS_ERROR_NOT_AVAILABLE");
// check that we can access modules' global objects even if
// EXPORTED_SYMBOLS is missing or ill-formed: