Bug 1297300 - Add missing checks to GetSpec() calls in dom/xbl/. r=bz.

--HG--
extra : rebase_source : b7279c4ce02ac111c39dc099652fe0837b98f30b
This commit is contained in:
Nicholas Nethercote 2016-09-08 14:19:01 +10:00
Родитель e4eb76b618
Коммит 5622a00748
5 изменённых файлов: 20 добавлений и 14 удалений

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

@ -513,7 +513,7 @@ nsXBLProtoImpl::Write(nsIObjectOutputStream* aStream,
return aStream->Write8(XBLBinding_Serialize_NoMoreItems);
}
nsresult
void
NS_NewXBLProtoImpl(nsXBLPrototypeBinding* aBinding,
const char16_t* aClassName,
nsXBLProtoImpl** aResult)
@ -523,13 +523,13 @@ NS_NewXBLProtoImpl(nsXBLPrototypeBinding* aBinding,
impl->mClassName = aClassName;
} else {
nsCString spec;
aBinding->BindingURI()->GetSpec(spec);
nsresult rv = aBinding->BindingURI()->GetSpec(spec);
// XXX: should handle this better
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
impl->mClassName = NS_ConvertUTF8toUTF16(spec);
}
aBinding->SetImplementation(impl);
*aResult = impl;
return NS_OK;
}

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

@ -117,7 +117,7 @@ public:
nsXBLProtoImplAnonymousMethod* mDestructor; // Our class destructor.
};
nsresult
void
NS_NewXBLProtoImpl(nsXBLPrototypeBinding* aBinding,
const char16_t* aClassName,
nsXBLProtoImpl** aResult);

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

@ -391,7 +391,10 @@ nsXBLProtoImplField::InstallField(JS::Handle<JSObject*> aBoundNode,
nsAutoMicroTask mt;
nsAutoCString uriSpec;
aBindingDocURI->GetSpec(uriSpec);
nsresult rv = aBindingDocURI->GetSpec(uriSpec);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsIGlobalObject* globalObject = xpc::WindowGlobalOrNull(aBoundNode);
if (!globalObject) {
@ -409,7 +412,7 @@ nsXBLProtoImplField::InstallField(JS::Handle<JSObject*> aBoundNode,
JSAddonId* addonId = MapURIToAddonID(aBindingDocURI);
Element* boundElement = nullptr;
nsresult rv = UNWRAP_OBJECT(Element, aBoundNode, boundElement);
rv = UNWRAP_OBJECT(Element, aBoundNode, boundElement);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

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

@ -1060,8 +1060,10 @@ nsXBLPrototypeBinding::Write(nsIObjectOutputStream* aStream)
// write out the extends and display attribute values
nsAutoCString extends;
ResolveBaseBinding();
if (mBaseBindingURI)
mBaseBindingURI->GetSpec(extends);
if (mBaseBindingURI) {
rv = mBaseBindingURI->GetSpec(extends);
NS_ENSURE_SUCCESS(rv, rv);
}
rv = aStream->WriteStringZ(extends.get());
NS_ENSURE_SUCCESS(rv, rv);

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

@ -356,7 +356,8 @@ nsXBLPrototypeHandler::EnsureEventHandler(AutoJSAPI& jsapi, nsIAtom* aName,
NS_ENSURE_TRUE(scopeObject, NS_ERROR_OUT_OF_MEMORY);
nsAutoCString bindingURI;
mPrototypeBinding->DocURI()->GetSpec(bindingURI);
nsresult rv = mPrototypeBinding->DocURI()->GetSpec(bindingURI);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t argCount;
const char **argNames;
@ -371,7 +372,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(AutoJSAPI& jsapi, nsIAtom* aName,
JS::Rooted<JSObject*> handlerFun(cx);
JS::AutoObjectVector emptyVector(cx);
nsresult rv = nsJSUtils::CompileFunction(jsapi, emptyVector, options,
rv = nsJSUtils::CompileFunction(jsapi, emptyVector, options,
nsAtomCString(aName), argCount,
argNames, handlerText,
handlerFun.address());