зеркало из https://github.com/mozilla/gecko-dev.git
addon fix to bug 13338.
This commit is contained in:
Родитель
2011d35b0e
Коммит
b104891051
|
@ -507,15 +507,16 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_getDoctype
|
|||
|
||||
nsIDOMDocumentType* docType = nsnull;
|
||||
nsresult rv = doc->GetDoctype(&docType);
|
||||
if (NS_FAILED(rv) || !docType) {
|
||||
if (NS_FAILED(rv)) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.getDoctype: failed", rv);
|
||||
return NULL;
|
||||
}
|
||||
if (!docType)
|
||||
return NULL;
|
||||
|
||||
jobject jDocType = env->AllocObject(JavaDOMGlobals::documentTypeClass);
|
||||
jobject jret = env->AllocObject(JavaDOMGlobals::attrClass);
|
||||
if (!jret) {
|
||||
if (!jDocType) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Document.getDoctype: failed to allocate object");
|
||||
return NULL;
|
||||
|
|
|
@ -246,7 +246,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_ElementImpl_removeAttribute
|
|||
{
|
||||
nsIDOMElement* element = (nsIDOMElement*)
|
||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||
if (!element) {
|
||||
if (!element || !jname) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Element.removeAttribute: NULL pointer");
|
||||
return;
|
||||
|
@ -406,7 +406,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_setAttributeNode
|
|||
|
||||
nsIDOMAttr* ret = nsnull;
|
||||
nsresult rv = element->SetAttributeNode(newAttr, &ret);
|
||||
if (NS_FAILED(rv) || !ret) {
|
||||
if (NS_FAILED(rv)) {
|
||||
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
|
||||
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
|
||||
(rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ||
|
||||
|
@ -418,6 +418,8 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_setAttributeNode
|
|||
"Element.setAttributeNode: failed", rv, exceptionType);
|
||||
return NULL;
|
||||
}
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
jobject jattr = env->AllocObject(JavaDOMGlobals::attrClass);
|
||||
if (!jattr) {
|
||||
|
|
|
@ -64,7 +64,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_getNamedItem
|
|||
{
|
||||
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
|
||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||
if (!map) {
|
||||
if (!map || !jname) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"NodeMap.getNamedItem: NULL pointer");
|
||||
return NULL;
|
||||
|
@ -115,11 +115,13 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_item
|
|||
|
||||
nsIDOMNode* node = nsnull;
|
||||
nsresult rv = map->Item((PRUint32) jindex, &node);
|
||||
if (NS_FAILED(rv) || !node) {
|
||||
if (NS_FAILED(rv)) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"NodeMap.item: failed", rv);
|
||||
return NULL;
|
||||
}
|
||||
if (!node)
|
||||
return NULL;
|
||||
|
||||
return JavaDOMGlobals::CreateNodeSubtype(env, node);
|
||||
}
|
||||
|
@ -134,7 +136,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_removeNamedItem
|
|||
{
|
||||
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
|
||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||
if (!map) {
|
||||
if (!map || !jname) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"NodeMap.removeNamedItem: NULL pointer");
|
||||
return NULL;
|
||||
|
@ -175,7 +177,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_setNamedItem
|
|||
{
|
||||
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
|
||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||
if (!map) {
|
||||
if (!map || !jarg) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"NodeMap.setNamedItem: NULL pointer");
|
||||
return NULL;
|
||||
|
|
|
@ -664,7 +664,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeImpl_insertBefore
|
|||
{
|
||||
nsIDOMNode* node = (nsIDOMNode*)
|
||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||
if (!node || !jnewChild || !jrefChild) {
|
||||
if (!node || !jnewChild) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.insertBefore: NULL pointer");
|
||||
return NULL;
|
||||
|
@ -678,12 +678,15 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeImpl_insertBefore
|
|||
return NULL;
|
||||
}
|
||||
|
||||
nsIDOMNode* refChild = (nsIDOMNode*)
|
||||
env->GetLongField(jrefChild, JavaDOMGlobals::nodePtrFID);
|
||||
if (!refChild) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
nsIDOMNode* refChild = NULL;
|
||||
if (jrefChild) {
|
||||
refChild = (nsIDOMNode*)
|
||||
env->GetLongField(jrefChild, JavaDOMGlobals::nodePtrFID);
|
||||
if (!refChild) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.insertBefore: NULL refChild pointer");
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDOMNode* ret = nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче