mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 777292 - Don't use |= on nsresult; r=ehsan
This commit is contained in:
parent
829da4acf9
commit
587e4453db
@ -1021,7 +1021,10 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \
|
||||
\
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip = it; \
|
||||
nsresult rv = it->Init(); \
|
||||
rv |= const_cast<_elementName*>(this)->CopyInnerTo(it); \
|
||||
nsresult rv2 = const_cast<_elementName*>(this)->CopyInnerTo(it); \
|
||||
if (NS_FAILED(rv2)) { \
|
||||
rv = rv2; \
|
||||
} \
|
||||
if (NS_SUCCEEDED(rv)) { \
|
||||
kungFuDeathGrip.swap(*aResult); \
|
||||
} \
|
||||
|
@ -36,11 +36,11 @@ nsXMLNameSpaceMap::Create(bool aForXML)
|
||||
NS_ENSURE_TRUE(map, nsnull);
|
||||
|
||||
if (aForXML) {
|
||||
nsresult rv = map->AddPrefix(nsGkAtoms::xmlns,
|
||||
kNameSpaceID_XMLNS);
|
||||
rv |= map->AddPrefix(nsGkAtoms::xml, kNameSpaceID_XML);
|
||||
nsresult rv1 = map->AddPrefix(nsGkAtoms::xmlns,
|
||||
kNameSpaceID_XMLNS);
|
||||
nsresult rv2 = map->AddPrefix(nsGkAtoms::xml, kNameSpaceID_XML);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
if (NS_FAILED(rv1) || NS_FAILED(rv2)) {
|
||||
delete map;
|
||||
map = nsnull;
|
||||
}
|
||||
|
@ -3327,7 +3327,10 @@ nsHTMLInputElement::SaveState()
|
||||
}
|
||||
|
||||
if (mDisabledChanged) {
|
||||
rv |= GetPrimaryPresState(this, &state);
|
||||
nsresult tmp = GetPrimaryPresState(this, &state);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (state) {
|
||||
// We do not want to save the real disabled state but the disabled
|
||||
// attribute.
|
||||
|
@ -187,13 +187,13 @@ nsSVGSVGElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
nsSVGSVGElement *it = new nsSVGSVGElement(ni.forget(), NOT_FROM_PARSER);
|
||||
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip = it;
|
||||
nsresult rv = it->Init();
|
||||
rv |= const_cast<nsSVGSVGElement*>(this)->CopyInnerTo(it);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsresult rv1 = it->Init();
|
||||
nsresult rv2 = const_cast<nsSVGSVGElement*>(this)->CopyInnerTo(it);
|
||||
if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2)) {
|
||||
kungFuDeathGrip.swap(*aResult);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_FAILED(rv1) ? rv1 : rv2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,9 +128,10 @@ nsSVGScriptElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
nsSVGScriptElement* it = new nsSVGScriptElement(ni.forget(), NOT_FROM_PARSER);
|
||||
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip = it;
|
||||
nsresult rv = it->Init();
|
||||
rv |= const_cast<nsSVGScriptElement*>(this)->CopyInnerTo(it);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv1 = it->Init();
|
||||
nsresult rv2 = const_cast<nsSVGScriptElement*>(this)->CopyInnerTo(it);
|
||||
NS_ENSURE_SUCCESS(rv1, rv1);
|
||||
NS_ENSURE_SUCCESS(rv2, rv2);
|
||||
|
||||
// The clone should be marked evaluated if we are.
|
||||
it->mAlreadyStarted = mAlreadyStarted;
|
||||
|
@ -107,17 +107,17 @@ nsSVGUseElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip(it);
|
||||
nsresult rv = it->Init();
|
||||
rv |= const_cast<nsSVGUseElement*>(this)->CopyInnerTo(it);
|
||||
nsresult rv1 = it->Init();
|
||||
nsresult rv2 = const_cast<nsSVGUseElement*>(this)->CopyInnerTo(it);
|
||||
|
||||
// nsSVGUseElement specific portion - record who we cloned from
|
||||
it->mOriginal = const_cast<nsSVGUseElement*>(this);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2)) {
|
||||
kungFuDeathGrip.swap(*aResult);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_FAILED(rv1) ? rv1 : rv2;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1935,10 +1935,16 @@ nsXULPrototypeElement::Serialize(nsIObjectOutputStream* aStream,
|
||||
// Write Node Info
|
||||
PRInt32 index = aNodeInfos->IndexOf(mNodeInfo);
|
||||
NS_ASSERTION(index >= 0, "unknown nsINodeInfo index");
|
||||
rv |= aStream->Write32(index);
|
||||
nsresult tmp = aStream->Write32(index);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
// Write Attributes
|
||||
rv |= aStream->Write32(mNumAttributes);
|
||||
tmp = aStream->Write32(mNumAttributes);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
nsAutoString attributeValue;
|
||||
PRUint32 i;
|
||||
@ -1957,33 +1963,57 @@ nsXULPrototypeElement::Serialize(nsIObjectOutputStream* aStream,
|
||||
|
||||
index = aNodeInfos->IndexOf(ni);
|
||||
NS_ASSERTION(index >= 0, "unknown nsINodeInfo index");
|
||||
rv |= aStream->Write32(index);
|
||||
tmp = aStream->Write32(index);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
mAttributes[i].mValue.ToString(attributeValue);
|
||||
rv |= aStream->WriteWStringZ(attributeValue.get());
|
||||
tmp = aStream->WriteWStringZ(attributeValue.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// Now write children
|
||||
rv |= aStream->Write32(PRUint32(mChildren.Length()));
|
||||
tmp = aStream->Write32(PRUint32(mChildren.Length()));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
for (i = 0; i < mChildren.Length(); i++) {
|
||||
nsXULPrototypeNode* child = mChildren[i].get();
|
||||
switch (child->mType) {
|
||||
case eType_Element:
|
||||
case eType_Text:
|
||||
case eType_PI:
|
||||
rv |= child->Serialize(aStream, aGlobal, aNodeInfos);
|
||||
tmp = child->Serialize(aStream, aGlobal, aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
case eType_Script:
|
||||
rv |= aStream->Write32(child->mType);
|
||||
tmp = aStream->Write32(child->mType);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
nsXULPrototypeScript* script = static_cast<nsXULPrototypeScript*>(child);
|
||||
|
||||
rv |= aStream->Write8(script->mOutOfLine);
|
||||
tmp = aStream->Write8(script->mOutOfLine);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (! script->mOutOfLine) {
|
||||
rv |= script->Serialize(aStream, aGlobal, aNodeInfos);
|
||||
tmp = script->Serialize(aStream, aGlobal, aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
} else {
|
||||
rv |= aStream->WriteCompoundObject(script->mSrcURI,
|
||||
tmp = aStream->WriteCompoundObject(script->mSrcURI,
|
||||
NS_GET_IID(nsIURI),
|
||||
true);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
if (script->mScriptObject.mObject) {
|
||||
// This may return NS_OK without muxing script->mSrcURI's
|
||||
@ -1991,7 +2021,10 @@ nsXULPrototypeElement::Serialize(nsIObjectOutputStream* aStream,
|
||||
// muxed document is already there (written by a prior
|
||||
// session, or by an earlier cache episode during this
|
||||
// session).
|
||||
rv |= script->SerializeOutOfLine(aStream, aGlobal);
|
||||
tmp = script->SerializeOutOfLine(aStream, aGlobal);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2017,7 +2050,10 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// Read Attributes
|
||||
rv |= aStream->Read32(&number);
|
||||
nsresult tmp = aStream->Read32(&number);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
mNumAttributes = PRInt32(number);
|
||||
|
||||
PRUint32 i;
|
||||
@ -2028,19 +2064,31 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
|
||||
nsAutoString attributeValue;
|
||||
for (i = 0; i < mNumAttributes; ++i) {
|
||||
rv |= aStream->Read32(&number);
|
||||
tmp = aStream->Read32(&number);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
nsINodeInfo* ni = aNodeInfos->SafeObjectAt(number);
|
||||
if (!ni)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
mAttributes[i].mName.SetTo(ni);
|
||||
|
||||
rv |= aStream->ReadString(attributeValue);
|
||||
rv |= SetAttrAt(i, attributeValue, aDocumentURI);
|
||||
tmp = aStream->ReadString(attributeValue);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = SetAttrAt(i, attributeValue, aDocumentURI);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rv |= aStream->Read32(&number);
|
||||
tmp = aStream->Read32(&number);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
PRUint32 numChildren = PRInt32(number);
|
||||
|
||||
if (numChildren > 0) {
|
||||
@ -2048,7 +2096,10 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
for (i = 0; i < numChildren; i++) {
|
||||
rv |= aStream->Read32(&number);
|
||||
tmp = aStream->Read32(&number);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
Type childType = (Type)number;
|
||||
|
||||
nsRefPtr<nsXULPrototypeNode> child;
|
||||
@ -2060,8 +2111,11 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
child->mType = childType;
|
||||
|
||||
rv |= child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
tmp = child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
case eType_Text:
|
||||
child = new nsXULPrototypeText();
|
||||
@ -2069,8 +2123,11 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
child->mType = childType;
|
||||
|
||||
rv |= child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
tmp = child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
case eType_PI:
|
||||
child = new nsXULPrototypePI();
|
||||
@ -2078,8 +2135,11 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
child->mType = childType;
|
||||
|
||||
rv |= child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
tmp = child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
case eType_Script: {
|
||||
// language version/options obtained during deserialization.
|
||||
@ -2089,14 +2149,26 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
child = script;
|
||||
child->mType = childType;
|
||||
|
||||
rv |= aStream->ReadBoolean(&script->mOutOfLine);
|
||||
tmp = aStream->ReadBoolean(&script->mOutOfLine);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (! script->mOutOfLine) {
|
||||
rv |= script->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
tmp = script->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
} else {
|
||||
rv |= aStream->ReadObject(true, getter_AddRefs(script->mSrcURI));
|
||||
tmp = aStream->ReadObject(true, getter_AddRefs(script->mSrcURI));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
rv |= script->DeserializeOutOfLine(aStream, aGlobal);
|
||||
tmp = script->DeserializeOutOfLine(aStream, aGlobal);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
// If we failed to deserialize, consider deleting 'script'?
|
||||
break;
|
||||
@ -2272,8 +2344,14 @@ nsXULPrototypeScript::SerializeOutOfLine(nsIObjectOutputStream* aStream,
|
||||
rv = cache->GetOutputStream(mSrcURI, getter_AddRefs(oos));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv |= Serialize(oos, aGlobal, nsnull);
|
||||
rv |= cache->FinishOutputStream(mSrcURI);
|
||||
nsresult tmp = Serialize(oos, aGlobal, nsnull);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = cache->FinishOutputStream(mSrcURI);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
cache->AbortCaching();
|
||||
@ -2490,7 +2568,10 @@ nsXULPrototypeText::Serialize(nsIObjectOutputStream* aStream,
|
||||
// Write basic prototype data
|
||||
rv = aStream->Write32(mType);
|
||||
|
||||
rv |= aStream->WriteWStringZ(mValue.get());
|
||||
nsresult tmp = aStream->WriteWStringZ(mValue.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@ -2523,8 +2604,14 @@ nsXULPrototypePI::Serialize(nsIObjectOutputStream* aStream,
|
||||
// Write basic prototype data
|
||||
rv = aStream->Write32(mType);
|
||||
|
||||
rv |= aStream->WriteWStringZ(mTarget.get());
|
||||
rv |= aStream->WriteWStringZ(mData.get());
|
||||
nsresult tmp = aStream->WriteWStringZ(mTarget.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = aStream->WriteWStringZ(mData.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@ -2538,7 +2625,10 @@ nsXULPrototypePI::Deserialize(nsIObjectInputStream* aStream,
|
||||
nsresult rv;
|
||||
|
||||
rv = aStream->ReadString(mTarget);
|
||||
rv |= aStream->ReadString(mData);
|
||||
nsresult tmp = aStream->ReadString(mData);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ CachePrefChangedCallback(const char* aPref, void* aClosure)
|
||||
nsresult
|
||||
nsXULPrototypeCache::BeginCaching(nsIURI* aURI)
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv, tmp;
|
||||
|
||||
nsCAutoString path;
|
||||
aURI->GetPath(path);
|
||||
@ -606,7 +606,10 @@ nsXULPrototypeCache::BeginCaching(nsIURI* aURI)
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
buf.forget();
|
||||
rv = objectInput->ReadCString(fileLocale);
|
||||
rv |= objectInput->ReadCString(fileChromePath);
|
||||
tmp = objectInput->ReadCString(fileChromePath);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (NS_FAILED(rv) ||
|
||||
(!fileChromePath.Equals(chromePath) ||
|
||||
!fileLocale.Equals(locale))) {
|
||||
@ -630,9 +633,18 @@ nsXULPrototypeCache::BeginCaching(nsIURI* aURI)
|
||||
false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = objectOutput->WriteStringZ(locale.get());
|
||||
rv |= objectOutput->WriteStringZ(chromePath.get());
|
||||
rv |= objectOutput->Close();
|
||||
rv |= storageStream->NewInputStream(0, getter_AddRefs(inputStream));
|
||||
tmp = objectOutput->WriteStringZ(chromePath.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = objectOutput->Close();
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = storageStream->NewInputStream(0, getter_AddRefs(inputStream));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = inputStream->Available(&len);
|
||||
|
@ -251,18 +251,29 @@ nsXULPrototypeDocument::Read(nsIObjectInputStream* aStream)
|
||||
PRUint32 count, i;
|
||||
nsCOMPtr<nsIURI> styleOverlayURI;
|
||||
|
||||
rv |= aStream->Read32(&count);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsresult tmp = aStream->Read32(&count);
|
||||
if (NS_FAILED(tmp)) {
|
||||
return tmp;
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
rv |= aStream->ReadObject(true, getter_AddRefs(styleOverlayURI));
|
||||
tmp = aStream->ReadObject(true, getter_AddRefs(styleOverlayURI));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
mStyleSheetReferences.AppendObject(styleOverlayURI);
|
||||
}
|
||||
|
||||
|
||||
// nsIPrincipal mNodeInfoManager->mPrincipal
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
rv |= aStream->ReadObject(true, getter_AddRefs(principal));
|
||||
tmp = aStream->ReadObject(true, getter_AddRefs(principal));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
// Better safe than sorry....
|
||||
mNodeInfoManager->SetDocumentPrincipal(principal);
|
||||
|
||||
@ -279,56 +290,89 @@ nsXULPrototypeDocument::Read(nsIObjectInputStream* aStream)
|
||||
// nsINodeInfo table
|
||||
nsCOMArray<nsINodeInfo> nodeInfos;
|
||||
|
||||
rv |= aStream->Read32(&count);
|
||||
tmp = aStream->Read32(&count);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
nsAutoString namespaceURI, prefixStr, localName;
|
||||
bool prefixIsNull;
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
for (i = 0; i < count; ++i) {
|
||||
rv |= aStream->ReadString(namespaceURI);
|
||||
rv |= aStream->ReadBoolean(&prefixIsNull);
|
||||
tmp = aStream->ReadString(namespaceURI);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = aStream->ReadBoolean(&prefixIsNull);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (prefixIsNull) {
|
||||
prefix = nsnull;
|
||||
} else {
|
||||
rv |= aStream->ReadString(prefixStr);
|
||||
tmp = aStream->ReadString(prefixStr);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
prefix = do_GetAtom(prefixStr);
|
||||
}
|
||||
rv |= aStream->ReadString(localName);
|
||||
tmp = aStream->ReadString(localName);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
// Using PR_UINT16_MAX here as we don't know which nodeinfos will be
|
||||
// used for attributes and which for elements. And that doesn't really
|
||||
// matter.
|
||||
rv |= mNodeInfoManager->GetNodeInfo(localName, prefix, namespaceURI,
|
||||
tmp = mNodeInfoManager->GetNodeInfo(localName, prefix, namespaceURI,
|
||||
PR_UINT16_MAX,
|
||||
getter_AddRefs(nodeInfo));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (!nodeInfos.AppendObject(nodeInfo))
|
||||
rv |= NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Document contents
|
||||
PRUint32 type;
|
||||
while (NS_SUCCEEDED(rv)) {
|
||||
rv |= aStream->Read32(&type);
|
||||
tmp = aStream->Read32(&type);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
if ((nsXULPrototypeNode::Type)type == nsXULPrototypeNode::eType_PI) {
|
||||
nsRefPtr<nsXULPrototypePI> pi = new nsXULPrototypePI();
|
||||
if (! pi) {
|
||||
rv |= NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
rv |= pi->Deserialize(aStream, mGlobalObject, mURI, &nodeInfos);
|
||||
rv |= AddProcessingInstruction(pi);
|
||||
tmp = pi->Deserialize(aStream, mGlobalObject, mURI, &nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = AddProcessingInstruction(pi);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
} else if ((nsXULPrototypeNode::Type)type == nsXULPrototypeNode::eType_Element) {
|
||||
rv |= mRoot->Deserialize(aStream, mGlobalObject, mURI, &nodeInfos);
|
||||
tmp = mRoot->Deserialize(aStream, mGlobalObject, mURI, &nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
NS_NOTREACHED("Unexpected prototype node type");
|
||||
rv |= NS_ERROR_FAILURE;
|
||||
rv = NS_ERROR_FAILURE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rv |= NotifyLoadDone();
|
||||
tmp = NotifyLoadDone();
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@ -389,17 +433,26 @@ nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream)
|
||||
PRUint32 count;
|
||||
|
||||
count = mStyleSheetReferences.Count();
|
||||
rv |= aStream->Write32(count);
|
||||
nsresult tmp = aStream->Write32(count);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
PRUint32 i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
rv |= aStream->WriteCompoundObject(mStyleSheetReferences[i],
|
||||
tmp = aStream->WriteCompoundObject(mStyleSheetReferences[i],
|
||||
NS_GET_IID(nsIURI), true);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// nsIPrincipal mNodeInfoManager->mPrincipal
|
||||
rv |= aStream->WriteObject(mNodeInfoManager->DocumentPrincipal(),
|
||||
tmp = aStream->WriteObject(mNodeInfoManager->DocumentPrincipal(),
|
||||
true);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// XXX Worrisome if we're caching things without system principal.
|
||||
@ -410,30 +463,52 @@ nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream)
|
||||
|
||||
// nsINodeInfo table
|
||||
nsCOMArray<nsINodeInfo> nodeInfos;
|
||||
if (mRoot)
|
||||
rv |= GetNodeInfos(mRoot, nodeInfos);
|
||||
if (mRoot) {
|
||||
tmp = GetNodeInfos(mRoot, nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 nodeInfoCount = nodeInfos.Count();
|
||||
rv |= aStream->Write32(nodeInfoCount);
|
||||
tmp = aStream->Write32(nodeInfoCount);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
for (i = 0; i < nodeInfoCount; ++i) {
|
||||
nsINodeInfo *nodeInfo = nodeInfos[i];
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoString namespaceURI;
|
||||
rv |= nodeInfo->GetNamespaceURI(namespaceURI);
|
||||
rv |= aStream->WriteWStringZ(namespaceURI.get());
|
||||
tmp = nodeInfo->GetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = aStream->WriteWStringZ(namespaceURI.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
nsAutoString prefix;
|
||||
nodeInfo->GetPrefix(prefix);
|
||||
bool nullPrefix = DOMStringIsNull(prefix);
|
||||
rv |= aStream->WriteBoolean(nullPrefix);
|
||||
tmp = aStream->WriteBoolean(nullPrefix);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (!nullPrefix) {
|
||||
rv |= aStream->WriteWStringZ(prefix.get());
|
||||
tmp = aStream->WriteWStringZ(prefix.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString localName;
|
||||
nodeInfo->GetName(localName);
|
||||
rv |= aStream->WriteWStringZ(localName.get());
|
||||
tmp = aStream->WriteWStringZ(localName.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// Now serialize the document contents
|
||||
@ -443,11 +518,18 @@ nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream)
|
||||
count = mProcessingInstructions.Length();
|
||||
for (i = 0; i < count; ++i) {
|
||||
nsXULPrototypePI* pi = mProcessingInstructions[i];
|
||||
rv |= pi->Serialize(aStream, globalObject, &nodeInfos);
|
||||
tmp = pi->Serialize(aStream, globalObject, &nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (mRoot)
|
||||
rv |= mRoot->Serialize(aStream, globalObject, &nodeInfos);
|
||||
if (mRoot) {
|
||||
tmp = mRoot->Serialize(aStream, globalObject, &nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -4270,7 +4270,8 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
|
||||
if (aURI)
|
||||
{
|
||||
nsresult rv = aURI->GetSpec(url);
|
||||
rv |= aURI->GetOriginCharset(charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aURI->GetOriginCharset(charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else if (aURL)
|
||||
|
@ -8796,13 +8796,16 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx, JSObject *obj,
|
||||
nsRefPtr<nsContentList> list =
|
||||
domdoc->GetElementsByTagName(NS_LITERAL_STRING("*"));
|
||||
if (!list) {
|
||||
rv |= NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
rv |= WrapNative(cx, JS_GetGlobalForScopeChain(cx),
|
||||
static_cast<nsINodeList*>(list), list, false,
|
||||
&collection, getter_AddRefs(holder));
|
||||
nsresult tmp = WrapNative(cx, JS_GetGlobalForScopeChain(cx),
|
||||
static_cast<nsINodeList*>(list), list, false,
|
||||
&collection, getter_AddRefs(holder));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
list.forget(nodeList);
|
||||
|
||||
|
@ -756,32 +756,50 @@ nsJSContext::DOMOperationCallback(JSContext *cx)
|
||||
"KillScriptTitle",
|
||||
title);
|
||||
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
nsresult tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"StopScriptButton",
|
||||
stopButton);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"WaitForScriptButton",
|
||||
waitButton);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"DontAskAgain",
|
||||
neverShowDlg);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
|
||||
if (debugPossible) {
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"DebugScriptButton",
|
||||
debugButton);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"KillScriptWithDebugMessage",
|
||||
msg);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"KillScriptMessage",
|
||||
msg);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
//GetStringFromName can return NS_OK and still give NULL string
|
||||
|
@ -379,19 +379,19 @@ nsFindContentIterator::SetupInnerIterator(nsIContent* aContent)
|
||||
|
||||
// make sure to place the outer-iterator outside
|
||||
// the text control so that we don't go there again.
|
||||
nsresult res;
|
||||
nsresult res1, res2;
|
||||
nsCOMPtr<nsIDOMNode> outerNode(do_QueryInterface(aContent));
|
||||
if (!mFindBackward) { // find forward
|
||||
// cut the outer-iterator after the current node
|
||||
res = outerRange->SetEnd(mEndNode, mEndOffset);
|
||||
res |= outerRange->SetStartAfter(outerNode);
|
||||
res1 = outerRange->SetEnd(mEndNode, mEndOffset);
|
||||
res2 = outerRange->SetStartAfter(outerNode);
|
||||
}
|
||||
else { // find backward
|
||||
// cut the outer-iterator before the current node
|
||||
res = outerRange->SetStart(mStartNode, mStartOffset);
|
||||
res |= outerRange->SetEndBefore(outerNode);
|
||||
res1 = outerRange->SetStart(mStartNode, mStartOffset);
|
||||
res2 = outerRange->SetEndBefore(outerNode);
|
||||
}
|
||||
if (NS_FAILED(res)) {
|
||||
if (NS_FAILED(res1) || NS_FAILED(res2)) {
|
||||
// we are done with the outer-iterator, the
|
||||
// inner-iterator will traverse what we want
|
||||
outerRange->Collapse(true);
|
||||
|
@ -1044,9 +1044,9 @@ NS_IMETHODIMP imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctx
|
||||
if (NS_FAILED(rv)) {
|
||||
// Flush memory, try to get some back, and try again
|
||||
rv = nsMemory::HeapMinimize(true);
|
||||
rv |= rasterImage->SetSourceSizeHint(sizeHint);
|
||||
nsresult rv2 = rasterImage->SetSourceSizeHint(sizeHint);
|
||||
// If we've still failed at this point, things are going downhill
|
||||
if (NS_FAILED(rv)) {
|
||||
if (NS_FAILED(rv) || NS_FAILED(rv2)) {
|
||||
NS_WARNING("About to hit OOM in imagelib!");
|
||||
}
|
||||
}
|
||||
|
@ -1139,15 +1139,24 @@ DocumentViewerImpl::PermitUnload(bool aCallerClosesWindow, bool *aPermitUnload)
|
||||
rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"OnBeforeUnloadTitle",
|
||||
title);
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
nsresult tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"OnBeforeUnloadMessage",
|
||||
message);
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"OnBeforeUnloadLeaveButton",
|
||||
leaveLabel);
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"OnBeforeUnloadStayButton",
|
||||
stayLabel);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv) || !title || !message || !stayLabel || !leaveLabel) {
|
||||
NS_ERROR("Failed to get strings from dom.properties!");
|
||||
|
@ -4222,8 +4222,8 @@ nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
|
||||
|
||||
PRInt32 imgWidth, imgHeight;
|
||||
rv = imgContainer->GetWidth(&imgWidth);
|
||||
rv |= imgContainer->GetHeight(&imgHeight);
|
||||
if (NS_FAILED(rv))
|
||||
nsresult rv2 = imgContainer->GetHeight(&imgHeight);
|
||||
if (NS_FAILED(rv) || NS_FAILED(rv2))
|
||||
return result;
|
||||
|
||||
if (wantImageSurface && framesurf->GetType() != gfxASurface::SurfaceTypeImage) {
|
||||
|
@ -4828,7 +4828,10 @@ Selection::Extend(nsINode* aParentNode, PRInt32 aOffset)
|
||||
return res;
|
||||
dir = eDirNext;
|
||||
res = difRange->SetEnd(range->GetEndParent(), range->EndOffset());
|
||||
res |= difRange->SetStart(focusNode, focusOffset);
|
||||
nsresult tmp = difRange->SetStart(focusNode, focusOffset);
|
||||
if (NS_FAILED(tmp)) {
|
||||
res = tmp;
|
||||
}
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
selectFrames(presContext, difRange , true);
|
||||
@ -4850,7 +4853,10 @@ Selection::Extend(nsINode* aParentNode, PRInt32 aOffset)
|
||||
else if (result3 <= 0 && result2 >= 0) {//a,2,1 or a2,1 or a,21 or a21
|
||||
//deselect from 2 to 1
|
||||
res = difRange->SetEnd(focusNode, focusOffset);
|
||||
res |= difRange->SetStart(aParentNode, aOffset);
|
||||
nsresult tmp = difRange->SetStart(aParentNode, aOffset);
|
||||
if (NS_FAILED(tmp)) {
|
||||
res = tmp;
|
||||
}
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
@ -4876,7 +4882,10 @@ Selection::Extend(nsINode* aParentNode, PRInt32 aOffset)
|
||||
return res;
|
||||
if (focusNode != anchorNode || focusOffset != anchorOffset) {//if collapsed diff dont do anything
|
||||
res = difRange->SetStart(focusNode, focusOffset);
|
||||
res |= difRange->SetEnd(anchorNode, anchorOffset);
|
||||
nsresult tmp = difRange->SetEnd(anchorNode, anchorOffset);
|
||||
if (NS_FAILED(tmp)) {
|
||||
res = tmp;
|
||||
}
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
res = SetAnchorFocusToRange(range);
|
||||
@ -4897,7 +4906,10 @@ Selection::Extend(nsINode* aParentNode, PRInt32 aOffset)
|
||||
else if (result2 <= 0 && result3 >= 0) {//1,2,a or 12,a or 1,2a or 12a
|
||||
//deselect from 1 to 2
|
||||
res = difRange->SetEnd(aParentNode, aOffset);
|
||||
res |= difRange->SetStart(focusNode, focusOffset);
|
||||
nsresult tmp = difRange->SetStart(focusNode, focusOffset);
|
||||
if (NS_FAILED(tmp)) {
|
||||
res = tmp;
|
||||
}
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
dir = eDirPrevious;
|
||||
@ -4923,8 +4935,14 @@ Selection::Extend(nsINode* aParentNode, PRInt32 aOffset)
|
||||
//deselect from a to 1
|
||||
if (focusNode != anchorNode || focusOffset!= anchorOffset) {//if collapsed diff dont do anything
|
||||
res = difRange->SetStart(anchorNode, anchorOffset);
|
||||
res |= difRange->SetEnd(focusNode, focusOffset);
|
||||
res |= SetAnchorFocusToRange(range);
|
||||
nsresult tmp = difRange->SetEnd(focusNode, focusOffset);
|
||||
if (NS_FAILED(tmp)) {
|
||||
res = tmp;
|
||||
}
|
||||
tmp = SetAnchorFocusToRange(range);
|
||||
if (NS_FAILED(tmp)) {
|
||||
res = tmp;
|
||||
}
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
selectFrames(presContext, difRange, false);
|
||||
@ -4945,7 +4963,10 @@ Selection::Extend(nsINode* aParentNode, PRInt32 aOffset)
|
||||
return res;
|
||||
dir = eDirPrevious;
|
||||
res = difRange->SetEnd(focusNode, focusOffset);
|
||||
res |= difRange->SetStart(range->GetStartParent(), range->StartOffset());
|
||||
nsresult tmp = difRange->SetStart(range->GetStartParent(), range->StartOffset());
|
||||
if (NS_FAILED(tmp)) {
|
||||
res = tmp;
|
||||
}
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
|
@ -191,17 +191,25 @@ NS_NewChannel(nsIChannel **result,
|
||||
nsCOMPtr<nsIChannel> chan;
|
||||
rv = ioService->NewChannelFromURI(uri, getter_AddRefs(chan));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (loadGroup)
|
||||
rv |= chan->SetLoadGroup(loadGroup);
|
||||
if (callbacks)
|
||||
rv |= chan->SetNotificationCallbacks(callbacks);
|
||||
if (loadGroup) {
|
||||
rv = chan->SetLoadGroup(loadGroup);
|
||||
}
|
||||
if (callbacks) {
|
||||
nsresult tmp = chan->SetNotificationCallbacks(callbacks);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
if (loadFlags != nsIRequest::LOAD_NORMAL) {
|
||||
// Retain the LOAD_REPLACE load flag if set.
|
||||
nsLoadFlags normalLoadFlags = 0;
|
||||
chan->GetLoadFlags(&normalLoadFlags);
|
||||
rv |= chan->SetLoadFlags(loadFlags |
|
||||
(normalLoadFlags &
|
||||
nsIChannel::LOAD_REPLACE));
|
||||
nsresult tmp = chan->SetLoadFlags(loadFlags |
|
||||
(normalLoadFlags &
|
||||
nsIChannel::LOAD_REPLACE));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
if (channelPolicy) {
|
||||
nsCOMPtr<nsIWritablePropertyBag2> props = do_QueryInterface(chan);
|
||||
@ -406,17 +414,24 @@ NS_NewInputStreamChannel(nsIChannel **result,
|
||||
do_CreateInstance(NS_INPUTSTREAMCHANNEL_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv |= isc->SetURI(uri);
|
||||
rv |= isc->SetContentStream(stream);
|
||||
rv = isc->SetURI(uri);
|
||||
nsresult tmp = isc->SetContentStream(stream);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsCOMPtr<nsIChannel> chan = do_QueryInterface(isc, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!contentType.IsEmpty())
|
||||
rv |= chan->SetContentType(contentType);
|
||||
if (contentCharset && !contentCharset->IsEmpty())
|
||||
rv |= chan->SetContentCharset(*contentCharset);
|
||||
rv = chan->SetContentType(contentType);
|
||||
if (contentCharset && !contentCharset->IsEmpty()) {
|
||||
tmp = chan->SetContentCharset(*contentCharset);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*result = nsnull;
|
||||
chan.swap(*result);
|
||||
|
@ -98,7 +98,10 @@ nsURIChecker::CheckStatus()
|
||||
PRUint32 loadFlags;
|
||||
|
||||
rv = lastChannel->GetOriginalURI(getter_AddRefs(uri));
|
||||
rv |= lastChannel->GetLoadFlags(&loadFlags);
|
||||
nsresult tmp = lastChannel->GetLoadFlags(&loadFlags);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
// XXX we are carrying over the load flags, but what about other
|
||||
// parameters that may have been set on lastChannel??
|
||||
|
105
netwerk/cache/nsDiskCacheDeviceSQL.cpp
vendored
105
netwerk/cache/nsDiskCacheDeviceSQL.cpp
vendored
@ -925,14 +925,35 @@ nsOfflineCacheDevice::UpdateEntry(nsCacheEntry *entry)
|
||||
AutoResetStatement statement(mStatement_UpdateEntry);
|
||||
|
||||
nsresult rv;
|
||||
rv = statement->BindBlobByIndex(0, rec.metaData, rec.metaDataLen);
|
||||
rv |= statement->BindInt32ByIndex(1, rec.dataSize);
|
||||
rv |= statement->BindInt32ByIndex(2, rec.fetchCount);
|
||||
rv |= statement->BindInt64ByIndex(3, rec.lastFetched);
|
||||
rv |= statement->BindInt64ByIndex(4, rec.lastModified);
|
||||
rv |= statement->BindInt64ByIndex(5, rec.expirationTime);
|
||||
rv |= statement->BindUTF8StringByIndex(6, nsDependentCString(cid));
|
||||
rv |= statement->BindUTF8StringByIndex(7, nsDependentCString(key));
|
||||
rv = statement->BindBlobByIndex(0, rec.metaData, rec.metaDataLen);
|
||||
nsresult tmp = statement->BindInt32ByIndex(1, rec.dataSize);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt32ByIndex(2, rec.fetchCount);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt64ByIndex(3, rec.lastFetched);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt64ByIndex(4, rec.lastModified);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt64ByIndex(5, rec.expirationTime);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindUTF8StringByIndex(6, nsDependentCString(cid));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindUTF8StringByIndex(7, nsDependentCString(key));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasRows;
|
||||
@ -954,10 +975,15 @@ nsOfflineCacheDevice::UpdateEntrySize(nsCacheEntry *entry, PRUint32 newSize)
|
||||
|
||||
AutoResetStatement statement(mStatement_UpdateEntrySize);
|
||||
|
||||
nsresult rv;
|
||||
rv = statement->BindInt32ByIndex(0, newSize);
|
||||
rv |= statement->BindUTF8StringByIndex(1, nsDependentCString(cid));
|
||||
rv |= statement->BindUTF8StringByIndex(2, nsDependentCString(key));
|
||||
nsresult rv = statement->BindInt32ByIndex(0, newSize);
|
||||
nsresult tmp = statement->BindUTF8StringByIndex(1, nsDependentCString(cid));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindUTF8StringByIndex(2, nsDependentCString(key));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasRows;
|
||||
@ -986,10 +1012,10 @@ nsOfflineCacheDevice::DeleteEntry(nsCacheEntry *entry, bool deleteData)
|
||||
|
||||
AutoResetStatement statement(mStatement_DeleteEntry);
|
||||
|
||||
nsresult rv;
|
||||
rv = statement->BindUTF8StringByIndex(0, nsDependentCString(cid));
|
||||
rv |= statement->BindUTF8StringByIndex(1, nsDependentCString(key));
|
||||
nsresult rv = statement->BindUTF8StringByIndex(0, nsDependentCString(cid));
|
||||
nsresult rv2 = statement->BindUTF8StringByIndex(1, nsDependentCString(key));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv2, rv2);
|
||||
|
||||
bool hasRows;
|
||||
rv = statement->ExecuteStep(&hasRows);
|
||||
@ -1351,10 +1377,10 @@ nsOfflineCacheDevice::FindEntry(nsCString *fullKey, bool *collision)
|
||||
|
||||
AutoResetStatement statement(mStatement_FindEntry);
|
||||
|
||||
nsresult rv;
|
||||
rv = statement->BindUTF8StringByIndex(0, nsDependentCString(cid));
|
||||
rv |= statement->BindUTF8StringByIndex(1, nsDependentCString(key));
|
||||
nsresult rv = statement->BindUTF8StringByIndex(0, nsDependentCString(cid));
|
||||
nsresult rv2 = statement->BindUTF8StringByIndex(1, nsDependentCString(key));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv2, nsnull);
|
||||
|
||||
bool hasRows;
|
||||
rv = statement->ExecuteStep(&hasRows);
|
||||
@ -1488,16 +1514,39 @@ nsOfflineCacheDevice::BindEntry(nsCacheEntry *entry)
|
||||
|
||||
AutoResetStatement statement(mStatement_BindEntry);
|
||||
|
||||
nsresult rv;
|
||||
rv = statement->BindUTF8StringByIndex(0, nsDependentCString(rec.clientID));
|
||||
rv |= statement->BindUTF8StringByIndex(1, nsDependentCString(rec.key));
|
||||
rv |= statement->BindBlobByIndex(2, rec.metaData, rec.metaDataLen);
|
||||
rv |= statement->BindInt32ByIndex(3, rec.generation);
|
||||
rv |= statement->BindInt32ByIndex(4, rec.dataSize);
|
||||
rv |= statement->BindInt32ByIndex(5, rec.fetchCount);
|
||||
rv |= statement->BindInt64ByIndex(6, rec.lastFetched);
|
||||
rv |= statement->BindInt64ByIndex(7, rec.lastModified);
|
||||
rv |= statement->BindInt64ByIndex(8, rec.expirationTime);
|
||||
nsresult rv = statement->BindUTF8StringByIndex(0, nsDependentCString(rec.clientID));
|
||||
nsresult tmp = statement->BindUTF8StringByIndex(1, nsDependentCString(rec.key));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindBlobByIndex(2, rec.metaData, rec.metaDataLen);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt32ByIndex(3, rec.generation);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt32ByIndex(4, rec.dataSize);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt32ByIndex(5, rec.fetchCount);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt64ByIndex(6, rec.lastFetched);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt64ByIndex(7, rec.lastModified);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = statement->BindInt64ByIndex(8, rec.expirationTime);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasRows;
|
||||
|
@ -79,7 +79,7 @@ nsHttpDigestAuth::GetMethodAndPath(nsIHttpAuthenticableChannel *authChannel,
|
||||
nsCString &httpMethod,
|
||||
nsCString &path)
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv, rv2;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = authChannel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
@ -94,17 +94,17 @@ nsHttpDigestAuth::GetMethodAndPath(nsIHttpAuthenticableChannel *authChannel,
|
||||
// just call it.)
|
||||
//
|
||||
PRInt32 port;
|
||||
rv = uri->GetAsciiHost(path);
|
||||
rv |= uri->GetPort(&port);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = uri->GetAsciiHost(path);
|
||||
rv2 = uri->GetPort(&port);
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv2)) {
|
||||
path.Append(':');
|
||||
path.AppendInt(port < 0 ? NS_HTTPS_DEFAULT_PORT : port);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rv = authChannel->GetRequestMethod(httpMethod);
|
||||
rv |= uri->GetPath(path);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = authChannel->GetRequestMethod(httpMethod);
|
||||
rv2 = uri->GetPath(path);
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv2)) {
|
||||
//
|
||||
// strip any fragment identifier from the URL path.
|
||||
//
|
||||
|
@ -105,34 +105,70 @@ FileSystemDataSource::Init()
|
||||
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING("NC:FilesRoot"),
|
||||
getter_AddRefs(mNC_FileSystemRoot));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
nsresult tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
getter_AddRefs(mNC_Child));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
getter_AddRefs(mNC_Name));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"),
|
||||
getter_AddRefs(mNC_URL));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Icon"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Icon"),
|
||||
getter_AddRefs(mNC_Icon));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Content-Length"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Content-Length"),
|
||||
getter_AddRefs(mNC_Length));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IsDirectory"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IsDirectory"),
|
||||
getter_AddRefs(mNC_IsDirectory));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastModifiedDate"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastModifiedDate"),
|
||||
getter_AddRefs(mWEB_LastMod));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "FileSystemObject"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "FileSystemObject"),
|
||||
getter_AddRefs(mNC_FileSystemObject));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "pulse"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "pulse"),
|
||||
getter_AddRefs(mNC_pulse));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
|
||||
getter_AddRefs(mRDF_InstanceOf));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
getter_AddRefs(mRDF_type));
|
||||
|
||||
static const PRUnichar kTrue[] = {'t','r','u','e','\0'};
|
||||
static const PRUnichar kFalse[] = {'f','a','l','s','e','\0'};
|
||||
|
||||
rv |= mRDFService->GetLiteral(kTrue, getter_AddRefs(mLiteralTrue));
|
||||
rv |= mRDFService->GetLiteral(kFalse, getter_AddRefs(mLiteralFalse));
|
||||
tmp = mRDFService->GetLiteral(kTrue, getter_AddRefs(mLiteralTrue));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = mRDFService->GetLiteral(kFalse, getter_AddRefs(mLiteralFalse));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
#ifdef USE_NC_EXTENSION
|
||||
@ -144,8 +180,11 @@ FileSystemDataSource::Init()
|
||||
#ifdef XP_WIN
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavorite"),
|
||||
getter_AddRefs(mNC_IEFavoriteObject));
|
||||
rv |= mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavoriteFolder"),
|
||||
tmp = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavoriteFolder"),
|
||||
getter_AddRefs(mNC_IEFavoriteFolder));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
|
@ -170,7 +170,10 @@ nsXREDirProvider::GetUserProfilesRootDir(nsIFile** aResult,
|
||||
rv = file->AppendNative(NS_LITERAL_CSTRING("Profiles"));
|
||||
#endif
|
||||
// We must create the profile directory here if it does not exist.
|
||||
rv |= EnsureDirectoryExists(file);
|
||||
nsresult tmp = EnsureDirectoryExists(file);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
file.swap(*aResult);
|
||||
return rv;
|
||||
@ -192,7 +195,10 @@ nsXREDirProvider::GetUserProfilesLocalDir(nsIFile** aResult,
|
||||
rv = file->AppendNative(NS_LITERAL_CSTRING("Profiles"));
|
||||
#endif
|
||||
// We must create the profile directory here if it does not exist.
|
||||
rv |= EnsureDirectoryExists(file);
|
||||
nsresult tmp = EnsureDirectoryExists(file);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
file.swap(*aResult);
|
||||
return NS_OK;
|
||||
@ -395,8 +401,14 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
|
||||
}
|
||||
else if (!strcmp(aProperty, NS_APP_PREFS_OVERRIDE_DIR)) {
|
||||
rv = mProfileDir->Clone(getter_AddRefs(file));
|
||||
rv |= file->AppendNative(NS_LITERAL_CSTRING(PREF_OVERRIDE_DIRNAME));
|
||||
rv |= EnsureDirectoryExists(file);
|
||||
nsresult tmp = file->AppendNative(NS_LITERAL_CSTRING(PREF_OVERRIDE_DIRNAME));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = EnsureDirectoryExists(file);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (NS_FAILED(rv) || !file)
|
||||
|
Loading…
Reference in New Issue
Block a user