put classes to a single dir

updated makefiles


git-svn-id: svn://10.0.0.236/trunk@64410 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sdv%sparc.spb.su
2000-03-29 00:41:22 +00:00
parent bdf03fd66e
commit aaa4ececa4
43 changed files with 1828 additions and 1449 deletions

View File

@@ -1,42 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
*/
#include "JavaDOMSecurityContext.h"
static NS_DEFINE_IID(kISecurityContextIID, NS_ISECURITYCONTEXT_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
NS_IMPL_ADDREF(JavaDOMSecurityContext);
NS_IMPL_RELEASE(JavaDOMSecurityContext);
JavaDOMSecurityContext::JavaDOMSecurityContext() {
NS_INIT_REFCNT();
}
JavaDOMSecurityContext::~JavaDOMSecurityContext() {
}
NS_METHOD
JavaDOMSecurityContext::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
*aInstancePtr = NULL;
if (aIID.Equals(kISecurityContextIID) ||
aIID.Equals(kISupportsIID)) {
*aInstancePtr = (nsISecurityContext*) this;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_METHOD
JavaDOMSecurityContext::Implies(const char* target, const char* action, PRBool *bAllowedAccess)
{
*bAllowedAccess = PR_TRUE;
return NS_OK;
}

View File

@@ -1,29 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
*/
#include "nsISecurityContext.h"
class JavaDOMSecurityContext : public nsISecurityContext {
public:
////////////////////////////////////////////////////////////////////////////
// from nsISupports
NS_DECL_ISUPPORTS
////////////////////////////////////////////////////////////////////////////
// from nsISecurityContext:
/**
* Get the security context to be used in LiveConnect.
* This is used for JavaScript <--> Java.
*
* @param target -- Possible target.
* @param action -- Possible action on the target.
* @return -- NS_OK if the target and action is permitted on the security context.
* -- NS_FALSE otherwise.
*/
NS_IMETHOD Implies(const char* target, const char* action, PRBool *bAllowedAccess);
JavaDOMSecurityContext();
virtual ~JavaDOMSecurityContext();
};

View File

@@ -1,7 +1,8 @@
# The contents of this file are subject to the Mozilla Public
#!gmake
# The contents of this file are subject to the Netscape 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/
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
@@ -10,56 +11,20 @@
#
# 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
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH = ../..
topsrcdir = $(DEPTH)
DEPTH = ../..
topsrcdir = ../..
VPATH = .
srcdir = .
DIRS = jni
include $(DEPTH)/config/autoconf.mk
JAVAHOME = $(JDKHOME)
MODULE = javadom
LIBRARY_NAME = javadom
IS_COMPONENT = 1
CPPSRCS = \
nsJavaDOMImpl.cpp
include $(topsrcdir)/config/config.mk
ifeq ($(OS_ARCH),Linux)
INCLUDES += -I$(JAVAHOME)/include -I$(JAVAHOME)/include/linux
DSO_LDOPTS += \
-L$(JAVAHOME)/jre/lib/i386 \
-L$(JAVAHOME)/jre/lib/i386/classic \
-L$(JAVAHOME)/jre/lib/i386/native_threads \
-Xlinker -rpath $(JAVAHOME)/jre/lib/i386 \
-Xlinker -rpath $(JAVAHOME)/jre/lib/i386/classic \
-Xlinker -rpath $(JAVAHOME)/jre/lib/i386/native_threads \
-ljvm -lhpi
DEFINES += -DDISABLE_JIT
else
INCLUDES += -I$(JAVAHOME)/include -I$(JAVAHOME)/include/solaris
DSO_LDOPTS += \
-L$(JAVAHOME)/jre/lib/sparc \
-L$(JAVAHOME)/jre/lib/sparc/classic \
-L$(JAVAHOME)/jre/lib/sparc/native_threads \
-R$(JAVAHOME)/jre/lib/sparc \
-R$(JAVAHOME)/jre/lib/sparc/classic \
-R$(JAVAHOME)/jre/lib/sparc/native_threads \
-ljvm -lhpi
endif
EXPORTS = \
nsIJavaDOM.h
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
DIRS = src jni classes
include $(topsrcdir)/config/rules.mk

View File

@@ -1,7 +1,8 @@
# The contents of this file are subject to the Mozilla Public
#!gmake
# The contents of this file are subject to the Netscape 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/
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
@@ -10,56 +11,20 @@
#
# 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
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH = ../..
topsrcdir = $(DEPTH)
srcdir = .
DIRS = jni
DEPTH = ../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
JAVAHOME = $(JDKHOME)
MODULE = javadom
LIBRARY_NAME = javadom
IS_COMPONENT = 1
CPPSRCS = \
nsJavaDOMImpl.cpp
include $(topsrcdir)/config/config.mk
ifeq ($(OS_ARCH),Linux)
INCLUDES += -I$(JAVAHOME)/include -I$(JAVAHOME)/include/linux
DSO_LDOPTS += \
-L$(JAVAHOME)/jre/lib/i386 \
-L$(JAVAHOME)/jre/lib/i386/classic \
-L$(JAVAHOME)/jre/lib/i386/native_threads \
-Xlinker -rpath $(JAVAHOME)/jre/lib/i386 \
-Xlinker -rpath $(JAVAHOME)/jre/lib/i386/classic \
-Xlinker -rpath $(JAVAHOME)/jre/lib/i386/native_threads \
-ljvm -lhpi
DEFINES += -DDISABLE_JIT
else
INCLUDES += -I$(JAVAHOME)/include -I$(JAVAHOME)/include/solaris
DSO_LDOPTS += \
-L$(JAVAHOME)/jre/lib/sparc \
-L$(JAVAHOME)/jre/lib/sparc/classic \
-L$(JAVAHOME)/jre/lib/sparc/native_threads \
-R$(JAVAHOME)/jre/lib/sparc \
-R$(JAVAHOME)/jre/lib/sparc/classic \
-R$(JAVAHOME)/jre/lib/sparc/native_threads \
-ljvm -lhpi
endif
EXPORTS = \
nsIJavaDOM.h
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
DIRS = src jni classes
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,42 @@
#!gmake
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH = ../../..
topsrcdir = ../../..
VPATH = .
srcdir = .
IGNORE_MANIFEST=1
JAVA_OR_NSJVM=1
NO_CAFE=1
JDIRS = org/mozilla/dom \
org/mozilla/dom/events \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
JAVAC_PROG = $(JDKHOME)/bin/javac
JAVAC_FLAGS = -classpath $(CLASSPATH) -d $(JAVA_DESTPATH)
JAVAC = $(JAVAC_PROG) $(JAVAC_FLAGS)

View File

@@ -0,0 +1,41 @@
#!gmake
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH = ../../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
IGNORE_MANIFEST=1
JAVA_OR_NSJVM=1
NO_CAFE=1
JDIRS = org/mozilla/dom \
org/mozilla/dom/events \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
JAVAC_PROG = $(JDKHOME)/bin/javac
JAVAC_FLAGS = -classpath $(CLASSPATH) -d $(JAVA_DESTPATH)
JAVAC = $(JAVAC_PROG) $(JAVAC_FLAGS)

View File

@@ -0,0 +1,38 @@
#
# 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):
IGNORE_MANIFEST=1
DEPTH = ..\..\..
JAVA_OR_NSJVM=1
NO_CAFE=1
include <$(DEPTH)\config\config.mak>
# for compatibility
include <$(DEPTH)\java\config\localdefs.mak>
JDIRS = org\mozilla\dom \
org\mozilla\dom\events \
$(NULL)
JAVAC_PROG=$(JDKHOME)\bin\javac
JAVAC_FLAGS=-classpath $(CLASSPATH) -d $(JAVA_DESTPATH)
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,45 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
public class AttrImpl extends NodeImpl implements Attr {
// instantiated from JNI or Document.createAttribute()
private AttrImpl() {}
public native String getName();
public native boolean getSpecified();
public native String getValue();
public native void setValue(String value);
/**
* The <code>Element</code> node this attribute is attached to or
* <code>null</code> if this attribute is not in use.
* @since DOM Level 2
*/
public Element getOwnerElement() {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,31 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.CDATASection;
public class CDATASectionImpl extends TextImpl implements CDATASection {
// instantiated from JNI or Document.createCDATASection()
private CDATASectionImpl() {}
}

View File

@@ -0,0 +1,39 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.CharacterData;
public class CharacterDataImpl extends NodeImpl implements CharacterData {
// instantiated from JNI only
protected CharacterDataImpl() {}
public native void appendData(String arg);
public native void deleteData(int offset, int count);
public native String getData();
public native int getLength();
public native void insertData(int offset, String arg);
public native void replaceData(int offset, int count, String arg);
public native void setData(String data);
public native String substringData(int offset, int count);
}

View File

@@ -0,0 +1,30 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.Comment;
public class CommentImpl extends CharacterDataImpl implements Comment {
// instantiated from JNI or Document.createComment()
private CommentImpl() {}
}

View File

@@ -0,0 +1,35 @@
/*
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):
*/
package org.mozilla.dom;
public interface DOMAccessor {
public void addDocumentLoadListener(DocumentLoadListener listener);
public void removeDocumentLoadListener(DocumentLoadListener listener);
/**
* The getInstance method is available, it is not declared because
* it is a static method and the Java Language Spec does not allow
* us to declare a static method in an interface.
*
* public static synchronized DOMAccessor getInstance();
*/
}

View File

@@ -0,0 +1,136 @@
/*
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):
*/
package org.mozilla.dom;
import java.util.Vector;
import java.util.Enumeration;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class DOMAccessorImpl implements DOMAccessor, DocumentLoadListener {
private static DOMAccessor instance = null;
private Vector documentLoadListeners = new Vector();
static {
System.loadLibrary("javadomjni");
}
private void DOMAccessorImpl() {}
private static native void register();
private static native void unregister();
private static native Element getElementByHandle(long p);
public static synchronized DOMAccessor getInstance() {
if (instance == null) {
instance = new DOMAccessorImpl();
}
return instance;
}
public synchronized void
addDocumentLoadListener(DocumentLoadListener listener) {
if (documentLoadListeners.size() == 0) {
register();
}
documentLoadListeners.addElement(listener);
}
public synchronized void
removeDocumentLoadListener(DocumentLoadListener listener) {
documentLoadListeners.removeElement(listener);
if (documentLoadListeners.size() == 0) {
unregister();
}
}
public synchronized void
startURLLoad(String url, String contentType, Document doc) {
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.startURLLoad(url, contentType, doc);
}
}
public synchronized void
endURLLoad(String url, int status, Document doc) {
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.endURLLoad(url, status, doc);
}
}
public synchronized void
progressURLLoad(String url, int progress, int progressMax,
Document doc) {
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.progressURLLoad(url, progress, progressMax, doc);
}
}
public synchronized void
statusURLLoad(String url, String message, Document doc) {
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.statusURLLoad(url, message, doc);
}
}
public synchronized void
startDocumentLoad(String url) {
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.startDocumentLoad(url);
}
}
public synchronized void
endDocumentLoad(String url, int status, Document doc) {
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.endDocumentLoad(url, status, doc);
}
}
}

View File

@@ -0,0 +1,32 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.DOMException;
public class DOMExceptionImpl extends DOMException
{
// instantiated from JNI only
private DOMExceptionImpl(short code, String message) {
super(code, message);
}
}

View File

@@ -19,11 +19,10 @@
Contributor(s):
*/
#ifndef __nsJavaDOMCID_h__
#define __nsJavaDOMCID_h__
package org.mozilla.dom;
#define NS_JAVADOMFACTORY_CID \
{0x12c2fa66, 0x0fef, 0x11d3, \
{0x87, 0x14, 0x00, 0x04, 0xac, 0x56, 0xc4, 0xa5}}
public class DOMGarbageCollector {
#endif /* __nsJavaDOMCID_h__ */
// private static native void doGC();
public static native void doGC();
}

View File

@@ -0,0 +1,71 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.DOMException;
public class DOMImplementationImpl implements DOMImplementation {
private long p_nsIDOMDOMImplementation = 0;
// instantiated from JNI only
private DOMImplementationImpl() {}
public boolean equals(Object o) {
if (!(o instanceof NodeListImpl))
return false;
else
return (XPCOM_equals(o));
}
public int hashCode(){
return XPCOM_hashCode();
}
public native boolean hasFeature(String feature, String version);
protected native void finalize();
private native boolean XPCOM_equals(Object o);
private native int XPCOM_hashCode();
//since DOM2
public DocumentType createDocumentType(String qualifiedName, String publicID, String systemID) {
throw new UnsupportedOperationException();
}
public Document createDocument(String namespaceURI,
String qualifiedName,
DocumentType doctype) throws DOMException {
throw new UnsupportedOperationException();
}
public DocumentType createDocumentType(String qualifiedName,
String publicId,
String systemId,
String internalSubset) {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,29 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.DocumentFragment;
public class DocumentFragmentImpl extends NodeImpl implements DocumentFragment {
// instantiated from JNI or Document.createDocumentFragment()
private DocumentFragmentImpl() {}
}

View File

@@ -0,0 +1,89 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
import org.w3c.dom.EntityReference;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.Text;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.events.DocumentEvent;
import org.w3c.dom.events.Event;
import org.w3c.dom.DOMException;
public class DocumentImpl extends NodeImpl implements Document, DocumentEvent {
// instantiated from JNI only
private DocumentImpl() {}
public DocumentImpl(long p) {
super(p);
}
public native Attr createAttribute(String name);
public native CDATASection createCDATASection(String data);
public native Comment createComment(String data);
public native DocumentFragment createDocumentFragment();
public native Element createElement(String tagName);
public native EntityReference createEntityReference(String name);
public native ProcessingInstruction
createProcessingInstruction(String target,
String data);
public native Text createTextNode(String data);
public native DocumentType getDoctype();
public native Element getDocumentElement();
public native NodeList getElementsByTagName(String tagName);
public native DOMImplementation getImplementation();
public Event createEvent(String type) throws DOMException {
throw new UnsupportedOperationException();
}
public Node importNode(Node importedNode, boolean deep) throws DOMException {
throw new UnsupportedOperationException();
}
public Element createElementNS(String namespaceURI, String qualifiedName)
throws DOMException {
throw new UnsupportedOperationException();
}
public Attr createAttributeNS(String namespaceURI, String qualifiedName)
throws DOMException {
throw new UnsupportedOperationException();
}
public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
throw new UnsupportedOperationException();
}
public Element getElementById(String elementId) {
throw new UnsupportedOperationException();
};
}

View File

@@ -0,0 +1,36 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.Document;
public interface DocumentLoadListener {
public void startURLLoad(String url, String contentType, Document doc);
public void endURLLoad(String url, int status, Document doc);
public void progressURLLoad(String url, int progress, int progressMax,
Document doc);
public void statusURLLoad(String url, String message, Document doc);
public void startDocumentLoad(String url);
public void endDocumentLoad(String url, int status, Document doc);
}

View File

@@ -0,0 +1,49 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.DocumentType;
import org.w3c.dom.NamedNodeMap;
public class DocumentTypeImpl extends NodeImpl implements DocumentType {
// instantiated from JNI only
private DocumentTypeImpl() {}
public native String getName();
public native NamedNodeMap getEntities();
public native NamedNodeMap getNotations();
//since DOM level 2
public String getPublicId() {
throw new UnsupportedOperationException();
}
public String getSystemId() {
throw new UnsupportedOperationException();
}
public String getInternalSubset() {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,79 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.DOMException;
public class ElementImpl extends NodeImpl implements Element {
// instantiated from JNI or Document.createElement()
private ElementImpl() {}
public native String getAttribute(String name);
public native Attr getAttributeNode(String name);
public native NodeList getElementsByTagName(String name);
public native String getTagName();
public native void normalize();
public native void removeAttribute(String name);
public native Attr removeAttributeNode(Attr oldAttr);
public native void setAttribute(String name, String value);
public native Attr setAttributeNode(Attr newAttr);
//since DOM2
public String getAttributeNS(String namespaceURI, String localName) {
throw new UnsupportedOperationException();
}
public void setAttributeNS(String namespaceURI, String localName,
String value) throws DOMException {
throw new UnsupportedOperationException();
}
public void removeAttributeNS(String namespacURI, String localName)
throws DOMException {
throw new UnsupportedOperationException();
}
public Attr getAttributeNodeNS(String namespaceURI, String localName) {
throw new UnsupportedOperationException();
}
public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
throw new UnsupportedOperationException();
}
public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
throw new UnsupportedOperationException();
}
public boolean hasAttribute(String name) {
throw new UnsupportedOperationException();
}
public boolean hasAttributeNS(String namespaceURI,
String localName) {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,34 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.Entity;
public class EntityImpl extends NodeImpl implements Entity {
// instantiated from JNI only
private EntityImpl() {}
public native String getPublicId();
public native String getSystemId();
public native String getNotationName();
}

View File

@@ -0,0 +1,30 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.EntityReference;
public class EntityReferenceImpl extends NodeImpl implements EntityReference {
// instantiated from JNI or Document.createEntityReference()
private EntityReferenceImpl() {}
}

View File

@@ -0,0 +1,53 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
public class NamedNodeMapImpl extends NodeImpl implements NamedNodeMap {
// instantiated from JNI only
private NamedNodeMapImpl() {}
public native int getLength();
public native Node getNamedItem(String name);
public native Node item(int index);
public native Node removeNamedItem(String name);
public native Node setNamedItem(Node arg);
public Node getNamedItemNS(String namespaceURI, String localName) {
throw new UnsupportedOperationException();
}
public Node removeNamedItemNS(String namespaceURI, String name)
throws DOMException {
throw new UnsupportedOperationException();
}
public Node setNamedItemNS(Node arg)
throws DOMException {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,233 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.Node;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.NodeList;
import org.w3c.dom.Document;
import org.w3c.dom.DOMException;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventTarget;
import org.w3c.dom.events.EventListener;
import java.util.Vector;
import java.util.Hashtable;
class NodeEventListener {
EventListener listener = null;
String type = null;
boolean useCapture = false;
long nativeListener = 0;
NodeEventListener(String aType, EventListener aListener,
boolean aUseCapture, long aNativeListener) {
type = aType;
listener = aListener;
useCapture = aUseCapture;
nativeListener = aNativeListener;
}
public boolean equals(Object o) {
if (!(o instanceof NodeEventListener))
return false;
else {
NodeEventListener n = (NodeEventListener) o;
if ((useCapture != n.useCapture)
|| (type == null) || !type.equals(n.type)
|| (listener == null) || !listener.equals(n.listener))
return false;
else
return true;
}
}
}
public class NodeImpl implements Node, EventTarget {
/* The derived classes (Attr, CharacterData, DocumentFragment,
Document, Element, EntityReference, NamedNodeMap,
ProcessingInstruction) will also use this native pointer, since
the nsIDOM coreDom classes follow the same hierarchy */
private long p_nsIDOMNode = 0;
// this map stores association of java DOM listeners
// with corresponding native Nodes
static private Hashtable javaDOMlisteners = new Hashtable();
// instantiated from JNI only
protected NodeImpl() {}
protected NodeImpl(long p) {
p_nsIDOMNode = p;
}
public boolean equals(Object o) {
if (!(o instanceof NodeImpl))
return false;
else
return (XPCOM_equals(o));
}
public int hashCode(){
return XPCOM_hashCode();
}
public String toString() {
return "<" + getNodeName() +
" t=" + nodeTypeString(getNodeType()) +
" c=org.mozilla.dom.NodeImpl p=" +
Long.toHexString(p_nsIDOMNode) + ">";
}
private static String nodeTypeString(int type) {
switch (type) {
case Node.ELEMENT_NODE: return "ELEMENT";
case Node.ATTRIBUTE_NODE: return "ATTRIBUTE";
case Node.TEXT_NODE: return "TEXT";
case Node.CDATA_SECTION_NODE: return "CDATA_SECTION";
case Node.ENTITY_REFERENCE_NODE: return "ENTITY_REFERENCE";
case Node.ENTITY_NODE: return "ENTITY";
case Node.PROCESSING_INSTRUCTION_NODE: return "PROCESSING_INSTRUCTION";
case Node.COMMENT_NODE: return "COMMENT";
case Node.DOCUMENT_NODE: return "DOCUMENT";
case Node.DOCUMENT_TYPE_NODE: return "DOCUMENT_TYPE";
case Node.DOCUMENT_FRAGMENT_NODE: return "DOCUMENT_FRAGMENT";
case Node.NOTATION_NODE: return "NOTATION";
}
return "ERROR";
}
public native Node appendChild(Node newChild) throws DOMException;
public native Node cloneNode(boolean deep);
public native NamedNodeMap getAttributes();
public native NodeList getChildNodes();
public native Node getFirstChild();
public native Node getLastChild();
public native Node getNextSibling();
public native String getNodeName();
public native short getNodeType();
public native String getNodeValue();
public native Document getOwnerDocument();
public native Node getParentNode();
public native Node getPreviousSibling();
public native boolean hasChildNodes();
public native Node insertBefore(Node newChild, Node refChild) throws DOMException;
public native Node removeChild(Node oldChild) throws DOMException;
public native Node replaceChild(Node newChild, Node oldChild) throws DOMException;
public native void setNodeValue(String nodeValue);
protected native void finalize();
private native boolean XPCOM_equals(Object o);
private native int XPCOM_hashCode();
//since DOM level 2
public boolean supports(String feature, String version) {
throw new UnsupportedOperationException();
}
public String getNamespaceURI() {
throw new UnsupportedOperationException();
}
public String getPrefix() {
throw new UnsupportedOperationException();
}
public void setPrefix(String prefix) throws DOMException {
throw new UnsupportedOperationException();
}
public String getLocalName() {
throw new UnsupportedOperationException();
}
public void addEventListener(String type,
EventListener listener,
boolean useCapture) {
long nativeListener = addNativeEventListener(type, listener, useCapture);
Long lnode = new Long(p_nsIDOMNode);
Vector listeners;
//in conjunction with internal synchronization of Hashtable and Vector
// this should be enough for safe concurrent access
synchronized (javaDOMlisteners) {
listeners = (Vector) javaDOMlisteners.get(lnode);
if (listeners == null) {
listeners = new Vector();
javaDOMlisteners.put(lnode, listeners);
}
}
if (nativeListener != 0) {
NodeEventListener l = new NodeEventListener(type,
listener,
useCapture,
nativeListener);
listeners.add(l);
}
}
public void removeEventListener(String type,
EventListener listener,
boolean useCapture) {
Vector listeners = (Vector) javaDOMlisteners.get(new Long(p_nsIDOMNode));
if (listeners == null)
return;
NodeEventListener l = new NodeEventListener(type,
listener, useCapture, 0);
int idx = listeners.indexOf(l);
//if trying to remove non-existing listener then return
if (idx == -1)
return;
l = (NodeEventListener) listeners.remove(idx);
removeNativeEventListener(type, l.nativeListener, useCapture);
}
public boolean dispatchEvent(Event evt) throws DOMException {
throw new UnsupportedOperationException();
}
private native long addNativeEventListener(String type,
EventListener listener,
boolean useCapture);
private native void removeNativeEventListener(String type,
long nativeListener,
boolean useCapture);
public void normalize() {
throw new UnsupportedOperationException();
};
}

View File

@@ -0,0 +1,52 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class NodeListImpl implements NodeList {
private long p_nsIDOMNodeList = 0;
// instantiated from JNI or Document.createAttribute()
private NodeListImpl() {}
public boolean equals(Object o) {
if (!(o instanceof NodeListImpl))
return false;
else
return (XPCOM_equals(o));
}
public int hashCode(){
return XPCOM_hashCode();
}
public native int getLength();
public native Node item(int index);
protected native void finalize();
private native boolean XPCOM_equals(Object o);
private native int XPCOM_hashCode();
}

View File

@@ -0,0 +1,33 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.Notation;
public class NotationImpl extends NodeImpl implements Notation {
// instantiated from JNI only
private NotationImpl() {}
public native String getPublicId();
public native String getSystemId();
}

View File

@@ -0,0 +1,34 @@
/*
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):
*/
package org.mozilla.dom;
import org.w3c.dom.ProcessingInstruction;
public class ProcessingInstructionImpl extends NodeImpl implements ProcessingInstruction {
// instantiated from JNI or Document.createProcessingInstruction()
private ProcessingInstructionImpl() {}
public native String getData();
public native String getTarget();
public native void setData(String data);
}

View File

@@ -19,27 +19,15 @@
Contributor(s):
*/
#ifndef __nsJavaDOMFactory_h__
#define __nsJavaDOMFactory_h__
package org.mozilla.dom;
#include "nsIFactory.h"
import org.w3c.dom.Text;
#define NS_JAVADOMFACTORY_IID \
{0x6a07c434, 0x0e58, 0x11d3, \
{0x86, 0xea, 0x00, 0x04, 0xac, 0x56, 0xc4, 0xa5}}
public class TextImpl extends CharacterDataImpl implements Text {
class nsJavaDOMFactory : public nsIFactory {
NS_DECL_ISUPPORTS
// instantiated from JNI or Document.createTextNode()
protected TextImpl() {}
public:
public native Text splitText(int offset);
}
nsJavaDOMFactory();
NS_IMETHOD CreateInstance(nsISupports* aOuter,
const nsIID& iid,
void** retval);
NS_IMETHOD LockFactory(PRBool lock);
};
#endif /* __nsJavaDOMFactory_h__ */

View File

@@ -0,0 +1,162 @@
/*
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):
*/
package org.mozilla.dom.events;
import org.w3c.dom.Node;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventTarget;
/**
* The <code>Event</code> interface is used to provide contextual information
* about an event to the handler processing the event. An object which
* implements the <code>Event</code> interface is generally passed as the
* first parameter to an event handler. More specific context information
* is passed to event handlers by deriving additional interfaces from
* <code>Event</code> which contain information directly relating to the type
* of event they accompany. These derived interfaces are also implemented by
* the object passed to the event listener.
* @since DOM Level 2
*/
public class EventImpl implements Event {
protected long p_nsIDOMEvent = 0;
// instantiated from JNI only
protected EventImpl() {}
public String toString() {
return "<c=org.mozilla.dom.events.Event type=" + getType() +
" target=" + getTarget() +
" phase=" + getEventPhase() +
" p=" + Long.toHexString(p_nsIDOMEvent) + ">";
}
/**
* The <code>type</code> property represents the event name as a string
* property.
*/
public native String getType();
/**
* The <code>target</code> property indicates the <code>EventTarget</code>
* to which the event was originally dispatched.
*/
public native EventTarget getTarget();
/**
* The <code>currentNode</code> property indicates the <code>Node</code>
* whose <code>EventListener</code>s are currently being processed. This
* is particularly useful during capturing and bubbling.
*/
public native Node getCurrentNode();
/**
* The <code>eventPhase</code> property indicates which phase of event flow
* is currently being evaluated.
*/
public native short getEventPhase();
/**
* The <code>bubbles</code> property indicates whether or not an event is a
* bubbling event. If the event can bubble the value is true, else the
* value is false.
*/
public boolean getBubbles() {
throw new UnsupportedOperationException();
}
/**
* The <code>cancelable</code> property indicates whether or not an event
* can have its default action prevented. If the default action can be
* prevented the value is true, else the value is false.
*/
public boolean getCancelable() {
throw new UnsupportedOperationException();
}
/**
* The <code>preventBubble</code> method is used to end the bubbling phase
* of event flow. If this method is called by any
* <code>EventListener</code>s registered on the same
* <code>EventTarget</code> during bubbling, the bubbling phase will cease
* at that level and the event will not be propagated upward within the
* tree.
*/
public native void preventBubble();
/**
* The <code>preventCapture</code> method is used to end the capturing phase
* of event flow. If this method is called by any
* <code>EventListener</code>s registered on the same
* <code>EventTarget</code> during capturing, the capturing phase will
* cease at that level and the event will not be propagated any further
* down.
*/
public native void preventCapture();
/**
* If an event is cancelable, the <code>preventCapture</code> method is used
* to signify that the event is to be canceled, meaning any default action
* normally taken by the implementation as a result of the event will not
* occur. If, during any stage of event flow, the
* <code>preventDefault</code> method is called the event is canceled. Any
* default action associated with the event will not occur. Calling this
* method for a non-cancelable event has no effect. Once
* <code>preventDefault</code> has been called it will remain in effect
* throughout the remainder of the event's propagation.
*/
public native void preventDefault();
/**
* The <code>stopPropagation</code> method is used prevent further
* propagation of an event during event flow. If this method is called by
* any <code>EventListener</code> the event will cease propagating
* through the tree. The event will complete dispatch to all listeners
* on the current <code>EventTarget</code> before event flow stops. This
* method may be used during any stage of event flow.
*/
public void stopPropagation() {
throw new UnsupportedOperationException();
}
/**
*
* @param eventTypeArg Specifies the event type. This type may be any event
* type currently defined in this specification or a new event type. Any
* new event type must not begin with any upper, lower, or mixed case
* version of the string "DOM". This prefix is reserved for future DOM
* event sets.
* @param canBubbleArg Specifies whether or not the event can bubble.
* @param cancelableArg Specifies whether or not the event's default action
* can be prevented.
*/
public void initEvent(String eventTypeArg,
boolean canBubbleArg,
boolean cancelableArg) {
throw new UnsupportedOperationException();
}
public long getTimeStamp() {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,163 @@
/*
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):
*/
package org.mozilla.dom.events;
import org.w3c.dom.Node;
import org.w3c.dom.views.AbstractView;
import org.w3c.dom.events.MouseEvent;
/**
* The <code>MouseEvent</code> interface provides specific contextual
* information associated with Mouse events.
* <p>The <code>detail</code> attribute inherited from <code>UIEvent</code>
* indicates the number of times a mouse button has been pressed and released
* over the same screen location during a user action. The attribute value
* is 1 when the user begins this action and increments by 1 for each full
* sequence of pressing and releasing. If the user moves the mouse between
* the mousedown and mouseup the value will be set to 0, indicating that no
* click is occurring.
* @since DOM Level 2
*/
public class MouseEventImpl extends UIEventImpl implements MouseEvent {
// instantiated from JNI only
private MouseEventImpl() {}
public String toString() {
return "<c=org.mozilla.dom.events.mouseUIEvent type=" + getType() +
" screen=(" + getScreenX() + "," + getScreenY() + ")" +
" client=(" + getClientX() + "," + getClientY() + ")" +
" mods=(" + getCtrlKey() + "," + getMetaKey() + "," + getShiftKey() + "," + getAltKey() + ")" +
" button=" + getButton() +
" target=" + getTarget() +
" phase=" + getEventPhase() +
" p=" + Long.toHexString(p_nsIDOMEvent) + ">";
}
/**
* <code>screenX</code> indicates the horizontal coordinate at which the
* event occurred in relative to the origin of the screen coordinate system.
*/
public native int getScreenX();
/**
* <code>screenY</code> indicates the vertical coordinate at which the event
* occurred relative to the origin of the screen coordinate system.
*/
public native int getScreenY();
/**
* <code>clientX</code> indicates the horizontal coordinate at which the
* event occurred relative to the DOM implementation's client area.
*/
public native int getClientX();
/**
* <code>clientY</code> indicates the vertical coordinate at which the event
* occurred relative to the DOM implementation's client area.
*/
public native int getClientY();
/**
* <code>ctrlKey</code> indicates whether the 'ctrl' key was depressed
* during the firing of the event.
*/
public native boolean getCtrlKey();
/**
* <code>shiftKey</code> indicates whether the 'shift' key was depressed
* during the firing of the event.
*/
public native boolean getShiftKey();
/**
* <code>altKey</code> indicates whether the 'alt' key was depressed during
* the firing of the event. On some platforms this key may map to an
* alternative key name.
*/
public native boolean getAltKey();
/**
* <code>metaKey</code> indicates whether the 'meta' key was depressed
* during the firing of the event. On some platforms this key may map to
* an alternative key name.
*/
public native boolean getMetaKey();
/**
* During mouse events caused by the depression or release of a mouse
* button, <code>button</code> is used to indicate which mouse button
* changed state.
*/
public native short getButton();
/**
* <code>relatedNode</code> is used to identify a secondary node related to
* a UI event.
*/
public Node getRelatedNode() {
throw new UnsupportedOperationException();
}
/**
*
* @param typeArg Specifies the event type.
* @param canBubbleArg Specifies whether or not the event can bubble.
* @param cancelableArg Specifies whether or not the event's default action
* can be prevent.
* @param viewArg Specifies the <code>Event</code>'s
* <code>AbstractView</code>.
* @param detailArg Specifies the <code>Event</code>'s mouse click count.
* @param screenXArg Specifies the <code>Event</code>'s screen x coordinate
* @param screenYArg Specifies the <code>Event</code>'s screen y coordinate
* @param clientXArg Specifies the <code>Event</code>'s client x coordinate
* @param clientYArg Specifies the <code>Event</code>'s client y coordinate
* @param ctrlKeyArg Specifies whether or not control key was depressed
* during the <code>Event</code>.
* @param altKeyArg Specifies whether or not alt key was depressed during
* the <code>Event</code>.
* @param shiftKeyArg Specifies whether or not shift key was depressed
* during the <code>Event</code>.
* @param metaKeyArg Specifies whether or not meta key was depressed during
* the <code>Event</code>.
* @param buttonArg Specifies the <code>Event</code>'s mouse button.
* @param relatedNodeArg Specifies the <code>Event</code>'s related Node.
*/
public void initMouseEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
int detailArg,
int screenXArg,
int screenYArg,
int clientXArg,
int clientYArg,
boolean ctrlKeyArg,
boolean altKeyArg,
boolean shiftKeyArg,
boolean metaKeyArg,
short buttonArg,
Node relatedNodeArg) {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,89 @@
/*
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):
*/
package org.mozilla.dom.events;
import org.w3c.dom.Node;
import org.w3c.dom.events.MutationEvent;
import org.mozilla.dom.events.EventImpl;
public class MutationEventImpl extends EventImpl implements MutationEvent {
/**
* <code>relatedNode</code> is used to identify a secondary node related to
* a mutation event. For example, if a mutation event is dispatched to a
* node indicating that its parent has changed, the <code>relatedNode</code>
* is the changed parent. If an event is instead dispatch to a subtree
* indicating a node was changed within it, the <code>relatedNode</code> is
* the changed node.
*/
public Node getRelatedNode() {
throw new UnsupportedOperationException();
}
/**
* <code>prevValue</code> indicates the previous value of text nodes and
* attributes in attrModified and charDataModified events.
*/
public String getPrevValue() {
throw new UnsupportedOperationException();
}
/**
* <code>newValue</code> indicates the new value of text nodes and
* attributes in attrModified and charDataModified events.
*/
public String getNewValue() {
throw new UnsupportedOperationException();
}
/**
* <code>attrName</code> indicates the changed attr in the attrModified
* event.
*/
public String getAttrName() {
throw new UnsupportedOperationException();
}
/**
*
* @param typeArg Specifies the event type.
* @param canBubbleArg Specifies whether or not the event can bubble.
* @param cancelableArg Specifies whether or not the event's default action
* can be prevent.
* @param relatedNodeArg Specifies the <code>Event</code>'s related Node
* @param prevValueArg Specifies the <code>Event</code>'s
* <code>prevValue</code> property
* @param newValueArg Specifies the <code>Event</code>'s
* <code>newValue</code> property
* @param attrNameArg Specifies the <code>Event</code>'s
* <code>attrName</code> property
*/
public void initMutationEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
Node relatedNodeArg,
String prevValueArg,
String newValueArg,
String attrNameArg) {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,80 @@
/*
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):
*/
package org.mozilla.dom.events;
import org.w3c.dom.events.UIEvent;
import org.w3c.dom.views.AbstractView;
import org.mozilla.dom.events.EventImpl;
/**
* The <code>UIEvent</code> interface provides specific contextual
* information associated with User Interface events.
* @since DOM Level 2
*/
public class UIEventImpl extends EventImpl implements UIEvent {
// instantiated from JNI only
protected UIEventImpl() {}
public String toString() {
return "<c=org.mozilla.dom.events.UIEvent type=" + getType() +
" target=" + getTarget() +
" phase=" + getEventPhase() +
" p=" + Long.toHexString(p_nsIDOMEvent) + ">";
}
/**
* The <code>view</code> attribute identifies the <code>AbstractView</code>
* from which the event was generated.
*/
public AbstractView getView() {
throw new UnsupportedOperationException();
}
/**
* Specifies some detail information about the <code>Event</code>, depending
* on the type of event.
*/
public int getDetail() {
throw new UnsupportedOperationException();
}
/**
*
* @param typeArg Specifies the event type.
* @param canBubbleArg Specifies whether or not the event can bubble.
* @param cancelableArg Specifies whether or not the event's default action
* can be prevent.
* @param viewArg Specifies the <code>Event</code>'s
* <code>AbstractView</code>.
* @param detailArg Specifies the <code>Event</code>'s detail.
*/
public void initUIEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
int detailArg) {
throw new UnsupportedOperationException();
}
}

View File

@@ -55,10 +55,3 @@ include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk
libs:: classes
#XXX - assume that DOM2 java-bindings are in CLASSPATH
classes: $(JAVA_DESTPATH)
@echo "Making java classes ..."
$(JAVAHOME)/bin/javac -d $(JAVA_DESTPATH) *.java

View File

@@ -56,10 +56,3 @@ include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk
libs:: classes
#XXX - assume that DOM2 java-bindings are in CLASSPATH
classes: $(JAVA_DESTPATH)
@echo "Making java classes ..."
$(JAVAHOME)/bin/javac -d $(JAVA_DESTPATH) *.java

View File

@@ -93,13 +93,6 @@ LLIBS= \
include <$(DEPTH)\config\config.mak>
include <$(DEPTH)\config\rules.mak>
export:: classes
#XXX - assume that DOM2 java-bindings are in CLASSPATH
classes:
@echo "Making java classes ..."
$(JDKHOME)\bin\javac -d $(JAVA_DESTPATH) *.java
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib

View File

@@ -1,5 +1,4 @@
#!nmake
#
#
# 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
@@ -19,67 +18,15 @@
#
# Contributor(s):
DEPTH=..\..
IGNORE_MANIFEST=1
DIRS = jni
IGNORE_MANIFEST=1
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH = ..\..
DEFINES=-D_IMPL_NS_WEB -DWIN32_LEAN_AND_MEAN
!ifdef JAVA_DOM_OJI_ENABLE
DEFINES=$(DEFINES) -DJAVA_DOM_OJI_ENABLE
!endif
MODULE=javadom
IS_COMPONENT=1
LIBRARY_NAME=libjavadom
CPPSRCS= \
!ifdef JAVA_DOM_OJI_ENABLE
JavaDOMSecurityContext.cpp \
!endif
nsJavaDOMImpl.cpp \
$(NULL)
CPP_OBJS= \
!ifdef JAVA_DOM_OJI_ENABLE
.\$(OBJDIR)\JavaDOMSecurityContext.obj \
!endif
.\$(OBJDIR)\nsJavaDOMImpl.obj \
$(NULL)
EXPORTS = \
nsIJavaDOM.h
!ifndef JAVA_DOM_OJI_ENABLE
LINCS= \
-I$(JDKHOME)\include \
-I$(JDKHOME)\include\win32
!endif
MAKE_OBJ_TYPE = DLL
DLLNAME = javadom
DLL=.\$(OBJDIR)\$(DLLNAME).dll
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
LLIBS= \
!ifdef JAVA_DOM_OJI_ENABLE
$(DIST)\lib\oji.lib \
!else
$(JDKHOME)\lib\jvm.lib \
!endif
$(DIST)\lib\xpcom.lib \
$(LIBNSPR)
include <$(DEPTH)\config\config.mak>
DIRS = src jni classes
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\components\$(DLLNAME).dll
rm -f $(DIST)\lib\$(DLLNAME).lib

View File

@@ -1,78 +0,0 @@
/*
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):
*/
#ifndef __nsIJavaDOM_h__
#define __nsIJavaDOM_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIDocumentLoaderObserver.h"
#include "jni.h"
class nsIURI;
/* {9cc0ca50-0e31-11d3-8a61-0004ac56c4a5} */
#define NS_IJAVADOM_IID_STR "9cc0ca50-0e31-11d3-8a61-0004ac56c4a5"
#define NS_IJAVADOM_IID \
{0x9cc0ca50, 0x0e31, 0x11d3, \
{ 0x8a, 0x61, 0x00, 0x04, 0xac, 0x56, 0xc4, 0xa5 }}
#define NS_JAVADOM_CID \
{0xd6b2e820, 0x9113, 0x11d3, \
{ 0x9c, 0x11, 0x0, 0x10, 0x5a , 0xe3, 0x80 , 0x1e }}
class nsIJavaDOM : public nsIDocumentLoaderObserver {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IJAVADOM_IID)
/* nsIDocumentLoaderObserver methods */
NS_IMETHOD OnStartDocumentLoad(nsIDocumentLoader* loader,
nsIURI* aURL,
const char* aCommand) = 0;
NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus) = 0;
NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel) = 0;
NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
PRUint32 aProgress,
PRUint32 aProgressMax) = 0;
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsString& aMsg) = 0;
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus) = 0;
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader,
nsIChannel* channel,
const char *aContentType,
const char *aCommand) = 0;
};
extern nsresult
NS_NewJavaDOM(nsIJavaDOM** aJavaDOM);
#endif /* __nsIJavaDOM_h__ */

View File

@@ -1,147 +0,0 @@
/*
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 "pratom.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsJavaDOMCID.h"
#include "nsJavaDOMImpl.h"
#include "nsJavaDOMFactory.h"
static PRInt32 gLockCount = 0;
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_IID(kJavaDOMFactoryCID, NS_JAVADOMFACTORY_CID);
static NS_DEFINE_IID(kJavaDOMFactoryIID, NS_JAVADOMFACTORY_IID);
NS_IMPL_ISUPPORTS(nsJavaDOMFactory, kJavaDOMFactoryIID)
nsJavaDOMFactory::nsJavaDOMFactory()
{
NS_INIT_REFCNT();
}
nsresult nsJavaDOMFactory::CreateInstance(nsISupports* aOuter,
const nsIID& aIID,
void** aResult)
{
if (aOuter != NULL)
return NS_ERROR_NO_AGGREGATION;
if (aResult == NULL)
return NS_ERROR_NULL_POINTER;
*aResult = NULL;
nsISupports* inst = new nsJavaDOMImpl();
if (inst == NULL)
return NS_ERROR_OUT_OF_MEMORY;
nsresult res = inst->QueryInterface(aIID, aResult);
if (NS_FAILED(res))
delete inst;
return res;
}
nsresult nsJavaDOMFactory::LockFactory(PRBool aLock)
{
if (aLock)
PR_AtomicIncrement(&gLockCount);
else
PR_AtomicDecrement(&gLockCount);
return NS_OK;
}
extern "C"
NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
const nsCID& aClass,
const char* aClassName,
const char* aProgID,
nsIFactory** aFactory)
{
if (aFactory == NULL)
return NS_ERROR_NULL_POINTER;
*aFactory = NULL;
nsISupports *inst = NULL;
static NS_DEFINE_IID(kJavaDOMFactoryCID, NS_JAVADOMFACTORY_CID);
if (aClass.Equals(kJavaDOMFactoryCID))
inst = new nsJavaDOMFactory();
else
return NS_ERROR_ILLEGAL_VALUE;
if (inst == NULL)
return NS_ERROR_OUT_OF_MEMORY;
nsresult res = inst->QueryInterface(kJavaDOMFactoryIID,
(void**) aFactory);
if (res != NS_OK)
delete inst;
return res;
}
extern "C"
NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr)
{
return (PRBool) (gLockCount == 0);
}
extern "C"
NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char* aPath)
{
nsresult rv;
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv))
return rv;
nsIComponentManager* cm = nsnull;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&cm);
if (NS_FAILED(rv))
return rv;
rv = cm->RegisterComponent(kJavaDOMFactoryCID, NULL, NULL,
aPath, PR_TRUE, PR_TRUE);
return rv;
}
extern "C"
NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
{
nsresult rv;
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv))
return rv;
nsIComponentManager* cm = nsnull;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&cm);
if (NS_FAILED(rv))
return rv;
rv = cm->UnregisterComponent(kJavaDOMFactoryCID, aPath);
return rv;
}

View File

@@ -1,744 +0,0 @@
/*
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 "prenv.h"
#include "nsISupportsUtils.h"
#include "nsIURL.h"
#include "nsIChannel.h"
#include "nsIDocument.h"
#include "nsIDocumentLoader.h"
#include "nsIDocumentLoaderObserver.h"
#include "nsIDocumentViewer.h"
#include "nsIDOMDocument.h"
#include "nsIDocShell.h"
#include "nsJavaDOMImpl.h"
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#ifdef JAVA_DOM_OJI_ENABLE
#include "ProxyJNI.h"
#include "nsIServiceManager.h"
#endif
#if defined(DEBUG)
#include <stdio.h>
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNamedNodeMap.h"
static void dump_document(nsIDOMDocument* dom, const char* urlSpec);
static void dump_node(FILE* of, nsIDOMNode* node, int indent,
PRBool isMapNode);
static void dump_map(FILE* of, nsIDOMNamedNodeMap* map, int indent);
static char* strip_whitespace(const PRUnichar* input, int length);
static const char* describe_type(int type);
#endif
#ifdef JAVA_DOM_OJI_ENABLE
static NS_DEFINE_CID(kJVMManagerCID,NS_JVMMANAGER_CID);
#endif
static NS_DEFINE_IID(kIDocShellIID, NS_IDOCSHELL_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIJavaDOMIID, NS_IJAVADOM_IID);
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
static NS_DEFINE_IID(kIDocumentLoaderObserverIID, NS_IDOCUMENT_LOADER_OBSERVER_IID);
NS_IMPL_ADDREF(nsJavaDOMImpl);
NS_IMPL_RELEASE(nsJavaDOMImpl);
#define NS_JAVADOM_PROGID \
"component://netscape/blackwood/java-dom"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJavaDOMImpl)
static nsModuleComponentInfo components[] =
{
{
"Java DOM",
NS_JAVADOM_CID,
NS_JAVADOM_PROGID,
nsJavaDOMImplConstructor
}
};
NS_IMPL_NSGETMODULE("JavaDOMModule",components);
NS_IMETHODIMP nsJavaDOMImpl::QueryInterface(REFNSIID aIID, void** aInstance)
{
if (NULL == aInstance)
return NS_ERROR_NULL_POINTER;
*aInstance = NULL;
if (aIID.Equals(kIJavaDOMIID)) {
*aInstance = (void*) ((nsIJavaDOM*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIDocumentLoaderObserverIID)) {
*aInstance = (void*) ((nsIDocumentLoaderObserver*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstance = (void*) ((nsISupports*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
#ifdef JAVA_DOM_OJI_ENABLE
nsJVMManager* nsJavaDOMImpl::jvmManager = NULL;
JavaDOMSecurityContext* nsJavaDOMImpl::securityContext = NULL;
#else
JavaVM* nsJavaDOMImpl::jvm = NULL;
#endif
jclass nsJavaDOMImpl::domAccessorClass = NULL;
jclass nsJavaDOMImpl::documentClass = NULL;
jclass nsJavaDOMImpl::listenerClass = NULL;
jclass nsJavaDOMImpl::gcClass = NULL;
jobject nsJavaDOMImpl::docListener = NULL;
jfieldID nsJavaDOMImpl::documentPtrFID = NULL;
jmethodID nsJavaDOMImpl::documentInitID = NULL;
jmethodID nsJavaDOMImpl::getInstanceMID = NULL;
jmethodID nsJavaDOMImpl::startURLLoadMID = NULL;
jmethodID nsJavaDOMImpl::endURLLoadMID = NULL;
jmethodID nsJavaDOMImpl::progressURLLoadMID = NULL;
jmethodID nsJavaDOMImpl::statusURLLoadMID = NULL;
jmethodID nsJavaDOMImpl::startDocumentLoadMID = NULL;
jmethodID nsJavaDOMImpl::endDocumentLoadMID = NULL;
jmethodID nsJavaDOMImpl::gcMID = NULL;
nsJavaDOMImpl::nsJavaDOMImpl()
{
NS_INIT_ISUPPORTS();
JNIEnv* env = GetJNIEnv();
gcClass = env->FindClass("org/mozilla/dom/DOMGarbageCollector");
if (!gcClass) return;
gcClass = (jclass) env->NewGlobalRef(gcClass);
if (!gcClass) return;
gcMID =
env->GetStaticMethodID(gcClass,
"doGC",
"()V");
if (!gcMID) return;
domAccessorClass = env->FindClass("org/mozilla/dom/DOMAccessorImpl");
if (!domAccessorClass) return;
domAccessorClass = (jclass) env->NewGlobalRef(domAccessorClass);
if (!domAccessorClass) return;
getInstanceMID =
env->GetStaticMethodID(domAccessorClass,
"getInstance",
"()Lorg/mozilla/dom/DOMAccessor;");
if (!getInstanceMID) return;
docListener =
env->CallStaticObjectMethod(domAccessorClass, getInstanceMID);
if (!docListener) return;
docListener = (jclass) env->NewGlobalRef(docListener);
if (!docListener) return;
listenerClass =
env->GetObjectClass(docListener);
if (!listenerClass) return;
listenerClass = (jclass) env->NewGlobalRef(listenerClass);
if (!listenerClass) return;
documentClass =
env->FindClass("org/mozilla/dom/DocumentImpl");
if (!documentClass) return;
documentClass = (jclass) env->NewGlobalRef(documentClass);
if (!documentClass) return;
documentInitID =
env->GetMethodID(documentClass, "<init>", "(J)V");
if (!documentInitID) return;
documentPtrFID =
env->GetFieldID(documentClass,
"p_nsIDOMNode",
"J");
if (!documentPtrFID) return;
startURLLoadMID =
env->GetMethodID(listenerClass,
"startURLLoad",
"(Ljava/lang/String;Ljava/lang/String;Lorg/w3c/dom/Document;)V");
if (!startURLLoadMID) return;
endURLLoadMID =
env->GetMethodID(listenerClass,
"endURLLoad",
"(Ljava/lang/String;ILorg/w3c/dom/Document;)V");
if (!endURLLoadMID) return;
progressURLLoadMID =
env->GetMethodID(listenerClass,
"progressURLLoad",
"(Ljava/lang/String;IILorg/w3c/dom/Document;)V");
if (!progressURLLoadMID) return;
statusURLLoadMID =
env->GetMethodID(listenerClass,
"statusURLLoad",
"(Ljava/lang/String;Ljava/lang/String;Lorg/w3c/dom/Document;)V");
if (!statusURLLoadMID) return;
startDocumentLoadMID =
env->GetMethodID(listenerClass,
"startDocumentLoad",
"(Ljava/lang/String;)V");
if (!startDocumentLoadMID) return;
endDocumentLoadMID =
env->GetMethodID(listenerClass,
"endDocumentLoad",
"(Ljava/lang/String;ILorg/w3c/dom/Document;)V");
if (!endDocumentLoadMID) return;
Cleanup(env);
}
nsJavaDOMImpl::~nsJavaDOMImpl()
{
}
PRBool nsJavaDOMImpl::Cleanup(JNIEnv* env)
{
if (env->ExceptionOccurred()) {
env->ExceptionDescribe();
return PR_TRUE;
}
return PR_FALSE;
}
nsIDOMDocument* nsJavaDOMImpl::GetDocument(nsIDocumentLoader* loader)
{
nsIDocShell* docshell = nsnull;
nsISupports* container = nsnull;
nsIContentViewer* contentv = nsnull;
nsIDocumentViewer* docv = nsnull;
nsIDocument* document = nsnull;
nsIDOMDocument* domDoc = nsnull;
nsresult rv = loader->GetContainer(&container);
if (NS_SUCCEEDED(rv) && container)
rv = container->QueryInterface(kIDocShellIID, (void**) &docshell);
if (NS_SUCCEEDED(rv) && docshell)
rv = docshell->GetContentViewer(&contentv);
if (NS_SUCCEEDED(rv) && contentv) {
rv = contentv->QueryInterface(kIDocumentViewerIID,
(void**) &docv);
if (NS_SUCCEEDED(rv) && docv) {
docv->GetDocument(document);
rv = document->QueryInterface(kIDOMDocumentIID,
(void**) &domDoc);
if (NS_SUCCEEDED(rv) && docv) {
return domDoc;
}
}
}
fprintf(stderr,
"nsJavaDOMImpl::GetDocument: failed: "
"container=%x, webshell=%x, contentViewer=%x, "
"documentViewer=%x, document=%x, "
"domDocument=%x, error=%x\n",
(unsigned) (void*) container,
(unsigned) (void*) docshell,
(unsigned) (void*) contentv,
(unsigned) (void*) docv,
(unsigned) (void*) document,
(unsigned) (void*) domDoc,
rv);
return NULL;
}
// convert nsIDOMDocument to org.mozilla.dom.DocumentImpl
jobject nsJavaDOMImpl::CaffienateDOMDocument(nsIDOMDocument* domDoc)
{
if (!domDoc) return NULL;
JNIEnv* env = GetJNIEnv();
// jobject jdoc = env->AllocObject(documentClass);
jobject jdoc = env->NewObject(documentClass,
documentInitID,
(jlong) (void*) domDoc);
if (!jdoc) return NULL;
// env->SetLongField(jdoc, documentPtrFID, (jlong) (void*) domDoc);
if (Cleanup(env) == PR_TRUE) return NULL;
return jdoc;
}
/* nsIDocumentLoaderObserver methods */
NS_IMETHODIMP nsJavaDOMImpl::OnStartDocumentLoad(nsIDocumentLoader* loader,
nsIURI* aURL,
const char* aCommand)
{
JNIEnv* env = GetJNIEnv();
char* urlSpec = (char*) "";
if (aURL)
aURL->GetSpec(&urlSpec);
jstring jURL = env->NewStringUTF(urlSpec);
if (!jURL) return NS_ERROR_FAILURE;
env->CallVoidMethod(docListener,
startDocumentLoadMID,
jURL);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
env->CallStaticVoidMethod(gcClass, gcMID);
Cleanup(env);
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus)
{
JNIEnv* env = GetJNIEnv();
char* urlSpec = (char*) "";
nsIURI* url = nsnull;
if (channel && NS_SUCCEEDED(channel->GetURI(&url)))
url->GetSpec(&urlSpec);
jstring jURL = env->NewStringUTF(urlSpec);
if (!jURL) return NS_ERROR_FAILURE;
nsIDOMDocument* domDoc = GetDocument(loader);
jobject jdoc = CaffienateDOMDocument(domDoc);
env->CallVoidMethod(docListener,
endDocumentLoadMID,
jURL,
(jint) aStatus,
jdoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
env->CallStaticVoidMethod(gcClass, gcMID);
Cleanup(env);
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnStartURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel)
{
JNIEnv* env = GetJNIEnv();
char* urlSpec = (char*) "";
nsIURI* url = nsnull;
if (channel && NS_SUCCEEDED(channel->GetURI(&url)))
url->GetSpec(&urlSpec);
jstring jURL = env->NewStringUTF(urlSpec);
if (!jURL) return NS_ERROR_FAILURE;
char* contentType = (char*) "";
if (channel)
channel->GetContentType(&contentType);
if (!contentType)
contentType = (char*) "";
jstring jContentType = env->NewStringUTF(contentType);
if (!jContentType) return NS_ERROR_FAILURE;
nsIDOMDocument* domDoc = GetDocument(loader);
jobject jdoc = CaffienateDOMDocument(domDoc);
env->CallVoidMethod(docListener,
startURLLoadMID,
jURL,
jContentType,
jdoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
env->CallStaticVoidMethod(gcClass, gcMID);
Cleanup(env);
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnProgressURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
PRUint32 aProgress,
PRUint32 aProgressMax)
{
JNIEnv* env = GetJNIEnv();
char* urlSpec = (char*) "";
nsIURI* url = nsnull;
if (channel && NS_SUCCEEDED(channel->GetURI(&url)))
url->GetSpec(&urlSpec);
jstring jURL = env->NewStringUTF(urlSpec);
if (!jURL) return NS_ERROR_FAILURE;
nsIDOMDocument* domDoc = GetDocument(loader);
jobject jdoc = CaffienateDOMDocument(domDoc);
env->CallVoidMethod(docListener,
progressURLLoadMID,
jURL,
(jint) aProgress,
(jint) aProgressMax,
jdoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
env->CallStaticVoidMethod(gcClass, gcMID);
Cleanup(env);
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnStatusURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsString& aMsg)
{
JNIEnv* env = GetJNIEnv();
char* urlSpec = (char*) "";
nsIURI* url = nsnull;
if (channel && NS_SUCCEEDED(channel->GetURI(&url)))
url->GetSpec(&urlSpec);
jstring jURL = env->NewStringUTF(urlSpec);
if (!jURL) return NS_ERROR_FAILURE;
const PRUnichar* cMsg = aMsg.GetUnicode();
jstring jMessage = env->NewString(cMsg, aMsg.Length());
if (!jMessage) return NS_ERROR_FAILURE;
nsIDOMDocument* domDoc = GetDocument(loader);
jobject jdoc = CaffienateDOMDocument(domDoc);
env->CallVoidMethod(docListener,
statusURLLoadMID,
jURL,
jMessage,
jdoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
env->CallStaticVoidMethod(gcClass, gcMID);
Cleanup(env);
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnEndURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus)
{
JNIEnv* env = GetJNIEnv();
char* urlSpec = (char*) "";
nsIURI* url = nsnull;
if (channel && NS_SUCCEEDED(channel->GetURI(&url)))
url->GetSpec(&urlSpec);
jstring jURL = env->NewStringUTF(urlSpec);
if (!jURL) return NS_ERROR_FAILURE;
nsIDOMDocument* domDoc = GetDocument(loader);
jobject jdoc = CaffienateDOMDocument(domDoc);
#if defined(DEBUG)
dump_document(domDoc, urlSpec);
#endif
env->CallVoidMethod(docListener,
endURLLoadMID,
jURL,
(jint) aStatus,
jdoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
env->CallStaticVoidMethod(gcClass, gcMID);
Cleanup(env);
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::HandleUnknownContentType(nsIDocumentLoader* loader,
nsIChannel* channel,
const char *aContentType,
const char *aCommand)
{
JNIEnv* env = GetJNIEnv();
env->CallStaticVoidMethod(gcClass, gcMID);
Cleanup(env);
return NS_OK;
}
JNIEnv* nsJavaDOMImpl::GetJNIEnv() {
JNIEnv* env;
#ifdef JAVA_DOM_OJI_ENABLE
nsresult result;
if (!jvmManager) {
NS_WITH_SERVICE(nsIJVMManager, _jvmManager, kJVMManagerCID, &result);
if (NS_SUCCEEDED(result)) {
jvmManager = (nsJVMManager*)((nsIJVMManager*)_jvmManager);
}
}
if (!jvmManager) {
return NULL;
}
jvmManager->CreateProxyJNI(NULL,&env);
// if (!securityContext) {
// securityContext = new JavaDOMSecurityContext();
// }
// SetSecurityContext(env,securityContext);
SetSecurityContext(env, new JavaDOMSecurityContext());
#else /* JAVA_DOM_OJI_ENABLE */
if (!jvm) {
StartJVM();
}
#ifdef XP_PC
jvm->AttachCurrentThread((void**)&env,NULL);
#else
jvm->AttachCurrentThread(&env,NULL);
#endif
#endif /* JAVA_DOM_OJI_ENABLE */
return env;
}
#ifndef JAVA_DOM_OJI_ENABLE
void nsJavaDOMImpl::StartJVM(void) {
jsize jvmCount;
JNI_GetCreatedJavaVMs(&jvm, 1, &jvmCount);
if (jvmCount) {
return;
}
JNIEnv *env = NULL;
JDK1_1InitArgs vm_args;
JNI_GetDefaultJavaVMInitArgs(&vm_args);
vm_args.version = 0x00010001;
vm_args.verifyMode = JNI_TRUE;
#ifdef DEBUG
vm_args.verbose = JNI_TRUE;
vm_args.enableVerboseGC = JNI_TRUE;
#endif // DEBUG
char* cp = PR_GetEnv("CLASSPATH");
char* p = new char[strlen(cp) + strlen(vm_args.classpath) + 2];
strcpy(p, vm_args.classpath);
if (cp) {
#ifdef XP_PC
strcat(p, ";");
#else
strcat(p, ":");
#endif
strcat(p, cp);
vm_args.classpath = p;
}
#ifdef DISABLE_JIT
/* workaround to get java dom to work on Linux */
char **props = new char*[2];
props[0]="java.compiler=";
props[1]=0;
vm_args.properties = props;
#endif
#ifdef DEBUG
printf("classpath is \"%s\"\n", vm_args.classpath);
#endif // DEBUG
#ifdef XP_PC
jint rv = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
#else
jint rv = JNI_CreateJavaVM(&jvm, &env, &vm_args);
#endif
if (rv < 0) {
printf("\n JAVA DOM: could not start jvm\n");
} else {
printf("\n JAVA DOM: successfully started jvm\n");
}
delete[] p;
}
#endif /* JAVA_DOM_OJI_ENABLE */
#if defined(DEBUG)
static void dump_document(nsIDOMDocument* domDoc, const char* urlSpec)
{
if (!domDoc) return;
if (strstr(urlSpec, ".xul") ||
strstr(urlSpec, ".js") ||
strstr(urlSpec, ".css") ||
strstr(urlSpec, "file:")) return;
FILE* of = fopen("dom-cpp.txt", "a");
if (!of) {
perror("nsJavaDOMImpl::dump_document: failed to open output file\n");
return;
}
nsIDOMElement* element = nsnull;
nsresult rv = domDoc->GetDocumentElement(&element);
if (NS_FAILED(rv) || !element)
return;
(void) element->Normalize();
fprintf(of, "\n+++ %s +++\n", urlSpec);
dump_node(of, (nsIDOMNode*) element, 0, PR_FALSE);
fprintf(of, "\n");
fflush(of);
fclose(of);
}
static void dump_node(FILE* of, nsIDOMNode* node, int indent,
PRBool isMapNode)
{
if (!node) return;
fprintf(of, "\n");
for (int i=0; i < indent; i++)
fprintf(of, " ");
nsString name;
nsString value;
PRUint16 type;
node->GetNodeName(name);
node->GetNodeValue(value);
node->GetNodeType(&type);
const PRUnichar* cname = name.GetUnicode();
const PRUnichar* cvalue = value.GetUnicode();
char* cnorm = strip_whitespace(cvalue, value.Length());
fprintf(of, "name=\"%s\" type=%s value=\"%s\"",
cname, describe_type(type), cnorm);
delete[] cnorm;
if (isMapNode) return;
nsIDOMNamedNodeMap* map = nsnull;
node->GetAttributes(&map);
dump_map(of, map, indent);
nsIDOMNodeList* children = nsnull;
node->GetChildNodes(&children);
if (!children) return;
PRUint32 length=0;
children->GetLength(&length);
for (PRUint32 j=0; j < length; j++) {
nsIDOMNode* child = nsnull;
children->Item(j, &child);
dump_node(of, child, indent+2, PR_FALSE);
}
}
static void dump_map(FILE* of, nsIDOMNamedNodeMap* map, int indent)
{
if (!map) return;
fprintf(of, "\n");
PRUint32 length=0;
map->GetLength(&length);
if (length > 0) {
for (int i=0; i < indent; i++)
fprintf(of, " ");
fprintf(of, "------- start attributes -------");
}
for (PRUint32 j=0; j < length; j++) {
nsIDOMNode* node = nsnull;
map->Item(j, &node);
dump_node(of, node, indent, PR_TRUE);
}
if (length > 0) {
fprintf(of, "\n");
for (int k=0; k < indent; k++)
fprintf(of, " ");
fprintf(of, "------- end attributes -------");
}
}
static char* strip_whitespace(const PRUnichar* input, int length)
{
if (!input || length < 1) {
char* out = new char[1];
out[0] = 0;
return out;
}
char* out = new char[length+1];
char* op = out;
const PRUnichar* ip = input;
PRUnichar c = ' ';
PRUnichar pc = ' ';
int i = 0;
for (c = *ip++; i++<length; c = *ip++) {
if ((pc == ' ' || pc == '\n' || pc == '\t') &&
(c == ' ' || c == '\n' || c == '\t'))
continue;
*op++ = (char)c;
pc = c;
}
*op++ = 0;
return out;
}
static const char* describe_type(int type)
{
switch (type) {
case nsIDOMNode::ELEMENT_NODE: return "ELEMENT";
case nsIDOMNode::ATTRIBUTE_NODE: return "ATTRIBUTE";
case nsIDOMNode::TEXT_NODE: return "TEXT";
case nsIDOMNode::CDATA_SECTION_NODE: return "CDATA_SECTION";
case nsIDOMNode::ENTITY_REFERENCE_NODE: return "ENTITY_REFERENCE";
case nsIDOMNode::ENTITY_NODE: return "ENTITY";
case nsIDOMNode::PROCESSING_INSTRUCTION_NODE: return "PROCESSING_INSTRUCTION";
case nsIDOMNode::COMMENT_NODE: return "COMMENT";
case nsIDOMNode::DOCUMENT_NODE: return "DOCUMENT";
case nsIDOMNode::DOCUMENT_TYPE_NODE: return "DOCUMENT_TYPE";
case nsIDOMNode::DOCUMENT_FRAGMENT_NODE: return "DOCUMENT_FRAGMENT";
case nsIDOMNode::NOTATION_NODE: return "NOTATION";
}
return "ERROR";
}
#endif
nsresult NS_NewJavaDOM(nsIJavaDOM** aJavaDOM)
{
if (! aJavaDOM)
return NS_ERROR_NULL_POINTER;
*aJavaDOM = new nsJavaDOMImpl();
if (! *aJavaDOM)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aJavaDOM);
return NS_OK;
}

View File

@@ -1,88 +0,0 @@
#ifndef __nsJavaDOMImpl_h__
#define __nsJavaDOMImpl_h__
#include "jni.h"
#include "nsIJavaDOM.h"
#ifdef JAVA_DOM_OJI_ENABLE
#include "nsJVMManager.h"
#include "JavaDOMSecurityContext.h"
#endif
class nsIURI;
class nsIDOMDocument;
class nsIDocumentLoader;
class nsJavaDOMImpl : public nsIJavaDOM {
NS_DECL_ISUPPORTS
public:
nsJavaDOMImpl();
virtual ~nsJavaDOMImpl();
/* nsIDocumentLoaderObserver methods */
NS_IMETHOD OnStartDocumentLoad(nsIDocumentLoader* loader,
nsIURI* aURL,
const char* aCommand);
NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus);
NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel);
NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
PRUint32 aProgress,
PRUint32 aProgressMax);
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsString& aMsg);
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus);
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader,
nsIChannel* channel,
const char *aContentType,
const char *aCommand);
private:
#ifdef JAVA_DOM_OJI_ENABLE
static nsJVMManager* jvmManager;
static JavaDOMSecurityContext* securityContext;
#else
static JavaVM* jvm;
#endif
static jclass domAccessorClass;
static jclass documentClass;
static jclass listenerClass;
static jclass gcClass;
static jobject docListener;
static jfieldID documentPtrFID;
static jmethodID documentInitID;
static jmethodID getInstanceMID;
static jmethodID startURLLoadMID;
static jmethodID endURLLoadMID;
static jmethodID progressURLLoadMID;
static jmethodID statusURLLoadMID;
static jmethodID startDocumentLoadMID;
static jmethodID endDocumentLoadMID;
static jmethodID gcMID;
// cleanup after a JNI method invocation
static PRBool Cleanup(JNIEnv* env);
static JNIEnv* GetJNIEnv(void);
static void StartJVM(void);
nsIDOMDocument* GetDocument(nsIDocumentLoader* loader);
jobject CaffienateDOMDocument(nsIDOMDocument* domDoc);
};
#endif /* __nsJavaDOMImpl_h__ */

View File

@@ -1,44 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsJavaDOMImpl.h"
////////////////////////////////////////////////////////////////////////
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJavaDOMImpl)
////////////////////////////////////////////////////////////////////////
// Define a table of CIDs implemented by this module along with other
// information like the function to create an instance, progid, and
// class name.
//
static nsModuleComponentInfo components[] =
{
{ "Java DOM Component", NS_JAVADOM_CID, NULL, nsJavaDOMImplConstructor }
};
////////////////////////////////////////////////////////////////////////
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsJavaDOMModule", components)

View File

@@ -1,77 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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):
*/
#ifndef __nsJavaDOMModule_h__
#define __nsJavaDOMModule_h__
static NS_DEFINE_CID(kJavaDOMCID, NS_JAVADOM_CID);
class nsJavaDOMModule : public nsIModule
{
public:
nsJavaDOMModule();
virtual ~nsJavaDOMModule();
NS_DECL_ISUPPORTS
NS_DECL_NSIMODULE
protected:
nsresult Initialize();
void Shutdown();
PRBool mInitialized;
nsCOMPtr<nsIGenericFactory> mFactory;
};
extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr,
nsIFileSpec* location,
nsIModule** return_cobj);
// Functions used to create new instances of a given object by the
// generic factory.
#define MAKE_CTOR(_name) \
static NS_IMETHODIMP \
CreateNew##_name(nsISupports* aOuter, REFNSIID aIID, void **aResult) \
{ \
if (!aResult) { \
return NS_ERROR_INVALID_POINTER; \
} \
if (aOuter) { \
*aResult = nsnull; \
return NS_ERROR_NO_AGGREGATION; \
} \
nsCOMPtr<nsI##_name> inst; \
nsresult rv = NS_New##_name(getter_AddRefs(inst)); \
if (NS_FAILED(rv)) { \
*aResult = nsnull; \
return rv; \
} \
rv = inst->QueryInterface(aIID, aResult); \
if (NS_FAILED(rv)) { \
*aResult = nsnull; \
} \
return rv; \
}
#endif /* __nsJavaDOMModule_h__ */