gecko-dev/java/dom/jni/org_mozilla_dom_ProcessingInstructionImpl.cpp
edburns%acm.org 0e44edc9ef // replace nsString::Recycle with nsMemory::Free
java/dom/jni/org_mozilla_dom_events_MouseEventImpl.cpp
java/dom/jni/org_mozilla_dom_events_UIEventImpl.cpp
java/dom/jni/org_mozilla_dom_events_EventImpl.cpp
java/dom/jni/org_mozilla_dom_ProcessingInstructionImpl.cpp
java/dom/jni/org_mozilla_dom_NodeImpl.cpp
java/dom/jni/org_mozilla_dom_NamedNodeMapImpl.cpp
java/dom/jni/org_mozilla_dom_ElementImpl.cpp
java/dom/jni/org_mozilla_dom_DOMImplementationImpl.cpp
java/dom/jni/org_mozilla_dom_DocumentImpl.cpp
java/dom/jni/org_mozilla_dom_CharacterDataImpl.cpp
java/dom/jni/org_mozilla_dom_AttrImpl.cpp
java/dom/jni/javaDOMEventsGlobals.cpp

// On*DocumentLoad() now takes an nsIRequest instead of an nsIChannel.
// nsIChannel extends nsIRequest.
java/dom/src/nsJavaDOMImpl.cpp
java/dom/src/nsJavaDOMImpl.h
java/dom/src/nsIJavaDOM.h

// nsIChannel instances replaced with nsIRequest. Removed ShowModal(),
// ExitModalLoop(), FindNamedBrowserItem().  Parameter changes for
// {Set,Get}Persistence().  Add DestroyBrowserWindow(), IsWindowModal().
// supports weak references
java/webclient/src_moz/CBrowserContainer.h
java/webclient/src_moz/CBrowserContainer.cpp

// GetProfileList now returns an array of profile names.  Need to use
// nsIProfileInternal instead of nsIProfile for StartupWithArgs.
java/webclient/src_moz/NativeEventThread.cpp

// Remove -lxpfelocation_s
java/webclient/src_moz/Makefile.in

// Don't include appfilelocprovider_s
java/webclient/src_moz/Makefile.win

// Don't assert thread safe, cause we are thread safe
java/webclient/src_moz/InputStreamShim.cpp
2001-04-02 22:48:33 +00:00

130 lines
3.6 KiB
C++

/*
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Sun Microsystems,
Inc. Portions created by Sun are
Copyright (C) 1999 Sun Microsystems, Inc. All
Rights Reserved.
Contributor(s):
*/
#include "prlog.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsDOMError.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_ProcessingInstructionImpl.h"
/*
* Class: org_mozilla_dom_ProcessingInstructionImpl
* Method: getData
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ProcessingInstructionImpl_getData
(JNIEnv *env, jobject jthis)
{
nsIDOMProcessingInstruction* pi = (nsIDOMProcessingInstruction*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!pi) {
JavaDOMGlobals::ThrowException(env,
"ProcessingInstruction.getData: NULL pointer");
return NULL;
}
nsString ret;
nsresult rv = pi->GetData(ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"ProcessingInstruction.getData: failed", rv);
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"ProcessingInstruction.getData: NewString failed");
return NULL;
}
return jret;
}
/*
* Class: org_mozilla_dom_ProcessingInstructionImpl
* Method: getTarget
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ProcessingInstructionImpl_getTarget
(JNIEnv *env, jobject jthis)
{
nsIDOMProcessingInstruction* pi = (nsIDOMProcessingInstruction*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!pi) {
JavaDOMGlobals::ThrowException(env,
"ProcessingInstruction.getTarget: NULL pointer");
return NULL;
}
nsString ret;
nsresult rv = pi->GetTarget(ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"ProcessingInstruction.getTarget: failed", rv);
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"ProcessingInstruction.getTarget: NewString failed");
return NULL;
}
return jret;
}
/*
* Class: org_mozilla_dom_ProcessingInstructionImpl
* Method: setData
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_ProcessingInstructionImpl_setData
(JNIEnv *env, jobject jthis, jstring jdata)
{
nsIDOMProcessingInstruction* pi = (nsIDOMProcessingInstruction*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!pi || !jdata) {
JavaDOMGlobals::ThrowException(env,
"ProcessingInstruction.setData: NULL pointer");
return;
}
nsString* data = JavaDOMGlobals::GetUnicode(env, jdata);
if (!data)
return;
nsresult rv = pi->SetData(*data);
nsMemory::Free(data);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"ProcessingInstruction.setData: failed", rv, exceptionType);
return;
}
}