зеркало из 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;
|
nsIDOMDocumentType* docType = nsnull;
|
||||||
nsresult rv = doc->GetDoctype(&docType);
|
nsresult rv = doc->GetDoctype(&docType);
|
||||||
if (NS_FAILED(rv) || !docType) {
|
if (NS_FAILED(rv)) {
|
||||||
JavaDOMGlobals::ThrowException(env,
|
JavaDOMGlobals::ThrowException(env,
|
||||||
"Document.getDoctype: failed", rv);
|
"Document.getDoctype: failed", rv);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!docType)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
jobject jDocType = env->AllocObject(JavaDOMGlobals::documentTypeClass);
|
jobject jDocType = env->AllocObject(JavaDOMGlobals::documentTypeClass);
|
||||||
jobject jret = env->AllocObject(JavaDOMGlobals::attrClass);
|
if (!jDocType) {
|
||||||
if (!jret) {
|
|
||||||
JavaDOMGlobals::ThrowException(env,
|
JavaDOMGlobals::ThrowException(env,
|
||||||
"Document.getDoctype: failed to allocate object");
|
"Document.getDoctype: failed to allocate object");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -246,7 +246,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_ElementImpl_removeAttribute
|
||||||
{
|
{
|
||||||
nsIDOMElement* element = (nsIDOMElement*)
|
nsIDOMElement* element = (nsIDOMElement*)
|
||||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||||
if (!element) {
|
if (!element || !jname) {
|
||||||
JavaDOMGlobals::ThrowException(env,
|
JavaDOMGlobals::ThrowException(env,
|
||||||
"Element.removeAttribute: NULL pointer");
|
"Element.removeAttribute: NULL pointer");
|
||||||
return;
|
return;
|
||||||
|
@ -406,7 +406,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_setAttributeNode
|
||||||
|
|
||||||
nsIDOMAttr* ret = nsnull;
|
nsIDOMAttr* ret = nsnull;
|
||||||
nsresult rv = element->SetAttributeNode(newAttr, &ret);
|
nsresult rv = element->SetAttributeNode(newAttr, &ret);
|
||||||
if (NS_FAILED(rv) || !ret) {
|
if (NS_FAILED(rv)) {
|
||||||
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
|
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
|
||||||
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
|
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
|
||||||
(rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ||
|
(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);
|
"Element.setAttributeNode: failed", rv, exceptionType);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!ret)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
jobject jattr = env->AllocObject(JavaDOMGlobals::attrClass);
|
jobject jattr = env->AllocObject(JavaDOMGlobals::attrClass);
|
||||||
if (!jattr) {
|
if (!jattr) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_getNamedItem
|
||||||
{
|
{
|
||||||
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
|
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
|
||||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||||
if (!map) {
|
if (!map || !jname) {
|
||||||
JavaDOMGlobals::ThrowException(env,
|
JavaDOMGlobals::ThrowException(env,
|
||||||
"NodeMap.getNamedItem: NULL pointer");
|
"NodeMap.getNamedItem: NULL pointer");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -115,11 +115,13 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_item
|
||||||
|
|
||||||
nsIDOMNode* node = nsnull;
|
nsIDOMNode* node = nsnull;
|
||||||
nsresult rv = map->Item((PRUint32) jindex, &node);
|
nsresult rv = map->Item((PRUint32) jindex, &node);
|
||||||
if (NS_FAILED(rv) || !node) {
|
if (NS_FAILED(rv)) {
|
||||||
JavaDOMGlobals::ThrowException(env,
|
JavaDOMGlobals::ThrowException(env,
|
||||||
"NodeMap.item: failed", rv);
|
"NodeMap.item: failed", rv);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!node)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return JavaDOMGlobals::CreateNodeSubtype(env, node);
|
return JavaDOMGlobals::CreateNodeSubtype(env, node);
|
||||||
}
|
}
|
||||||
|
@ -134,7 +136,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_removeNamedItem
|
||||||
{
|
{
|
||||||
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
|
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
|
||||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||||
if (!map) {
|
if (!map || !jname) {
|
||||||
JavaDOMGlobals::ThrowException(env,
|
JavaDOMGlobals::ThrowException(env,
|
||||||
"NodeMap.removeNamedItem: NULL pointer");
|
"NodeMap.removeNamedItem: NULL pointer");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -175,7 +177,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_setNamedItem
|
||||||
{
|
{
|
||||||
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
|
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
|
||||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||||
if (!map) {
|
if (!map || !jarg) {
|
||||||
JavaDOMGlobals::ThrowException(env,
|
JavaDOMGlobals::ThrowException(env,
|
||||||
"NodeMap.setNamedItem: NULL pointer");
|
"NodeMap.setNamedItem: NULL pointer");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -664,7 +664,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeImpl_insertBefore
|
||||||
{
|
{
|
||||||
nsIDOMNode* node = (nsIDOMNode*)
|
nsIDOMNode* node = (nsIDOMNode*)
|
||||||
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
|
||||||
if (!node || !jnewChild || !jrefChild) {
|
if (!node || !jnewChild) {
|
||||||
JavaDOMGlobals::ThrowException(env,
|
JavaDOMGlobals::ThrowException(env,
|
||||||
"Node.insertBefore: NULL pointer");
|
"Node.insertBefore: NULL pointer");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -678,12 +678,15 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeImpl_insertBefore
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIDOMNode* refChild = (nsIDOMNode*)
|
nsIDOMNode* refChild = NULL;
|
||||||
env->GetLongField(jrefChild, JavaDOMGlobals::nodePtrFID);
|
if (jrefChild) {
|
||||||
if (!refChild) {
|
refChild = (nsIDOMNode*)
|
||||||
JavaDOMGlobals::ThrowException(env,
|
env->GetLongField(jrefChild, JavaDOMGlobals::nodePtrFID);
|
||||||
|
if (!refChild) {
|
||||||
|
JavaDOMGlobals::ThrowException(env,
|
||||||
"Node.insertBefore: NULL refChild pointer");
|
"Node.insertBefore: NULL refChild pointer");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIDOMNode* ret = nsnull;
|
nsIDOMNode* ret = nsnull;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче