Compare commits

..

2 Commits

Author SHA1 Message Date
heikki%netscape.com
a637f81f7f new project started
git-svn-id: svn://10.0.0.236/branches/mozilla@91184 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:13:38 +00:00
(no author)
6cfadae5d1 This commit was manufactured by cvs2svn to create branch 'mozilla'.
git-svn-id: svn://10.0.0.236/branches/mozilla@8534 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 18:36:10 +00:00
1515 changed files with 76 additions and 140323 deletions

View File

@@ -1,38 +0,0 @@
#!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@
include $(DEPTH)/config/autoconf.mk
# PENDING(edburns): make it so it's possible to just build
# webclient and javadom
DIRS= util \
dom \
plugins \
webclient \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,43 +0,0 @@
#!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
# 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
#//------------------------------------------------------------------------
#//
#// Makefile to build the java enhancers to mozilla
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH = ..
DIRS = external \
util \
dom \
webclient
include <$(DEPTH)\config\rules.mak>

View File

@@ -1,36 +0,0 @@
Here lies the code that comprises the java enhancers to mozilla.
Authors: see the README files for each individual subdirectory
Requirements:
* JDK1.2 or greater (may work with lower versions, haven't checked).
* Successfully built MOZ_DEBUG=1 Mozilla M13 tree.
* Perl 5 perl.exe must be in your path
How To Build:
* make it so the directory in which this file resides is a child of your
top level Mozilla M13 directory
* make sure the environment var JDKHOME is set to your jdk installation
directory, ie SET JDKHOME=C:\jdk1.2.2
* type "nmake /f makefile.win all" and hope for the best
* this should compile the clasess into %MOZ_SRC%\dist\classes
Problems:
* clobber_all doesn't remove the .class files from dist\classes. You
have to do this manually.
* post to netscape.public.mozilla.java newsgroup
General notes:
* Please update the ChangeLog (changelo) files in the subdirectories when
you make changes.

View File

@@ -1,106 +0,0 @@
******************** BLACKWOOD RELEASE 0.9 README ********************
READ THIS DOCUMENT BEFORE RUNNING ANY OF THE BLACKWOOD COMPONENTS
This version of Blackwood has been built on and configured for
the Solaris(TM) operating environment
This package contains the following components of the Blackwood Project
- Pluglets, JavaDOM and Webclient
The Blackwood project aims to -
1. Better integrate the Java (TM) platform with the Mozilla (Netscape 6)
Browser so developers can extend the browser with components and
plug-ins written in the Java programming language
2. Make sure that Mozilla's layout engine can be embedded in
applications running on a Java virtual machine (JVM).
More information on the Blackwood project can be obtained online at
http://www.mozilla.org/projects/blackwood/
------------------------------------------------------------------------
SYSTEM REQUIREMENTS
------------------------------------------------------------------------
The Blackwood software components run on Solaris for SPARC(TM) and
Solaris for Intel with Solaris versions 7 and 8.
You will also need to install the JRE1.3.0_01 Java Bundle that goes
with Netscape 6 PR3
-------------------------------------------------------------------------
BLACKWOOD COMPONENTS
-------------------------------------------------------------------------
JAVA PLUGLET API - A Pluglet is a plug-in that is written in the Java
programming Language. The Java Pluglet API is a close 1:1 implementation
of the new C++ Plug-in API in Mozilla and it allows users to develop
plug-ins in Java that run inside a Java Virtual Machione (JVM).
More information can be obtained online at
http://www.mozilla.org/projects/blackwood/java-plugins/
JAVA DOM API - The Java DOM API is an implementation of the Java Bindings
specified in the Document Object Model (DOM) Level 1 Specification. This
API allows Java Applets and Pluglets to interact with and modify the
document they are embedded into.
More information can be obtained online at
http://www.mozilla.org/projects/blackwood/dom/
http://www.w3.org/TR/REC-DOM-Level-1/java-language-binding.html
WEBCLIENT - Webclient is a browser-neutral Java API that enables generic
web browsing capabilities in a Java application.
More information can be obtained online at
http://www.mozilla.org/projects/blackwood/webclient/
http://www.mozilla.org/projects/blackwood/webclient/ref_guides/Developer_guide/index.htm
http://www.mozilla.org/projects/blackwood/webclient/ref_guides/Implementation_guide/index.htm
-------------------------------------------------------------------------
RUN INSTRUCTIONS
-------------------------------------------------------------------------
PLUGLETS
- Launch the browser using the shell script "netscape_pluglets"
- Navigate to the url file:///<your_Netscape6_install_dir>/res/javadev/pluglets/test.html
- If you wish to observe Mozilla debug messages on your shell prompt, launch Pluglets
using the script "netscape_debug_pluglets"
This contains several Pluglet examples.
JAVADOM
- The DOMViewer example in the Pluglets example list is a JavaDOM example
WEBCLIENT
- set the Environment variable MOZILLA_FIVE_HOME to the location of your
Netscape 6 binaries. If you install the SVR4 package, this will be
setenv MOZILLA_FIVE_HOME /opt/SUNWns6
- cd to the javadev/example directory
- run the shell script runem as
runem <your url>
============================================================================
Copyright 2000 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto,
California 94303 U.S.A. All rights reserved.
Sun, Sun Microsystems, Java, SunOS, OpenWindows, and Solaris are trademarks,
registered trademarks, or service marks of Sun Microsystems, Inc. in the U.S.A.
and other countries. All SPARC trademarks are used under license and are
trademarks or registered trademarks of SPARC International, Inc. in the U.S.A.
and other countries. Products bearing SPARC trademarks are based upon an
architecture developed by Sun Microsystems, Inc. Netscape is a trademark of
Netscape Communications Corporation. PostScript is a trademark of Adobe
Systems, Incorporated, which may be registered in certain jurisdictions.

View File

@@ -1,5 +0,0 @@
Fri Jul 30 14:57:28 1999 Ed Burns <Ed Burns <ed.burns@sun.com>>
* Made necessary changes to build files to build with jdk1.1.7 or
jdk1.2.2.

View File

@@ -1,44 +0,0 @@
@echo off
rem The contents of this file are subject to the Netscape Public
rem License Version 1.1 (the "License"); you may not use this file
rem except in compliance with the License. You may obtain a copy of
rem the License at http://www.mozilla.org/NPL/
rem
rem Software distributed under the License is distributed on an "AS
rem IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
rem implied. See the License for the specific language governing
rem rights and limitations under the License.
rem
rem The Original Code is mozilla.org code.
rem
rem The Initial Developer of the Original Code is Netscape
rem Communications Corporation. Portions created by Netscape are
rem Copyright (C) 1998 Netscape Communications Corporation. All
rem Rights Reserved.
rem
rem Contributor(s):
@echo on
@echo off
if not exist %2 echo Warning: %2 does not exist! (you may need to check it out)
if not exist %2 exit 1
pushd %2
goto NO_CAFE
if "%MOZ_CAFE%"=="" goto NO_CAFE
mkdir %MOZ_SRC%\mozilla\dist\classes\%2
%MOZ_TOOLS%\bin\sj.exe -classpath %MOZ_SRC%\mozilla\dist\classes;%MOZ_SRC%\mozilla\sun-java\classsrc -d %MOZ_SRC%\mozilla\dist\classes *.java
goto END
:NO_CAFE
perl.exe %MOZ_SRC%\mozilla\config\outofdate.pl -d %MOZ_SRC%\mozilla\dist\classes\%2 -cfg %1 *.java > doit.bat
call doit.bat
del /F /A:A doit.bat
:END
popd

View File

@@ -1,19 +0,0 @@
# this file contains defs that should be in the top level mozilla/config
# directory, but may not be there due to tree update issues.
!ifndef JAVA_HOME
JAVA_HOME=$(JDKHOME)
!endif
JAVA_DESTPATH = $(MOZ_SRC)\mozilla\dist\classes
DEFAULT_JAVA_SOURCEPATH = $(MOZ_SRC)\mozilla\sun-java\classsrc
JAVA_SOURCEPATH = $(MOZ_SRC)\mozilla\sun-java\classsrc11;$(DEFAULT_JAVA_SOURCEPATH)
JAVAC_ZIP=$(JAVA_HOME)\lib\classes.zip
JAVAC_CLASSPATH=$(JAVAC_ZIP)$(PATH_SEPARATOR)$(JAVA_DESTPATH)$(PATH_SEPARATOR)$(JAVA_SOURCEPATH)
JAVA=$(JDKHOME)\bin\java
JAVAH=$(JDKHOME)\bin\JAVAH
JAVAH_FLAGS=-jni -classpath $(JAVAC_CLASSPATH)

View File

@@ -1,134 +0,0 @@
#!perl
#
# 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):
#
#
#Input: [-d dir] foo1.java foo2.java
#Compares with: foo1.class foo2.class (if -d specified, checks in 'dir',
# otherwise assumes .class files in same directory as .java files)
#Returns: list of input arguments which are newer than corresponding class
#files (non-existant class files are considered to be real old :-)
#
$found = 1;
# GLOBALS
$SEP = 0; # the paltform independent path separator
$CFG = 0; # the value of the -cfg flag
# determine the path separator
$_ = $ENV{"PATH"};
if (m|/|) {
$SEP = "/";
}
else {
$SEP = "\\";
}
if ($ARGV[0] eq '-d') {
$classdir = $ARGV[1];
$classdir .= $SEP;
shift;
shift;
} else {
$classdir = "." . $SEP;
}
# if -cfg is specified, print out the contents of the cfg file to stdout
if ($ARGV[0] eq '-cfg') {
$CFG = $ARGV[1];
shift;
shift;
}
$_ = $ARGV[0];
if (m/\*.java/) {
# Account for the fact that the shell didn't expand *.java by doing it
# manually.
&manuallyExpandArgument("java");
}
$printFile = 0;
foreach $filename (@ARGV) {
$classfilename = $classdir;
$classfilename .= $filename;
$classfilename =~ s/.java$/.class/;
# workaround to only build sun/io/* classes when necessary
# change the pathname of target file to be consistent
# with sun/io subdirectories
#
# sun/io was always getting rebuilt because the java files
# were split into subdirectories, but the package names
# remained the same. This was confusing outofdate.pl
#
$classfilename =~ s/sun\/io\/extended.\//sun\/io\//;
$classfilename =~ s/\.\.\/\.\.\/sun-java\/classsrc\///;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
$ctime,$blksize,$blocks) = stat($filename);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime,
$ctime,$blksize,$blocks) = stat($classfilename);
# print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n";
if ($mtime > $classmtime) {
# Only print the file header if we actually have some files to
# compile.
if (!$printFile) {
$printFile = 1;
&printFile($CFG);
}
print $filename, " ";
$found = 0;
}
}
print "\n";
# push onto $ARG array all filenames with extension $ext
# @param ext the extension of the file
sub manuallyExpandArgument {
local($ext) = @_;
$ext = "\." . $ext; # put it in regexp
$result = opendir(DIR, ".");
@allfiles = grep(/$ext/, readdir(DIR));
$i = 0;
foreach $file (@allfiles) {
#skip emacs save files
$_ = $file;
if (!/~/) {
$ARGV[$i++] = $file;
}
}
}
sub printFile {
local($file) = @_;
$result = open(CFG, $file);
while (<CFG>) {
chop;
print $_;
}
}

View File

@@ -1,10 +0,0 @@
Index: DOMAccessor.java
===================================================================
RCS file: /cvsroot/mozilla/java/dom/classes/org/mozilla/dom/DOMAccessor.java,v
retrieving revision 1.2
diff -r1.2 DOMAccessor.java
31a32,33
> import org.mozilla.dom.util.GenericDocLoadListener;
>
38a41
> addDocumentLoadListener(new GenericDocLoadListener("JavaDOM"));

View File

@@ -1,30 +0,0 @@
#!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 = .
include $(DEPTH)/config/autoconf.mk
DIRS = classes jni src
include $(topsrcdir)/config/rules.mk

View File

@@ -1,30 +0,0 @@
#!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@
include $(DEPTH)/config/autoconf.mk
DIRS = classes src jni
include $(topsrcdir)/config/rules.mk

View File

@@ -1,153 +0,0 @@
Sources
=======
The sources are located in mozilla/java/dom.
Subdirectories
classes
jni
src
tests
contain Java sources, Java native methods implementation,
native c++ code and Java DOM API tests respectively.
Note:
Sources that work with mozilla PR1 and earlier
versions should be checked out using DOM_PR1 tag.
No tags are needed for the sources that work with
the latest mozilla tree.
Building
========
Requirenments:
--------------
Current mozilla build
JDK1.2 or JDK1.3
Perl 5 must be in your path
JDKHOME environment variable set to your JDK dir
CLASSPATH environment cvariable set to contain
org.w3c.dom classes. The sources can be found at
http://www.w3.org/TR/2000/CR-DOM-Level-2-20000307/java-binding.html
(for mozilla PR1 and earlie versions)
http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/java-binding.html
(for the latest mozilla)
Solaris specific
----------------
Add following directories to LD_LIBRARY_PATH environment variable:
$MOZILLA_FIVE_HOME
$JDKHOME/jre/lib/$HOSTTYPE/native_threads
$JDKHOME/jre/lib/$HOSTTYPE/classic
$JDKHOME/jre/lib/$HOSTTYPE/
goto mozilla/java/dom directory and type "gmake"
Windows NT specific
-------------------
To enable OJI usage set environment variable JAVA_DOM_OJI_ENABLE=1
Add following directories to PATH environment variable:
%MOZILLA_FIVE_HOME%
%JDKHOME%\jre\bin\classic (only in case you don't use OJI)
goto mozilla/java/dom directory and type "nmake /f makefile.win"
Using the Java DOM API
======================
A Java component obtains a org.w3c.dom.Document by registering for
Document load notifications. The Document is passed in along with the
notifications. The preferred way for a Java component to register for
Document load notifications is to register via the DOMAccessor class.
However, this is possible only if OJI usage is enabled. This works
on Windows NT platform.
On Solaris currently the nsJavaDOM component instantiates its own JVM.
When an OJI-compatible JVM is available, we will move over to using it.
So, one has to apply two patches to
mozilla/webshell/src/nsWebShell.cpp
mozilla/java/dom/classes/org/mozilla/dom/DOMAccessor.java
They can be found at mozilla/java/dom directory.
The first one inits nsJavaDOM component and adds it as a
document load observer listener.
The second one registers a document load listener via DOMAccessor.
Note:
any class that implements the DocumentLoadListener interface may
stand for GenericDocLoadListener.
After applying a patch to nsWebShell.cpp edit
mozilla/webshell/src/Makefile.in to add -DJAVA_DOM to the list of
defines. Then do a gmake in this directory.
After applying a patch to DOMAccessor.java go to mozilla/java/dom/classes
and do a gmake. No changes in makefiles are needed.
You can find examples of Java DOM API usage in
mozilla/java/dom/classes/org/mozilla/dom/util
mozilla/java/dom/tests/src/applets
DOM2 events
------------
At the moment all DOM2 event-related interfaces are present
however they are not fully implemented yet
because Mozilla's core DOM does not support DOM2 events fully.
Consequences:
- some methods throws OperationUnsupportedException()
The basic implementation architecture is following:
- NodeImpl is extended to support EventTarget interface
- for every addEventListener call special NativeDOMProxyListener object is
created and is registered with Mozilla's DOM
It's task is to propagate event notifications from Mozilla's DOM
to target Java EventListener
- In order to sucessfully unregister EventListeners we need to
save association between java EventListener and corresponding
NativeDOMProxyListener object. This is done by storing such
associations Vector at NodeImpl
- javaDOMEventsGlobals class is used much like javaDOMGlobals for caching
(this code may be moved to javaDOMGlobals)
NSPR Logging
------------
The NSPR Log module name is javadom. For instructions on how to enable
logging, see dist/include/prlog.h
Debug output
------------
The debug build of the Java DOM API creates the JVM with the verbose
and the verboseGC options turned on, to help in debugging. It also
creates two files in the current working directory, dom-java.txt and
dom-cpp.txt, which are simple dumps of the DOM, as printed from C++
and from Java. The two should be identical. The code to write these
files is, essentially, my regression test. Feel free to add to it.
Dependencies
------------
Currently tested on Solaris 7 only with Java 2 SDK 1.2.1. egcs-2.91.66,
Sun Workshop C++ 4.2 and 5.0 have been know to compile this code
fine. gcc-2.8.1 does *not* work. I have not used anything
Java2-specific, and it works with JDK1.1.x too (I have been using JDK
1.1.6 too).
References
----------
I highly recommend reading Sheng Liang's new JNI book.

View File

@@ -1,25 +0,0 @@
o Convert to using IDL and GenericFactories. Once support for
ComponentLoaders is implemented in xpcom, use that to load our
component.
[5d]
o Use OJI to obtain the JVM.
[5d. Awaiting OJI availability]
o i18n the API
o Use nsISupportsProxies to work around thread
limitations. This will mean writing an IDL for nsIJavaDOM.h, but
that sould be trivial. Dcumentation for nsISupportsProxies is
available at
http://www.mozilla.org/projects/xpcom/Proxies.html.
[2w. Assigned. Contact: Sergey Lunegov <lsv@sparc.spb.su>]
o Investigate the possibility of writing a tool that can generate the
JNI code from idl. This is the only practical way to implement the
HTML DOM (because it is too big to hand-code).
[4w+]

View File

@@ -1,42 +0,0 @@
#!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 \
org/mozilla/dom/util \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
JAVAC_PROG = $(JDKHOME)/bin/javac
JAVAC_FLAGS = -classpath $(CLASSPATH):$(JAVA_DESTPATH) -d $(JAVA_DESTPATH)
JAVAC = $(JAVAC_PROG) $(JAVAC_FLAGS)

View File

@@ -1,42 +0,0 @@
#!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 \
org/mozilla/dom/util \
$(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

@@ -1,37 +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):
IGNORE_MANIFEST=1
DEPTH = ..\..\..
JAVA_OR_NSJVM=1
NO_CAFE=1
include <$(DEPTH)\config\config.mak>
JDIRS = org\mozilla\dom \
org\mozilla\dom\events \
org\mozilla\dom\util \
$(NULL)
JAVAC_PROG=$(JDKHOME)\bin\javac
JAVAC_FLAGS=-classpath $(CLASSPATH);$(JAVA_DESTPATH) -d $(JAVA_DESTPATH)
include <$(DEPTH)\config\javarules.mak>
include <$(DEPTH)\config\rules.mak>

View File

@@ -1,43 +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):
*/
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 native Element getOwnerElement();
}

View File

@@ -1,31 +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):
*/
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

@@ -1,39 +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):
*/
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

@@ -1,30 +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):
*/
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

@@ -1,203 +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):
*/
/*
* W3C® IPR SOFTWARE NOTICE
* Copyright © 1994-2000 World Wide Web Consortium, (Massachusetts
* Institute of Technology, Institut National de Recherche en
* Informatique et en Automatique, Keio University). All Rights
* Reserved. http://www.w3.org/Consortium/Legal/
* This W3C work (including software, documents, or other related items) is
* being provided by the copyright holders under the following
* license. By obtaining, using and/or copying this work, you (the
* licensee) agree that you have read, understood, and will comply with
* the following terms and conditions:
* Permission to use, copy, and modify this software and its documentation,
* with or without modification, for any purpose and without fee or
* royalty is hereby granted, provided that you include the following on
* ALL copies of the software and documentation or portions thereof,
* including modifications, that you make:
* The full text of this NOTICE in a location viewable to users of the
* redistributed or derivative work.
* Any pre-existing intellectual property disclaimers, notices, or terms
* and conditions. If none exist, a short notice of the following form
* (hypertext is preferred, text is permitted) should be used within the
* body of any redistributed or derivative code: "Copyright ©
* [$date-of-software] World Wide Web Consortium, (Massachusetts
* Institute of Technology, Institut National de Recherche en
* Informatique et en Automatique, Keio University). All Rights
* Reserved. http://www.w3.org/Consortium/Legal/"
* Notice of any changes or modifications to the W3C files, including
* the date changes were made. (We recommend you provide URIs to the
* location from which the code is derived.)
* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
* HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR
* FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
* DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
* TRADEMARKS OR OTHER RIGHTS.
* COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE
* SOFTWARE OR DOCUMENTATION.
* The name and trademarks of copyright holders may NOT be used in
* advertising or publicity pertaining to the software without specific,
* written prior permission. Title to copyright in this software and any
* associated documentation will at all times remain with copyright
* holders.
*/
package org.mozilla.dom;
import java.util.Vector;
import java.util.Enumeration;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import java.security.AccessController;
public final class DOMAccessor {
private static Vector documentLoadListeners = new Vector();
private static JavaDOMPermission permission = new JavaDOMPermission("JavaDOM");
static {
System.loadLibrary("javadomjni");
}
private void DOMAccessorImpl() {}
private static native void register();
private static native void unregister();
private static native Node getNodeByHandle(long p);
private static native void doGC();
public static native void initialize();
public static synchronized void
addDocumentLoadListener(DocumentLoadListener listener) {
if (documentLoadListeners.size() == 0) {
register();
}
documentLoadListeners.addElement(listener);
}
public static synchronized void
removeDocumentLoadListener(DocumentLoadListener listener) {
documentLoadListeners.removeElement(listener);
if (documentLoadListeners.size() == 0) {
unregister();
}
}
public static synchronized void
startURLLoad(String url, String contentType, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.startURLLoad(url, contentType, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
endURLLoad(String url, int status, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.endURLLoad(url, status, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
progressURLLoad(String url, int progress, int progressMax,
long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.progressURLLoad(url, progress, progressMax, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
statusURLLoad(String url, String message, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.statusURLLoad(url, message, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
startDocumentLoad(String url) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.startDocumentLoad(url);
}
doGC();
}
public static synchronized void
endDocumentLoad(String url, int status, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.endDocumentLoad(url, status, (Document)getNodeByHandle(p_doc));
}
doGC();
}
}

View File

@@ -1,32 +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):
*/
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

@@ -1,62 +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):
*/
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 native DocumentType createDocumentType(String qualifiedName,
String publicID,
String systemID);
public native Document createDocument(String namespaceURI,
String qualifiedName,
DocumentType doctype);
}

View File

@@ -1,29 +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):
*/
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

@@ -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):
*/
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 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 native Event createEvent(String type);
public native NodeList getElementsByTagNameNS(String namespaceURI, String localName);
public native Element getElementById(String elementId);
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();
}
}

View File

@@ -1,36 +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):
*/
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

@@ -1,40 +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):
*/
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 native String getPublicId();
public native String getSystemId();
public native String getInternalSubset();
}

View File

@@ -1,53 +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):
*/
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 native String getAttributeNS(String namespaceURI, String localName);
public native void setAttributeNS(String namespaceURI, String qualifiedName, String value);
public native void removeAttributeNS(String namespacURI, String localName);
public native Attr getAttributeNodeNS(String namespaceURI, String localName);
public native Attr setAttributeNodeNS(Attr newAttr);
public native NodeList getElementsByTagNameNS(String namespaceURI, String localName);
public native boolean hasAttribute(String name);
public native boolean hasAttributeNS(String namespaceURI, String localName);
}

View File

@@ -1,34 +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):
*/
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

@@ -1,30 +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):
*/
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

@@ -1,36 +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):
*/
package org.mozilla.dom;
import java.security.BasicPermission;
public final class JavaDOMPermission extends BasicPermission {
public JavaDOMPermission(String name)
{
super(name);
}
public JavaDOMPermission(String name, String actions)
{
super(name);
}
}

View File

@@ -1,54 +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):
*/
package org.mozilla.dom;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
public class NamedNodeMapImpl implements NamedNodeMap {
private long p_nsIDOMNamedNodeMap = 0;
// 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

@@ -1,219 +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):
*/
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 native boolean supports(String feature, String version);
public native String getNamespaceURI();
public native String getPrefix();
public native void setPrefix(String prefix);
public native String getLocalName();
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

@@ -1,52 +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):
*/
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

@@ -1,33 +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):
*/
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

@@ -1,34 +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):
*/
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

@@ -1,33 +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):
*/
package org.mozilla.dom;
import org.w3c.dom.Text;
public class TextImpl extends CharacterDataImpl implements Text {
// instantiated from JNI or Document.createTextNode()
protected TextImpl() {}
public native Text splitText(int offset);
}

View File

@@ -1,151 +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):
*/
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 EventTarget getCurrentTarget();
/**
* 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 native boolean getBubbles();
/**
* 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 native boolean getCancelable();
/**
* 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 native void stopPropagation();
/**
*
* @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 native void initEvent(String eventTypeArg,
boolean canBubbleArg,
boolean cancelableArg);
public native long getTimeStamp();
}

View File

@@ -1,160 +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):
*/
package org.mozilla.dom.events;
import org.w3c.dom.Node;
import org.w3c.dom.views.AbstractView;
import org.w3c.dom.events.MouseEvent;
import org.w3c.dom.events.EventTarget;
/**
* 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 native EventTarget getRelatedTarget();
/**
*
* @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 native 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,
EventTarget relatedTargetArg);
}

View File

@@ -1,89 +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):
*/
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

@@ -1,74 +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):
*/
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 native AbstractView getView();
/**
* Specifies some detail information about the <code>Event</code>, depending
* on the type of event.
*/
public native int getDetail();
/**
*
* @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 native void initUIEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
int detailArg);
}

View File

@@ -1,231 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (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 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): Denis Sharypov <sdv@sparc.spb.su>
*
*/
package org.mozilla.dom.util;
import java.io.BufferedOutputStream;
import java.io.PrintStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class DOMTreeDumper {
private String name;
private boolean debug;
private PrintStream ps;
private boolean inA;
private final String[] endTagForbiddenNames = {"AREA",
"BASE",
"BASEFONT",
"BR",
"COL",
"FRAME",
"HR",
"IMG",
"INPUT",
"ISINDEX",
"LINK",
"META",
"PARAM"};
public DOMTreeDumper() {
this("DOMTreeDumper", true);
}
public DOMTreeDumper(boolean debug) {
this("DOMTreeDumper", debug);
}
public DOMTreeDumper(String name) {
this(name, true);
}
public DOMTreeDumper(String name, boolean debug) {
this.name = name;
this.debug = debug;
}
private void dumpDocument(Document doc) {
if (doc == null) return;
Element element = doc.getDocumentElement();
if (element == null) return;
element.normalize();
// DocumentType dt = doc.getDoctype();
// dumpNode(dt);
dumpNode(element);
ps.println();
ps.flush();
element = null;
doc = null;
}
private void dumpNode(Node node) {
dumpNode(node, false);
}
private void dumpNode(Node node, boolean isMapNode) {
if (node == null) {
return;
}
int type = node.getNodeType();
String name = node.getNodeName();
String value = node.getNodeValue();
switch (type) {
case Node.ELEMENT_NODE:
if (name.equals("A")) inA = true;
if (!(inA || name.equals("BR"))) {
ps.println();
}
ps.print("<" + name);
dumpAttributes(node);
ps.print(">");
dumpChildren(node);
if (name.equals("A")) inA = false;
if (!endTagForbidden(name)) {
ps.print("</" + node.getNodeName() + ">");
}
break;
case Node.ATTRIBUTE_NODE:
ps.print(" " + name.toUpperCase() + "=\"" + value + "\"");
break;
case Node.TEXT_NODE:
if (!node.getParentNode().getNodeName().equals("PRE")) {
value = value.trim();
}
if (!value.equals("")) {
if (!inA) {
ps.println();
}
ps.print(canonicalize(value));
}
break;
case Node.COMMENT_NODE:
ps.print("\n<!--" + value + "-->");
break;
case Node.CDATA_SECTION_NODE:
case Node.ENTITY_REFERENCE_NODE:
case Node.ENTITY_NODE:
case Node.PROCESSING_INSTRUCTION_NODE:
case Node.DOCUMENT_NODE:
case Node.DOCUMENT_TYPE_NODE:
case Node.DOCUMENT_FRAGMENT_NODE:
case Node.NOTATION_NODE:
ps.println("\n<!-- NOT HANDLED: " + name +
" value=" + value + " -->");
break;
}
}
private void dumpAttributes(Node node) {
NamedNodeMap map = node.getAttributes();
if (map == null) return;
int length = map.getLength();
for (int i=0; i < length; i++) {
Node item = map.item(i);
dumpNode(item, true);
}
}
private void dumpChildren(Node node) {
NodeList children = node.getChildNodes();
int length = 0;
boolean hasChildren = ((children != null) && ((length = children.getLength()) > 0));
if (!hasChildren) {
return;
}
for (int i=0; i < length; i++) {
dumpNode(children.item(i), false);
}
if (!inA) {
ps.println();
}
}
private String canonicalize(String str) {
StringBuffer in = new StringBuffer(str);
int length = in.length();
StringBuffer out = new StringBuffer(length);
char c;
for (int i = 0; i < length; i++) {
switch (c = in.charAt(i)) {
case '&' :
out.append("&amp;");
break;
case '<':
out.append("&lt;");
break;
case '>':
out.append("&gt;");
break;
case '\u00A0':
out.append("&nbsp;");
break;
default:
out.append(c);
}
}
return out.toString();
}
private boolean endTagForbidden(String name) {
for (int i = 0; i < endTagForbiddenNames.length; i++) {
if (name.equals(endTagForbiddenNames[i])) {
return true;
}
}
return false;
}
public void dumpToFile(String fileName, Document doc) {
try {
FileOutputStream fos = new FileOutputStream(fileName);
ps = new PrintStream(new BufferedOutputStream(fos, 1024));
} catch (IOException ex) {
ex.printStackTrace();
return;
}
dbg("dumping to " + fileName);
dumpDocument(doc);
dbg("finished dumping...");
}
public void dumpToStream(PrintStream ps, Document doc) {
this.ps = ps;
dbg("dumping to stream...");
dumpDocument(doc);
dbg("finished dumping...");
}
private void dbg(String str) {
if (debug) {
System.out.println(name + ": " + str);
}
}
}

View File

@@ -1,105 +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):
*/
package org.mozilla.dom.util;
import java.io.PrintStream;
import org.w3c.dom.Document;
import org.mozilla.dom.DocumentLoadListener;
public class GenericDocLoadListener implements DocumentLoadListener {
private String name;
private PrintStream ps;
public GenericDocLoadListener() {
this("GenericDocLoadListener",
new PrintStream(System.out));
}
public GenericDocLoadListener(String name) {
this(name,
new PrintStream(System.out));
}
public GenericDocLoadListener(PrintStream ps) {
this("GenericDocLoadListener", ps);
}
public GenericDocLoadListener(String name, PrintStream ps) {
this.name = name;
this.ps = ps;
}
public DocumentLoadListener getDocumentLoadListener() {
return this;
}
public void startURLLoad(String url, String contentType, Document doc) {
if (ps != null) {
ps.println(name + " :start URL load - " +
url.toString() + " " +
contentType);
}
}
public void endURLLoad(String url, int status, Document doc) {
if (ps != null) {
ps.println(name + " :end URL load - " +
url.toString() + " " +
Integer.toHexString(status));
}
}
public void progressURLLoad(String url, int progress, int progressMax,
Document doc) {
if (ps != null) {
ps.println(name + " :progress URL load - " +
url.toString() + " " +
Integer.toString(progress) + "/" +
Integer.toString(progressMax));
}
}
public void statusURLLoad(String url, String message, Document doc) {
if (ps != null) {
ps.println(name + " :status URL load - " +
url.toString() + " (" +
message + ")");
}
}
public void startDocumentLoad(String url) {
if (ps != null) {
ps.println(name + " :start doc load - " +
url.toString());
}
}
public void endDocumentLoad(String url, int status, Document doc) {
if (ps != null) {
ps.println(name + " :end doc load - " +
url.toString() + " " +
Integer.toHexString(status));
}
}
}

View File

@@ -1,68 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (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 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.util;
import java.io.PrintStream;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
public class GenericEventListener implements EventListener {
private String name;
private PrintStream ps;
public GenericEventListener() {
this("GenericEventListener",
new PrintStream(System.out));
}
public GenericEventListener(String name) {
this(name, new PrintStream(System.out));
}
public GenericEventListener(PrintStream ps) {
this("GenericEventListener", ps);
}
public GenericEventListener(String name, PrintStream ps) {
this.name = name;
this.ps = ps;
}
/**
* This method is called whenever an event occurs of the type for which the
* <code> EventListener</code> interface was registered.
* @param event The <code>Event</code> contains contextual information about
* the event. It also contains the <code>returnValue</code> and
* <code>cancelBubble</code> properties which are used in determining
* proper event flow.
*/
public void handleEvent(Event event) {
try {
if (ps != null) {
ps.println(name + ": got event " + event);
}
} catch (Exception e) {
if (ps != null) {
ps.println(name + ": exception in handleEvent " + e);
}
}
}
}

View File

@@ -1,84 +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):
DEPTH = ../../..
topsrcdir = $(DEPTH)
srcdir = $(topsrcdir)/java/dom/jni
VPATH = $(topsrcdir)/java/dom/jni
JAVAHOME = $(JDKHOME)
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = javadomjni
CPPSRCS = \
javaDOMGlobals.cpp \
javaDOMEventsGlobals.cpp \
nativeDOMProxyListener.cpp \
org_mozilla_dom_DOMAccessor.cpp \
org_mozilla_dom_AttrImpl.cpp \
org_mozilla_dom_CharacterDataImpl.cpp \
org_mozilla_dom_DocumentImpl.cpp \
org_mozilla_dom_DocumentTypeImpl.cpp \
org_mozilla_dom_DOMImplementationImpl.cpp \
org_mozilla_dom_ElementImpl.cpp \
org_mozilla_dom_EntityImpl.cpp \
org_mozilla_dom_NamedNodeMapImpl.cpp \
org_mozilla_dom_NodeImpl.cpp \
org_mozilla_dom_NodeListImpl.cpp \
org_mozilla_dom_NotationImpl.cpp \
org_mozilla_dom_ProcessingInstructionImpl.cpp \
org_mozilla_dom_TextImpl.cpp \
org_mozilla_dom_events_EventImpl.cpp \
org_mozilla_dom_events_UIEventImpl.cpp \
org_mozilla_dom_events_MouseEventImpl.cpp
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk
JAVA_CLS= \
org.mozilla.dom.DOMAccessor \
org.mozilla.dom.AttrImpl \
org.mozilla.dom.CharacterDataImpl \
org.mozilla.dom.DocumentImpl \
org.mozilla.dom.DocumentTypeImpl \
org.mozilla.dom.DOMImplementationImpl \
org.mozilla.dom.ElementImpl \
org.mozilla.dom.EntityImpl \
org.mozilla.dom.NamedNodeMapImpl \
org.mozilla.dom.NodeImpl \
org.mozilla.dom.NodeListImpl \
org.mozilla.dom.NotationImpl \
org.mozilla.dom.ProcessingInstructionImpl \
org.mozilla.dom.TextImpl \
org.mozilla.dom.events.EventImpl \
org.mozilla.dom.events.MouseEventImpl \
org.mozilla.dom.events.UIEventImpl \
$(NULL)
JAVAH_PROG=$(JDKHOME)/bin/javah
JAVAH_FLAGS=-jni -classpath $(CLASSPATH):$(JAVA_DESTPATH)
export::
$(JAVAH_PROG) $(JAVAH_FLAGS) $(JAVA_CLS)
clobber::
rm -f org_*.h

View File

@@ -1,84 +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):
DEPTH = ../../..
topsrcdir = $(DEPTH)
srcdir = $(topsrcdir)/java/dom/jni
VPATH = $(topsrcdir)/java/dom/jni
JAVAHOME = $(JDKHOME)
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = javadomjni
CPPSRCS = \
javaDOMGlobals.cpp \
javaDOMEventsGlobals.cpp \
nativeDOMProxyListener.cpp \
org_mozilla_dom_DOMAccessor.cpp \
org_mozilla_dom_AttrImpl.cpp \
org_mozilla_dom_CharacterDataImpl.cpp \
org_mozilla_dom_DocumentImpl.cpp \
org_mozilla_dom_DocumentTypeImpl.cpp \
org_mozilla_dom_DOMImplementationImpl.cpp \
org_mozilla_dom_ElementImpl.cpp \
org_mozilla_dom_EntityImpl.cpp \
org_mozilla_dom_NamedNodeMapImpl.cpp \
org_mozilla_dom_NodeImpl.cpp \
org_mozilla_dom_NodeListImpl.cpp \
org_mozilla_dom_NotationImpl.cpp \
org_mozilla_dom_ProcessingInstructionImpl.cpp \
org_mozilla_dom_TextImpl.cpp \
org_mozilla_dom_events_EventImpl.cpp \
org_mozilla_dom_events_UIEventImpl.cpp \
org_mozilla_dom_events_MouseEventImpl.cpp
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk
JAVA_CLS= \
org.mozilla.dom.DOMAccessor \
org.mozilla.dom.AttrImpl \
org.mozilla.dom.CharacterDataImpl \
org.mozilla.dom.DocumentImpl \
org.mozilla.dom.DocumentTypeImpl \
org.mozilla.dom.DOMImplementationImpl \
org.mozilla.dom.ElementImpl \
org.mozilla.dom.EntityImpl \
org.mozilla.dom.NamedNodeMapImpl \
org.mozilla.dom.NodeImpl \
org.mozilla.dom.NodeListImpl \
org.mozilla.dom.NotationImpl \
org.mozilla.dom.ProcessingInstructionImpl \
org.mozilla.dom.TextImpl \
org.mozilla.dom.events.EventImpl \
org.mozilla.dom.events.MouseEventImpl \
org.mozilla.dom.events.UIEventImpl \
$(NULL)
JAVAH_PROG=$(JDKHOME)/bin/javah
JAVAH_FLAGS=-jni -classpath $(CLASSPATH):$(JAVA_DESTPATH)
export::
$(JAVAH_PROG) $(JAVAH_FLAGS) $(JAVA_CLS)
clobber::
rm -f org_*.h

View File

@@ -1,268 +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 "prlog.h"
#include "prmon.h"
#include "nsAutoLock.h"
#include "javaDOMEventsGlobals.h"
#include "nsIDOMEvent.h"
#include "nsIDOMUIEvent.h"
jclass JavaDOMEventsGlobals::eventClass = NULL;
jclass JavaDOMEventsGlobals::uiEventClass = NULL;
jclass JavaDOMEventsGlobals::eventListenerClass = NULL;
jclass JavaDOMEventsGlobals::eventTargetClass = NULL;
jclass JavaDOMEventsGlobals::mouseEventClass = NULL;
jclass JavaDOMEventsGlobals::mutationEventClass = NULL;
jfieldID JavaDOMEventsGlobals::eventPtrFID = NULL;
jfieldID JavaDOMEventsGlobals::eventTargetPtrFID = NULL;
jfieldID JavaDOMEventsGlobals::eventPhaseBubblingFID = NULL;
jfieldID JavaDOMEventsGlobals::eventPhaseCapturingFID = NULL;
jfieldID JavaDOMEventsGlobals::eventPhaseAtTargetFID = NULL;
jmethodID JavaDOMEventsGlobals::eventListenerHandleEventMID = NULL;
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDOMUIEventIID, NS_IDOMUIEVENT_IID);
void JavaDOMEventsGlobals::Initialize(JNIEnv *env)
{
eventClass = env->FindClass("org/mozilla/dom/events/EventImpl");
if (!eventClass) {
JavaDOMGlobals::ThrowException(env, "Class org.mozilla.dom.events.EventImpl not found");
return;
}
eventClass = (jclass) env->NewGlobalRef(eventClass);
if (!eventClass)
return;
eventPtrFID =
env->GetFieldID(eventClass, "p_nsIDOMEvent", "J");
if (!eventPtrFID) {
JavaDOMGlobals::ThrowException(env, "There is no field p_nsIDOMEvent in org.mozilla.dom.events.EventImpl");
return;
}
eventListenerClass = env->FindClass("org/w3c/dom/events/EventListener");
if (!eventListenerClass) {
JavaDOMGlobals::ThrowException(env, "Class org.w3c.dom.events.EventListener not found");
return;
}
eventListenerClass = (jclass) env->NewGlobalRef(eventListenerClass);
if (!eventListenerClass)
return;
eventListenerHandleEventMID = env->GetMethodID(
eventListenerClass, "handleEvent", "(Lorg/w3c/dom/events/Event;)V");
if (!eventListenerHandleEventMID) {
JavaDOMGlobals::ThrowException(env, "There is no method handleEvent in org.w3c.dom.events.EventListener");
return;
}
uiEventClass = env->FindClass("org/mozilla/dom/events/UIEventImpl");
if (!uiEventClass) {
JavaDOMGlobals::ThrowException(env, "Class org.mozilla.dom.events.UIEventImpl not found");
return;
}
uiEventClass = (jclass) env->NewGlobalRef(uiEventClass);
if (!uiEventClass)
return;
eventPhaseBubblingFID =
env->GetStaticFieldID(eventClass, "BUBBLING_PHASE", "S");
if (!eventPhaseBubblingFID) {
JavaDOMGlobals::ThrowException(env, "There is no static field BUBBLING_PHASE in org.w3c.dom.events.Event");
return;
}
eventPhaseCapturingFID =
env->GetStaticFieldID(eventClass, "CAPTURING_PHASE", "S");
if (!eventPhaseCapturingFID) {
JavaDOMGlobals::ThrowException(env, "There is no static field CAPTURING_PHASE in org.w3c.dom.events.Event");
return;
}
eventPhaseAtTargetFID =
env->GetStaticFieldID(eventClass, "AT_TARGET", "S");
if (!eventPhaseAtTargetFID) {
JavaDOMGlobals::ThrowException(env, "There is no static field AT_TARGET in org.w3c.dom.events.Event");
return;
}
mouseEventClass = env->FindClass("org/mozilla/dom/events/MouseEventImpl");
if (!mouseEventClass) {
JavaDOMGlobals::ThrowException(env, "Class org.mozilla.dom.events.MouseEventImpl not found");
return;
}
mouseEventClass = (jclass) env->NewGlobalRef(mouseEventClass);
if (!mouseEventClass)
return;
}
void JavaDOMEventsGlobals::Destroy(JNIEnv *env)
{
env->DeleteGlobalRef(eventClass);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("JavaDOMEventsGlobals::Destroy: failed to delete Event global ref %x\n",
eventClass));
return;
}
eventClass = NULL;
env->DeleteGlobalRef(eventListenerClass);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("JavaDOMEventsGlobals::Destroy: failed to delete EventListener global ref %x\n",
eventListenerClass));
return;
}
eventListenerClass = NULL;
env->DeleteGlobalRef(uiEventClass);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("JavaDOMEventsGlobals::Destroy: failed to delete UIEvent global ref %x\n",
uiEventClass));
return;
}
uiEventClass = NULL;
env->DeleteGlobalRef(mouseEventClass);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("JavaDOMEventsGlobals::Destroy: failed to delete mouseEvent global ref %x\n",
mouseEventClass));
return;
}
mouseEventClass = NULL;
}
//returns true if specified event "type" exists in the given list of types
// NOTE: it is assumed that "types" list is enden with NULL
static jboolean isEventOfType(const char* const* types, const char* type)
{
int i=0;
while (type && types && types[i]) {
if (!strcmp(type,types[i]))
return JNI_TRUE;
i++;
}
return JNI_FALSE;
}
jobject JavaDOMEventsGlobals::CreateEventSubtype(JNIEnv *env,
nsIDOMEvent *event)
{
jobject jevent;
jclass clazz = eventClass;
nsISupports *isupports;
void *target;
nsresult rv;
isupports = (nsISupports *) event;
//check whenever our Event is UIEvent
rv = isupports->QueryInterface(kIDOMUIEventIID, (void **) &target);
if (!NS_FAILED(rv) && target) {
// At the moment DOM2 draft specifies set of UIEvent subclasses
// However Mozilla still presents these events as nsUIEvent
// So we need a cludge to determine proper java class to be created
static const char* const uiEventTypes[] = {
"resize",
"scroll",
"focusin",
"focusout",
"gainselection",
"loseselection",
"activate",
NULL
};
static const char* const mouseEventTypes[] = {
"click",
"mousedown",
"mouseup",
"mouseover",
"mousemove",
"mouseout",
NULL
};
nsString eventType;
rv = event->GetType(eventType);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.getType at JavaDOMEventsGlobals: failed");
return NULL;
}
char* buffer = nsnull;
if (eventType.IsUnicode()) {
buffer = eventType.ToNewUTF8String();
} else {
buffer = eventType.ToNewCString();
}
if (isEventOfType(mouseEventTypes, buffer) == JNI_TRUE) {
clazz = mouseEventClass;
} else if (isEventOfType(uiEventTypes, buffer) == JNI_TRUE) {
clazz = uiEventClass;
} else {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("Unknown type of UI event (%s)", buffer));
clazz = uiEventClass;
}
nsString::Recycle(&eventType);
event->Release();
event = (nsIDOMEvent *) target;
}
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("JavaDOMEventsGlobals::CreateEventSubtype: allocating Node of clazz=%x\n",
clazz));
jevent = env->AllocObject(clazz);
if (!jevent) {
JavaDOMGlobals::ThrowException(env,
"JavaDOMEventsGlobals::CreateEventSubtype: failed to allocate Event object");
return NULL;
}
env->SetLongField(jevent, eventPtrFID, (jlong) event);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("JavaDOMEventGlobals::CreateEventSubtype: failed to set native ptr %x\n",
(jlong) event));
return NULL;
}
event->AddRef();
return jevent;
}

View File

@@ -1,56 +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 __JavaDOMEventsGlobals_h__
#define __JavaDOMEventsGlobals_h__
#include"javaDOMGlobals.h"
#include"nsIDOMEvent.h"
class JavaDOMEventsGlobals {
public:
static jclass eventClass;
static jclass eventListenerClass;
static jclass eventTargetClass;
static jclass uiEventClass;
static jclass mutationEventClass;
static jclass mouseEventClass;
static jfieldID eventPtrFID;
static jfieldID eventTargetPtrFID;
static jfieldID eventPhaseBubblingFID;
static jfieldID eventPhaseCapturingFID;
static jfieldID eventPhaseAtTargetFID;
static jmethodID eventListenerHandleEventMID;
static void Initialize(JNIEnv *env);
static void Destroy(JNIEnv *env);
static jobject CreateEventSubtype(JNIEnv *env,
nsIDOMEvent *event);
static jlong RegisterNativeEventListener();
static jlong UnregisterNativeEventListener();
};
#endif /* __JavaDOMEventsGlobals_h__ */

View File

@@ -1,626 +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 "prlog.h"
#include "prmon.h"
#include "nsAutoLock.h"
#include "nsIDOMNode.h"
#include "javaDOMGlobals.h"
#include "javaDOMEventsGlobals.h"
jclass JavaDOMGlobals::attrClass = NULL;
jclass JavaDOMGlobals::cDataSectionClass = NULL;
jclass JavaDOMGlobals::commentClass = NULL;
jclass JavaDOMGlobals::documentClass = NULL;
jclass JavaDOMGlobals::documentFragmentClass = NULL;
jclass JavaDOMGlobals::documentTypeClass = NULL;
jclass JavaDOMGlobals::domImplementationClass = NULL;
jclass JavaDOMGlobals::elementClass = NULL;
jclass JavaDOMGlobals::entityClass = NULL;
jclass JavaDOMGlobals::entityReferenceClass = NULL;
jclass JavaDOMGlobals::namedNodeMapClass = NULL;
jclass JavaDOMGlobals::nodeClass = NULL;
jclass JavaDOMGlobals::nodeListClass = NULL;
jclass JavaDOMGlobals::notationClass = NULL;
jclass JavaDOMGlobals::processingInstructionClass = NULL;
jclass JavaDOMGlobals::textClass = NULL;
jfieldID JavaDOMGlobals::nodePtrFID = NULL;
jfieldID JavaDOMGlobals::nodeListPtrFID = NULL;
jfieldID JavaDOMGlobals::domImplementationPtrFID = NULL;
jfieldID JavaDOMGlobals::namedNodeMapPtrFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeAttributeFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeCDataSectionFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeCommentFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeDocumentFragmentFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeDocumentFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeDocumentTypeFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeElementFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeEntityFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeEntityReferenceFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeNotationFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeProcessingInstructionFID = NULL;
jfieldID JavaDOMGlobals::nodeTypeTextFID = NULL;
jclass JavaDOMGlobals::domExceptionClass = NULL;
jmethodID JavaDOMGlobals::domExceptionInitMID = NULL;
jclass JavaDOMGlobals::runtimeExceptionClass = NULL;
jmethodID JavaDOMGlobals::runtimeExceptionInitMID = NULL;
const char* const JavaDOMGlobals::DOM_EXCEPTION_MESSAGE[] =
{"Invalid DOM error code",
"Index is out of bounds",
"Could not fit text",
"Wrong hierarchy request",
"Wrong document usage",
"Invalid character",
"Data is unsupported",
"Modification disallowed",
"Node not found",
"Type is unsupported",
"Attribute is alreay in use",
"Invalid state",
"Syntax error",
"Invalid modification",
"Namespace error",
"Invalid access"};
PRLogModuleInfo* JavaDOMGlobals::log = NULL;
PRCList JavaDOMGlobals::garbage = PR_INIT_STATIC_CLIST(&garbage);
PRLock* JavaDOMGlobals::garbageLock = NULL;
PRInt32 JavaDOMGlobals::javaMaxInt = 0;
class jniDOMGarbage : public PRCList {
public:
jniDOMGarbage(nsISupports* p) { domObject = p; }
nsISupports* domObject;
};
void JavaDOMGlobals::Initialize(JNIEnv *env)
{
garbageLock = PR_NewLock();
log = PR_NewLogModule("javadom");
PR_INIT_CLIST(&garbage);
/* Node is loaded first because it is the base class of a lot of the
others */
nodeClass = env->FindClass("org/mozilla/dom/NodeImpl");
if (!nodeClass) return;
nodeClass = (jclass) env->NewGlobalRef(nodeClass);
if (!nodeClass) return;
nodePtrFID =
env->GetFieldID(nodeClass, "p_nsIDOMNode", "J");
if (!nodePtrFID) return;
attrClass = env->FindClass("org/mozilla/dom/AttrImpl");
if (!attrClass) return;
attrClass = (jclass) env->NewGlobalRef(attrClass);
if (!attrClass) return;
cDataSectionClass = env->FindClass("org/mozilla/dom/CDATASectionImpl");
if (!cDataSectionClass) return;
cDataSectionClass = (jclass) env->NewGlobalRef(cDataSectionClass);
if (!cDataSectionClass) return;
commentClass = env->FindClass("org/mozilla/dom/CommentImpl");
if (!commentClass) return;
commentClass = (jclass) env->NewGlobalRef(commentClass);
if (!commentClass) return;
documentClass = env->FindClass("org/mozilla/dom/DocumentImpl");
if (!documentClass) return;
documentClass = (jclass) env->NewGlobalRef(documentClass);
if (!documentClass) return;
documentFragmentClass = env->FindClass("org/mozilla/dom/DocumentFragmentImpl");
if (!documentFragmentClass) return;
documentFragmentClass = (jclass) env->NewGlobalRef(documentFragmentClass);
if (!documentFragmentClass) return;
documentTypeClass = env->FindClass("org/mozilla/dom/DocumentTypeImpl");
if (!documentTypeClass) return;
documentTypeClass = (jclass) env->NewGlobalRef(documentTypeClass);
if (!documentTypeClass) return;
domImplementationClass = env->FindClass("org/mozilla/dom/DOMImplementationImpl");
if (!domImplementationClass) return;
domImplementationClass = (jclass) env->NewGlobalRef(domImplementationClass);
if (!domImplementationClass) return;
domImplementationPtrFID =
env->GetFieldID(domImplementationClass, "p_nsIDOMDOMImplementation", "J");
if (!domImplementationPtrFID) return;
elementClass = env->FindClass("org/mozilla/dom/ElementImpl");
if (!elementClass) return;
elementClass = (jclass) env->NewGlobalRef(elementClass);
if (!elementClass) return;
entityClass = env->FindClass("org/mozilla/dom/EntityImpl");
if (!entityClass) return;
entityClass = (jclass) env->NewGlobalRef(entityClass);
if (!entityClass) return;
entityReferenceClass = env->FindClass("org/mozilla/dom/EntityReferenceImpl");
if (!entityReferenceClass) return;
entityReferenceClass = (jclass) env->NewGlobalRef(entityReferenceClass);
if (!entityReferenceClass) return;
namedNodeMapClass = env->FindClass("org/mozilla/dom/NamedNodeMapImpl");
if (!namedNodeMapClass) return;
namedNodeMapPtrFID =
env->GetFieldID(namedNodeMapClass, "p_nsIDOMNamedNodeMap", "J");
if (!namedNodeMapPtrFID) return;
namedNodeMapClass = (jclass) env->NewGlobalRef(namedNodeMapClass);
if (!namedNodeMapClass) return;
nodeListClass = env->FindClass("org/mozilla/dom/NodeListImpl");
if (!nodeListClass) return;
nodeListClass = (jclass) env->NewGlobalRef(nodeListClass);
if (!nodeListClass) return;
nodeListPtrFID =
env->GetFieldID(nodeListClass, "p_nsIDOMNodeList", "J");
if (!nodeListPtrFID) return;
nodeTypeAttributeFID =
env->GetStaticFieldID(nodeClass, "ATTRIBUTE_NODE", "S");
if (!nodeTypeAttributeFID) return;
nodeTypeCDataSectionFID =
env->GetStaticFieldID(nodeClass, "CDATA_SECTION_NODE", "S");
if (!nodeTypeCDataSectionFID) return;
nodeTypeCommentFID =
env->GetStaticFieldID(nodeClass, "COMMENT_NODE", "S");
if (!nodeTypeCommentFID) return;
nodeTypeDocumentFragmentFID =
env->GetStaticFieldID(nodeClass, "DOCUMENT_FRAGMENT_NODE", "S");
if (!nodeTypeDocumentFragmentFID) return;
nodeTypeDocumentFID =
env->GetStaticFieldID(nodeClass, "DOCUMENT_NODE", "S");
if (!nodeTypeDocumentFID) return;
nodeTypeDocumentTypeFID =
env->GetStaticFieldID(nodeClass, "DOCUMENT_TYPE_NODE", "S");
if (!nodeTypeDocumentTypeFID) return;
nodeTypeElementFID =
env->GetStaticFieldID(nodeClass, "ELEMENT_NODE", "S");
if (!nodeTypeElementFID) return;
nodeTypeEntityFID =
env->GetStaticFieldID(nodeClass, "ENTITY_NODE", "S");
if (!nodeTypeEntityFID) return;
nodeTypeEntityReferenceFID =
env->GetStaticFieldID(nodeClass, "ENTITY_REFERENCE_NODE", "S");
if (!nodeTypeEntityReferenceFID) return;
nodeTypeNotationFID =
env->GetStaticFieldID(nodeClass, "NOTATION_NODE", "S");
if (!nodeTypeNotationFID) return;
nodeTypeProcessingInstructionFID =
env->GetStaticFieldID(nodeClass, "PROCESSING_INSTRUCTION_NODE", "S");
if (!nodeTypeProcessingInstructionFID) return;
nodeTypeTextFID =
env->GetStaticFieldID(nodeClass, "TEXT_NODE", "S");
if (!nodeTypeTextFID) return;
notationClass = env->FindClass("org/mozilla/dom/NotationImpl");
if (!notationClass) return;
notationClass = (jclass) env->NewGlobalRef(notationClass);
if (!notationClass) return;
processingInstructionClass = env->FindClass("org/mozilla/dom/ProcessingInstructionImpl");
if (!processingInstructionClass) return;
processingInstructionClass = (jclass) env->NewGlobalRef(processingInstructionClass);
if (!processingInstructionClass) return;
textClass = env->FindClass("org/mozilla/dom/TextImpl");
if (!textClass) return;
textClass = (jclass) env->NewGlobalRef(textClass);
if (!textClass) return;
domExceptionClass = env->FindClass("org/mozilla/dom/DOMExceptionImpl");
if (!domExceptionClass) return;
domExceptionClass = (jclass) env->NewGlobalRef(domExceptionClass);
if (!domExceptionClass) return;
domExceptionInitMID =
env->GetMethodID(domExceptionClass, "<init>", "(SLjava/lang/String;)V");
if (!domExceptionInitMID) return;
runtimeExceptionClass = env->FindClass("java/lang/RuntimeException");
if (!runtimeExceptionClass) return;
runtimeExceptionClass = (jclass) env->NewGlobalRef(runtimeExceptionClass);
if (!runtimeExceptionClass) return;
runtimeExceptionInitMID =
env->GetMethodID(runtimeExceptionClass, "<init>", "(Ljava/lang/String;)V");
if (!runtimeExceptionInitMID) return;
jclass integerClass = env->FindClass("java/lang/Integer");
jfieldID javaMaxIntFID =
env->GetStaticFieldID(integerClass, "MAX_VALUE", "I");
javaMaxInt = env->GetStaticIntField(integerClass, javaMaxIntFID);
//init events globals
JavaDOMEventsGlobals::Initialize(env);
}
void JavaDOMGlobals::Destroy(JNIEnv *env)
{
//destroy events stuff
JavaDOMEventsGlobals::Destroy(env);
env->DeleteGlobalRef(attrClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete Attr global ref %x\n",
attrClass));
return;
}
attrClass = NULL;
env->DeleteGlobalRef(cDataSectionClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete CDATASection global ref %x\n",
cDataSectionClass));
return;
}
cDataSectionClass = NULL;
env->DeleteGlobalRef(commentClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete Comment global ref %x\n",
commentClass));
return;
}
commentClass = NULL;
env->DeleteGlobalRef(documentClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete Document global ref %x\n",
documentClass));
return;
}
documentClass = NULL;
env->DeleteGlobalRef(documentFragmentClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete DocumentFragment global ref %x\n",
documentFragmentClass));
return;
}
documentFragmentClass = NULL;
env->DeleteGlobalRef(documentTypeClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete DocumentType global ref %x\n",
documentTypeClass));
return;
}
documentTypeClass = NULL;
env->DeleteGlobalRef(domImplementationClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete DOMImplementation global ref %x\n",
domImplementationClass));
return;
}
domImplementationClass = NULL;
env->DeleteGlobalRef(elementClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete Element global ref %x\n",
elementClass));
return;
}
elementClass = NULL;
env->DeleteGlobalRef(entityClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete Entity global ref %x\n",
entityClass));
return;
}
entityClass = NULL;
env->DeleteGlobalRef(entityReferenceClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete EntityReference global ref %x\n",
entityReferenceClass));
return;
}
entityReferenceClass = NULL;
env->DeleteGlobalRef(namedNodeMapClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete NamedNodeMap global ref %x\n",
namedNodeMapClass));
return;
}
namedNodeMapClass = NULL;
env->DeleteGlobalRef(nodeListClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete NodeList global ref %x\n",
nodeListClass));
return;
}
nodeListClass = NULL;
env->DeleteGlobalRef(nodeClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete Node global ref %x\n",
nodeClass));
return;
}
nodeClass = NULL;
env->DeleteGlobalRef(notationClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete Notation global ref %x\n",
notationClass));
return;
}
notationClass = NULL;
env->DeleteGlobalRef(processingInstructionClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete ProcessingInstruction global ref %x\n",
processingInstructionClass));
return;
}
processingInstructionClass = NULL;
env->DeleteGlobalRef(textClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete Text global ref %x\n",
textClass));
return;
}
textClass = NULL;
env->DeleteGlobalRef(domExceptionClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete DOM Exception global ref %x\n",
domExceptionClass));
return;
}
domExceptionClass = NULL;
env->DeleteGlobalRef(runtimeExceptionClass);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::Destroy: failed to delete DOM Exception global ref %x\n",
runtimeExceptionClass));
return;
}
runtimeExceptionClass = NULL;
TakeOutGarbage();
PR_DestroyLock(garbageLock);
}
jobject JavaDOMGlobals::CreateNodeSubtype(JNIEnv *env,
nsIDOMNode *node)
{
if (!node)
return NULL;
PRUint16 nodeType = 0;
(void) node->GetNodeType(&nodeType);
jclass clazz = nodeClass;
switch (nodeType) {
case nsIDOMNode::ATTRIBUTE_NODE:
clazz = attrClass;
break;
case nsIDOMNode::CDATA_SECTION_NODE:
clazz = cDataSectionClass;
break;
case nsIDOMNode::COMMENT_NODE:
clazz = commentClass;
break;
case nsIDOMNode::DOCUMENT_NODE:
clazz = documentClass;
break;
case nsIDOMNode::DOCUMENT_FRAGMENT_NODE:
clazz = documentFragmentClass;
break;
case nsIDOMNode::DOCUMENT_TYPE_NODE:
clazz = documentTypeClass;
break;
case nsIDOMNode::ELEMENT_NODE:
clazz = elementClass;
break;
case nsIDOMNode::ENTITY_NODE:
clazz = entityClass;
break;
case nsIDOMNode::ENTITY_REFERENCE_NODE:
clazz = entityReferenceClass;
break;
case nsIDOMNode::NOTATION_NODE:
clazz = notationClass;
break;
case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
clazz = processingInstructionClass;
break;
case nsIDOMNode::TEXT_NODE:
clazz = textClass;
break;
}
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::CreateNodeSubtype: allocating Node of type %d, clazz=%x\n",
nodeType, clazz));
jobject jnode = env->AllocObject(clazz);
if (!jnode) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::CreateNodeSubtype: failed to allocate Node of type %d\n",
nodeType));
return NULL;
}
env->SetLongField(jnode, nodePtrFID, (jlong) node);
if (env->ExceptionOccurred()) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::CreateNodeSubtype: failed to set native ptr %x\n",
(jlong) node));
return NULL;
}
node->AddRef();
return jnode;
}
void JavaDOMGlobals::AddToGarbage(nsISupports* domObject)
{
nsAutoLock lock(garbageLock);
jniDOMGarbage* elem = new jniDOMGarbage(domObject);
PR_INSERT_BEFORE(elem, &garbage);
PR_LOG(log, PR_LOG_DEBUG,
("JavaDOMGlobals::AddToGarbage: Scheduling %x\n", domObject));
}
void JavaDOMGlobals::TakeOutGarbage()
{
nsAutoLock lock(garbageLock);
PRUint32 count = 0;
nsISupports* domo = NULL;
PRCList* chain = NULL;
PRCList* elem = NULL;
for (chain = PR_LIST_HEAD(&garbage);
chain != &garbage;
chain = PR_NEXT_LINK(chain)) {
delete elem;
elem = chain;
domo = ((jniDOMGarbage*) elem)->domObject;
PR_LOG(log, PR_LOG_DEBUG,
("JavaDOMGlobals::TakeOutGarbage: Releasing %x\n", domo));
domo->Release();
domo = NULL;
count++;
}
delete elem;
PR_INIT_CLIST(&garbage);
if (count)
PR_LOG(log, PR_LOG_DEBUG,
("JavaDOMGlobals::TakeOutGarbage: Released %d objects\n", count));
}
// caller must return from JNI immediately after calling this function
void JavaDOMGlobals::ThrowException(JNIEnv *env,
const char * message,
nsresult rv,
ExceptionType exceptionType) {
jthrowable newException = NULL;
if (exceptionType == EXCEPTION_DOM) {
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::ThrowException: (%x) %s: %s\n",
NS_ERROR_GET_CODE(rv),
message ? message : "",
DOM_EXCEPTION_MESSAGE[NS_ERROR_GET_CODE(rv)]));
jstring jmessage =
env->NewStringUTF(DOM_EXCEPTION_MESSAGE[NS_ERROR_GET_CODE(rv)]);
newException =
(jthrowable)env->NewObject(domExceptionClass,
domExceptionInitMID,
NS_ERROR_GET_CODE(rv),
jmessage);
} else {
char buffer[256];
const char* msg = message;
if (rv != NS_OK) {
sprintf(buffer,
"(%x.%x) %s",
NS_ERROR_GET_MODULE(rv),
NS_ERROR_GET_CODE(rv),
message ? message : "");
msg = buffer;
}
PR_LOG(log, PR_LOG_ERROR,
("JavaDOMGlobals::ThrowException: %s\n", msg));
jstring jmessage = env->NewStringUTF(msg);
newException =
(jthrowable)env->NewObject(runtimeExceptionClass,
runtimeExceptionInitMID,
jmessage);
}
if (newException != NULL) {
env->Throw(newException);
}
// an exception is thrown in any case
}
nsString* JavaDOMGlobals::GetUnicode(JNIEnv *env,
jstring jstr)
{
jboolean iscopy = JNI_FALSE;
const jchar* name = env->GetStringChars(jstr, &iscopy);
if (!name) {
ThrowException(env, "GetStringChars failed");
return NULL;
}
nsString* ustr = new nsString((PRUnichar*)name,
env->GetStringLength(jstr));
env->ReleaseStringChars(jstr, name);
return ustr;
}

View File

@@ -1,111 +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 __JavaDOMGlobals_h__
#define __JavaDOMGlobals_h__
#include "jni.h"
#include "prclist.h"
#include "nsError.h"
#include "nsString.h"
// workaround for bug 30927
#ifdef ERROR
#undef ERROR
#endif
class nsISupports;
class nsIDOMNode;
struct PRLogModuleInfo;
struct PRLock;
class JavaDOMGlobals {
public:
static jclass attrClass;
static jclass cDataSectionClass;
static jclass commentClass;
static jclass documentClass;
static jclass documentFragmentClass;
static jclass documentTypeClass;
static jclass domImplementationClass;
static jclass elementClass;
static jclass entityClass;
static jclass entityReferenceClass;
static jclass namedNodeMapClass;
static jclass nodeClass;
static jclass nodeListClass;
static jclass notationClass;
static jclass processingInstructionClass;
static jclass textClass;
static jfieldID nodePtrFID;
static jfieldID nodeListPtrFID;
static jfieldID domImplementationPtrFID;
static jfieldID namedNodeMapPtrFID;
static jfieldID nodeTypeAttributeFID;
static jfieldID nodeTypeCDataSectionFID;
static jfieldID nodeTypeCommentFID;
static jfieldID nodeTypeDocumentFragmentFID;
static jfieldID nodeTypeDocumentFID;
static jfieldID nodeTypeDocumentTypeFID;
static jfieldID nodeTypeElementFID;
static jfieldID nodeTypeEntityFID;
static jfieldID nodeTypeEntityReferenceFID;
static jfieldID nodeTypeNotationFID;
static jfieldID nodeTypeProcessingInstructionFID;
static jfieldID nodeTypeTextFID;
static jclass domExceptionClass;
static jmethodID domExceptionInitMID;
static jclass runtimeExceptionClass;
static jmethodID runtimeExceptionInitMID;
static const char* const DOM_EXCEPTION_MESSAGE[];
typedef enum ExceptionType { EXCEPTION_RUNTIME,
EXCEPTION_DOM } ExceptionType;
static PRLogModuleInfo* log;
static PRCList garbage;
static PRLock* garbageLock;
static PRInt32 javaMaxInt;
static void Initialize(JNIEnv *env);
static void Destroy(JNIEnv *env);
static jobject CreateNodeSubtype(JNIEnv *env,
nsIDOMNode *node);
static void AddToGarbage(nsISupports* domObject);
static void TakeOutGarbage();
static void ThrowException(JNIEnv *env,
const char * message = NULL,
nsresult rv = NS_OK,
ExceptionType exceptionType = EXCEPTION_RUNTIME);
static nsString* GetUnicode(JNIEnv *env,
jstring str);
};
#endif /* __JavaDOMGlobals_h__ */

View File

@@ -1,128 +0,0 @@
#!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
# 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):
DEPTH=..\..\..
IGNORE_MANIFEST=1
DEFINES=-D_IMPL_NS_WEB -DWIN32_LEAN_AND_MEAN
MODULE=javadomjni
CPPSRCS= \
javaDOMGlobals.cpp \
javaDOMEventsGlobals.cpp \
nativeDOMProxyListener.cpp \
org_mozilla_dom_DOMAccessor.cpp \
org_mozilla_dom_AttrImpl.cpp \
org_mozilla_dom_CharacterDataImpl.cpp \
org_mozilla_dom_DocumentImpl.cpp \
org_mozilla_dom_DocumentTypeImpl.cpp \
org_mozilla_dom_DOMImplementationImpl.cpp \
org_mozilla_dom_ElementImpl.cpp \
org_mozilla_dom_EntityImpl.cpp \
org_mozilla_dom_NamedNodeMapImpl.cpp \
org_mozilla_dom_NodeImpl.cpp \
org_mozilla_dom_NodeListImpl.cpp \
org_mozilla_dom_NotationImpl.cpp \
org_mozilla_dom_ProcessingInstructionImpl.cpp \
org_mozilla_dom_TextImpl.cpp \
org_mozilla_dom_events_EventImpl.cpp \
org_mozilla_dom_events_MouseEventImpl.cpp \
org_mozilla_dom_events_UIEventImpl.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\javaDOMGlobals.obj \
.\$(OBJDIR)\javaDOMEventsGlobals.obj \
.\$(OBJDIR)\nativeDOMProxyListener.obj \
.\$(OBJDIR)\org_mozilla_dom_DOMAccessor.obj \
.\$(OBJDIR)\org_mozilla_dom_AttrImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_CharacterDataImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_DocumentImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_DocumentTypeImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_DOMImplementationImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_ElementImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_EntityImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_NamedNodeMapImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_NodeImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_NodeListImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_NotationImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_ProcessingInstructionImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_TextImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_events_EventImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_events_UIEventImpl.obj \
.\$(OBJDIR)\org_mozilla_dom_events_MouseEventImpl.obj \
$(NULL)
JAVA_CLS= \
org.mozilla.dom.DOMAccessor \
org.mozilla.dom.AttrImpl \
org.mozilla.dom.CharacterDataImpl \
org.mozilla.dom.DocumentImpl \
org.mozilla.dom.DocumentTypeImpl \
org.mozilla.dom.DOMImplementationImpl \
org.mozilla.dom.ElementImpl \
org.mozilla.dom.EntityImpl \
org.mozilla.dom.NamedNodeMapImpl \
org.mozilla.dom.NodeImpl \
org.mozilla.dom.NodeListImpl \
org.mozilla.dom.NotationImpl \
org.mozilla.dom.ProcessingInstructionImpl \
org.mozilla.dom.TextImpl \
org.mozilla.dom.events.EventImpl \
org.mozilla.dom.events.MouseEventImpl \
org.mozilla.dom.events.UIEventImpl \
$(NULL)
LINCS=
MAKE_OBJ_TYPE = DLL
DLLNAME = javadomjni
DLL=.\$(OBJDIR)\$(DLLNAME).dll
LIBRARY_NAME=javadomimpl
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
# These are the libraries we need to link with to create the dll
LLIBS= \
$(DIST)\lib\xpcom.lib \
$(LIBNSPR)
include <$(DEPTH)\config\config.mak>
include <$(DEPTH)\config\rules.mak>
JAVAH_PROG=$(JDKHOME)\bin\javah
JAVAH_FLAGS=-jni -classpath $(CLASSPATH);$(JAVA_DESTPATH)
export::
$(JAVAH_PROG) $(JAVAH_FLAGS) $(JAVA_CLS)
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\$(DLLNAME).dll
rm -f $(DIST)\lib\$(DLLNAME).lib
rm -f org_*.h

View File

@@ -1,130 +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<stdio.h>
#include"prlog.h"
#include"nativeDOMProxyListener.h"
#include"nsIDOMNode.h"
#include"nsIDOMEventTarget.h"
#include"nsIDOMEventListener.h"
#include"javaDOMEventsGlobals.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDOMEventListener, NS_IDOMEVENTLISTENER_IID);
NativeDOMProxyListener::NativeDOMProxyListener(JNIEnv *env, jobject jlistener)
{
mRefCnt = 0;
listener = env->NewGlobalRef(jlistener);
if (env->GetJavaVM(&vm) != 0)
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NativeDOMProxyListener: Can't objant jvm\n"));
}
//should be called oly from NativeDOMProxyListener::Release
NativeDOMProxyListener::~NativeDOMProxyListener()
{
JNIEnv *env;
if (vm->AttachCurrentThread( &env, NULL) != 0)
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NativeDOMProxyListener: Can't attach current thread to JVM\n"));
env->DeleteGlobalRef(listener);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("NativeDOMProxyListener::Destroy: failed to delete EventListener global ref %x\n",
listener));
return;
}
}
nsresult NativeDOMProxyListener::HandleEvent(nsIDOMEvent* aEvent)
{
jobject jevent;
JNIEnv *env;
if (vm->AttachCurrentThread( &env, NULL) != 0) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NativeDOMProxyListener:HandleEvent Can't attach current thread to JVM\n"));
return NS_ERROR_FAILURE;
}
jevent = JavaDOMEventsGlobals::CreateEventSubtype(env, aEvent);
if (!jevent) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NativeDOMProxyListener::HandleEvent Can't create java event object"));
return NS_ERROR_FAILURE;
}
env->CallVoidMethod(listener,
JavaDOMEventsGlobals::eventListenerHandleEventMID,
jevent);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("NativeDOMProxyListener::HandleEvent: failed to call EventListener %x\n",
listener));
return NS_ERROR_FAILURE;
}
return NS_OK;
}
nsresult NativeDOMProxyListener::QueryInterface(const nsIID &aIID, void **aResult)
{
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aResult = NULL;
if (aIID.Equals(kISupportsIID)) {
*aResult = (void *) this;
} else if (aIID.Equals(kIDOMEventListener)) {
*aResult = (void *) this;
}
if (aResult != NULL) {
return NS_ERROR_NO_INTERFACE;
}
AddRef();
return NS_OK;
}
nsrefcnt NativeDOMProxyListener::AddRef()
{
return mRefCnt++;
}
nsrefcnt NativeDOMProxyListener::Release()
{
if (--mRefCnt == 0) {
delete this;
return 0; // Don't access mRefCnt after deleting!
}
return mRefCnt;
}

View File

@@ -1,29 +0,0 @@
#ifndef __JAVA_DOM_NATIVE_PROXY_LISTENER__
#define __JAVA_DOM_NATIVE_PROXY_LISTENER__
#include"nsIDOMEventListener.h"
#include"jni.h"
class NativeDOMProxyListener: public nsIDOMEventListener{
private:
JavaVM *vm;
jobject listener;
nsrefcnt mRefCnt;
//to be used only by Release()
virtual ~NativeDOMProxyListener();
public:
NativeDOMProxyListener(JNIEnv *env, jobject jlistener);
virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
NS_IMETHOD QueryInterface(const nsIID &aIID, void **aResult);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
};
#endif

View File

@@ -1,177 +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 "prlog.h"
#include "nsIDOMAttr.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_AttrImpl.h"
/*
* Class: org_mozilla_dom_AttrImpl
* Method: getName
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_AttrImpl_getName
(JNIEnv *env, jobject jthis)
{
nsIDOMAttr* attr = (nsIDOMAttr*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!attr) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.getName: NULL pointer\n"));
return NULL;
}
nsString name;
nsresult rv = attr->GetName(name);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.getName: failed (%x)\n", rv));
return NULL;
}
jstring jname = env->NewString(name.GetUnicode(), name.Length());
if (!jname) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.getName: NewString failed\n"));
}
return jname;
}
/*
* Class: org_mozilla_dom_AttrImpl
* Method: getSpecified
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_AttrImpl_getSpecified
(JNIEnv *env, jobject jthis)
{
nsIDOMAttr* attr = (nsIDOMAttr*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!attr) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.getSpecified: NULL pointer\n"));
return JNI_FALSE;
}
PRBool specified = PR_FALSE;
nsresult rv = attr->GetSpecified(&specified);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.getSpecified: failed (%x)\n", rv));
return JNI_FALSE;
}
return (specified == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_dom_AttrImpl
* Method: getValue
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_AttrImpl_getValue
(JNIEnv *env, jobject jthis)
{
nsIDOMAttr* attr = (nsIDOMAttr*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!attr) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.getValue: NULL pointer\n"));
return NULL;
}
nsString value;
nsresult rv = attr->GetValue(value);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.getValue: failed (%x)\n", rv));
return NULL;
}
jstring jval = env->NewString(value.GetUnicode(), value.Length());
if (!jval) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.getValue: NewString failed\n"));
}
return jval;
}
/*
* Class: org_mozilla_dom_AttrImpl
* Method: setValue
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_AttrImpl_setValue
(JNIEnv *env, jobject jthis, jstring jval)
{
nsIDOMAttr* attr = (nsIDOMAttr*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!attr || !jval) {
JavaDOMGlobals::ThrowException(env,
"Attr.setValue: NULL pointer\n");
return;
}
nsString* cstr = JavaDOMGlobals::GetUnicode(env, jval);
if (!cstr)
return;
nsresult rv = attr->SetValue(*cstr);
nsString::Recycle(cstr);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.setValue: failed (%x)\n", rv));
return;
}
}
/*
* Class: org_mozilla_dom_AttrImpl
* Method: getOwnerElement
* Signature: ()Lorg/w3c/dom/Element;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_AttrImpl_getOwnerElement
(JNIEnv *env, jobject jthis)
{
nsIDOMAttr* attr = (nsIDOMAttr*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!attr) {
JavaDOMGlobals::ThrowException(env,
"Attr.setValue: NULL pointer\n");
return NULL;
}
nsIDOMElement* aOwnerElement = nsnull;
nsresult rv = attr->GetOwnerElement(&aOwnerElement);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Attr.getOwnerElement: failed (%x)\n", rv));
return NULL;
}
return JavaDOMGlobals::CreateNodeSubtype(env, (nsIDOMNode*)aOwnerElement);
}

View File

@@ -1,323 +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 "prlog.h"
#include "nsIDOMCharacterData.h"
#include "nsDOMError.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_CharacterDataImpl.h"
/*
* Class: org_mozilla_dom_CharacterDataImpl
* Method: appendData
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_appendData
(JNIEnv *env, jobject jthis, jstring jvalue)
{
nsIDOMCharacterData* data = (nsIDOMCharacterData*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!data || !jvalue) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.appendData: NULL pointer");
return;
}
nsString* value = JavaDOMGlobals::GetUnicode(env, jvalue);
if (!value)
return;
nsresult rv = data->AppendData(*value);
nsString::Recycle(value);
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,
"CharacterData.appendData: failed", rv, exceptionType);
return;
}
}
/*
* Class: org_mozilla_dom_CharacterDataImpl
* Method: deleteData
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_deleteData
(JNIEnv *env, jobject jthis, jint offset, jint count)
{
if (offset < 0 || offset > JavaDOMGlobals::javaMaxInt ||
count < 0 || count > JavaDOMGlobals::javaMaxInt) {
JavaDOMGlobals::ThrowException(env, "CharacterData.deleteData: failed",
NS_ERROR_DOM_INDEX_SIZE_ERR,
JavaDOMGlobals::EXCEPTION_DOM);
return;
}
nsIDOMCharacterData* data = (nsIDOMCharacterData*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!data) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.deleteData: NULL pointer");
return;
}
nsresult rv = data->DeleteData((PRUint32) offset, (PRUint32) count);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_INDEX_SIZE_ERR ||
rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"CharacterData.deleteData: failed", rv, exceptionType);
return;
}
}
/*
* Class: org_mozilla_dom_CharacterDataImpl
* Method: getData
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_CharacterDataImpl_getData
(JNIEnv *env, jobject jthis)
{
nsIDOMCharacterData* data = (nsIDOMCharacterData*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!data) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.getData: NULL pointer");
return NULL;
}
nsString ret;
nsresult rv = data->GetData(ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (rv == NS_ERROR_DOM_DOMSTRING_SIZE_ERR) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"CharacterData.getData: failed", rv, exceptionType);
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.getData: NewString failed");
}
return jret;
}
/*
* Class: org_mozilla_dom_CharacterDataImpl
* Method: getLength
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_CharacterDataImpl_getLength
(JNIEnv *env, jobject jthis)
{
nsIDOMCharacterData* data = (nsIDOMCharacterData*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!data) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.getLength: NULL pointer");
return 0;
}
PRUint32 len = 0;
nsresult rv = data->GetLength(&len);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.getLength: failed", rv);
return 0;
}
return (jint) len;
}
/*
* Class: org_mozilla_dom_CharacterDataImpl
* Method: insertData
* Signature: (ILjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_insertData
(JNIEnv *env, jobject jthis, jint offset, jstring jvalue)
{
nsIDOMCharacterData* data = (nsIDOMCharacterData*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!data || !jvalue) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.insertData: NULL pointer");
return;
}
nsString* value = JavaDOMGlobals::GetUnicode(env, jvalue);
if (!value)
return;
nsresult rv = data->InsertData((PRUint32) offset, *value);
nsString::Recycle(value);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_INDEX_SIZE_ERR ||
rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"CharacterData.insertData: failed", rv, exceptionType);
return;
}
}
/*
* Class: org_mozilla_dom_CharacterDataImpl
* Method: replaceData
* Signature: (IILjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_replaceData
(JNIEnv *env, jobject jthis, jint offset, jint count, jstring jvalue)
{
if (offset < 0 || offset > JavaDOMGlobals::javaMaxInt ||
count < 0 || count > JavaDOMGlobals::javaMaxInt) {
JavaDOMGlobals::ThrowException(env, "CharacterData.replaceData: failed",
NS_ERROR_DOM_INDEX_SIZE_ERR,
JavaDOMGlobals::EXCEPTION_DOM);
return;
}
nsIDOMCharacterData* data = (nsIDOMCharacterData*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!data || !jvalue) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.replaceData: NULL pointer");
return;
}
nsString* value = JavaDOMGlobals::GetUnicode(env, jvalue);
if (!value)
return;
nsresult rv = data->ReplaceData((PRUint32) offset, (PRUint32) count, *value);
nsString::Recycle(value);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_INDEX_SIZE_ERR ||
rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"CharacterData.replaceData: failed", rv, exceptionType);
return;
}
}
/*
* Class: org_mozilla_dom_CharacterDataImpl
* Method: setData
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_setData
(JNIEnv *env, jobject jthis, jstring jvalue)
{
nsIDOMCharacterData* data = (nsIDOMCharacterData*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!data || !jvalue) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.setData: NULL pointer");
return;
}
nsString* value = JavaDOMGlobals::GetUnicode(env, jvalue);
if (!value)
return;
nsresult rv = data->SetData(*value);
nsString::Recycle(value);
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,
"CharacterData.setData: failed", rv, exceptionType);
return;
}
}
/*
* Class: org_mozilla_dom_CharacterDataImpl
* Method: substringData
* Signature: (II)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_CharacterDataImpl_substringData
(JNIEnv *env, jobject jthis, jint offset, jint count)
{
if (offset < 0 || offset > JavaDOMGlobals::javaMaxInt ||
count < 0 || count > JavaDOMGlobals::javaMaxInt) {
JavaDOMGlobals::ThrowException(env, "CharacterData.substringData: failed",
NS_ERROR_DOM_INDEX_SIZE_ERR,
JavaDOMGlobals::EXCEPTION_DOM);
return NULL;
}
nsIDOMCharacterData* data = (nsIDOMCharacterData*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!data) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.substringData: NULL pointer");
return NULL;
}
nsString ret;
nsresult rv = data->SubstringData((PRUint32) offset, (PRUint32) count, ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_INDEX_SIZE_ERR ||
rv == NS_ERROR_DOM_DOMSTRING_SIZE_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"CharacterData.substringData: failed", rv, exceptionType);
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"CharacterData.substringData: NewString failed");
}
return jret;
}

View File

@@ -1,118 +0,0 @@
#include "prlog.h"
#include "javaDOMGlobals.h"
#include "nsIDocumentLoader.h"
#include "nsIDocumentLoaderObserver.h"
#include "nsIServiceManager.h"
#include "nsCURILoader.h"
#include "nsIJavaDOM.h"
#include "org_mozilla_dom_DOMAccessor.h"
static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID);
static NS_DEFINE_IID(kJavaDOMCID, NS_JAVADOM_CID);
/*
* Class: org_mozilla_dom_DOMAccessor
* Method: register
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_DOMAccessor_register
(JNIEnv *env, jclass jthis)
{
if (!JavaDOMGlobals::log) {
JavaDOMGlobals::Initialize(env);
}
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIDocumentLoader, docLoaderService, kDocLoaderServiceCID, &rv);
if (NS_FAILED(rv) || !docLoaderService) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMAccessor::register: GetService(JavaDOM) failed: %x\n",
rv));
} else {
NS_WITH_SERVICE(nsIDocumentLoaderObserver, javaDOM, kJavaDOMCID, &rv);
if (NS_FAILED(rv) || !javaDOM) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMAccessor::register: GetService(JavaDOM) failed: %x\n",
rv));
} else {
rv = docLoaderService->AddObserver((nsIDocumentLoaderObserver*)javaDOM);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMAccessor::register: AddObserver(JavaDOM) failed x\n",
rv));
}
}
}
}
/*
* Class: org_mozilla_dom_DOMAccessor
* Method: unregister
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_DOMAccessor_unregister
(JNIEnv *, jclass jthis)
{
PR_LOG(JavaDOMGlobals::log, PR_LOG_DEBUG,
("DOMAccessor::unregister: unregistering %x\n", jthis));
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIDocumentLoader, docLoaderService, kDocLoaderServiceCID, &rv);
if (NS_FAILED(rv) || !docLoaderService) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMAccessor::unregister: GetService(DocLoaderService) failed %x\n",
rv));
} else {
NS_WITH_SERVICE(nsIDocumentLoaderObserver, javaDOM, kJavaDOMCID, &rv);
if (NS_FAILED(rv) || !javaDOM) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMAccessor::unregister: GetService(JavaDOM) failed %x\n",
rv));
} else {
rv = docLoaderService->RemoveObserver((nsIDocumentLoaderObserver*)javaDOM);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMAccessor::unregister: RemoveObserver(JavaDOM) failed x\n",
rv));
}
}
}
}
/*
* Class: org_mozilla_dom_DOMAccessor
* Method: createElement
* Signature: (J)Lorg/w3c/dom/Element;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DOMAccessor_getNodeByHandle
(JNIEnv *env, jclass jthis, jlong p)
{
if (!JavaDOMGlobals::log) {
JavaDOMGlobals::Initialize(env);
}
nsIDOMNode *node = (nsIDOMNode*)p;
return JavaDOMGlobals::CreateNodeSubtype(env, node);
}
/*
* Class: org_mozilla_dom_DOMAccessor
* Method: doGC
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_DOMAccessor_doGC
(JNIEnv *, jclass)
{
JavaDOMGlobals::TakeOutGarbage();
}
JNIEXPORT void JNICALL Java_org_mozilla_dom_DOMAccessor_initialize
(JNIEnv *env, jclass)
{
if (!JavaDOMGlobals::log) {
JavaDOMGlobals::Initialize(env);
}
}

View File

@@ -1,290 +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 "prlog.h"
#include "nsIDOMDOMImplementation.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_DOMImplementationImpl.h"
#include "nsDOMError.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
/*
* Class: org_mozilla_dom_DOMImplementationImpl
* Method: XPCOM_equals
* Signature: (Ljava/lang/Object;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_DOMImplementationImpl_XPCOM_1equals
(JNIEnv *env, jobject jthis, jobject jarg)
{
jboolean b_retFlag = JNI_FALSE;
nsIDOMDOMImplementation* p_this = (nsIDOMDOMImplementation*)
env->GetLongField(jthis, JavaDOMGlobals::domImplementationPtrFID);
if (!p_this) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DOMImplementation.equals: NULL pointer\n"));
return b_retFlag;
}
nsIDOMDOMImplementation* p_arg = (nsIDOMDOMImplementation*)
env->GetLongField(jarg, JavaDOMGlobals::domImplementationPtrFID);
if (!p_arg) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DOMImplementation.equals: NULL arg pointer\n"));
return b_retFlag;
}
nsISupports* thisSupports = nsnull;
nsISupports* argSupports = nsnull;
nsresult rvThis =
p_this->QueryInterface(kISupportsIID, (void**)(&thisSupports));
if (NS_FAILED(rvThis) || !thisSupports) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMImplementation.equals: this->QueryInterface failed (%x)\n",
rvThis));
return b_retFlag;
}
nsresult rvArg =
p_arg->QueryInterface(kISupportsIID, (void**)(&argSupports));
if (NS_FAILED(rvArg) || !argSupports) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMImplementation.equals: arg->QueryInterface failed (%x)\n",
rvArg));
thisSupports->Release();
return b_retFlag;
}
if (thisSupports == argSupports)
b_retFlag = JNI_TRUE;
thisSupports->Release();
argSupports->Release();
return b_retFlag;
}
/*
* Class: org_mozilla_dom_DOMImplementationImpl
* Method: XPCOM_hashCode
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_DOMImplementationImpl_XPCOM_1hashCode
(JNIEnv *env, jobject jthis)
{
nsIDOMDOMImplementation* p_this = (nsIDOMDOMImplementation*)
env->GetLongField(jthis, JavaDOMGlobals::domImplementationPtrFID);
if (!p_this) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DOMImplementation.hashCode: NULL pointer\n"));
return (jint) 0;
}
nsISupports* thisSupports = nsnull;
nsresult rvThis =
p_this->QueryInterface(kISupportsIID, (void**)(&thisSupports));
if (NS_FAILED(rvThis) || !thisSupports) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMImplementation.hashCode: QueryInterface failed (%x)\n",
rvThis));
return (jint) 0;
}
thisSupports->Release();
return (jint) thisSupports;
}
/*
* Class: org_mozilla_dom_DOMImplementationImpl
* Method: finalize
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_DOMImplementationImpl_finalize
(JNIEnv *env, jobject jthis)
{
nsIDOMDOMImplementation* dom = (nsIDOMDOMImplementation*)
env->GetLongField(jthis, JavaDOMGlobals::domImplementationPtrFID);
if (!dom) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DOMImplementation.finalize: NULL pointer\n"));
return;
}
JavaDOMGlobals::AddToGarbage(dom);
}
/*
* Class: org_mozilla_dom_DOMImplementationImpl
* Method: hasFeature
* Signature: (Ljava/lang/String;Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_DOMImplementationImpl_hasFeature
(JNIEnv *env, jobject jthis, jstring jfeature, jstring jversion)
{
nsIDOMDOMImplementation* dom = (nsIDOMDOMImplementation*)
env->GetLongField(jthis, JavaDOMGlobals::domImplementationPtrFID);
if (!dom || !jfeature) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DOMImplementation.hasFeature: NULL pointer\n"));
return JNI_FALSE;
}
nsString* feature = JavaDOMGlobals::GetUnicode(env, jfeature);
if (!feature)
return JNI_FALSE;
nsString* version;
if (jversion) {
version = JavaDOMGlobals::GetUnicode(env, jversion);
if (!version) {
nsString::Recycle(feature);
return JNI_FALSE;
}
} else {
version = new nsString();
}
PRBool ret = PR_FALSE;
nsresult rv = dom->HasFeature(*feature, *version, &ret);
nsString::Recycle(feature);
nsString::Recycle(version);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DOMImplementation.hasFeature: failed (%x)\n", rv));
}
return ret == PR_TRUE ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_dom_DOMImplementationImpl
* Method: createDocumentType
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/w3c/dom/DocumentType;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DOMImplementationImpl_createDocumentType
(JNIEnv *env, jobject jthis, jstring jqualifiedName, jstring jpublicID, jstring jsystemID)
{
nsIDOMDOMImplementation* dom = (nsIDOMDOMImplementation*)
env->GetLongField(jthis, JavaDOMGlobals::domImplementationPtrFID);
if (!dom || !jqualifiedName || !jpublicID || !jsystemID) {
JavaDOMGlobals::ThrowException(env,
"DOMImplementation.createDocumentType: NULL pointer");
return NULL;
}
nsString* qualifiedName = JavaDOMGlobals::GetUnicode(env, jqualifiedName);
if (!qualifiedName)
return NULL;
nsString* publicID = JavaDOMGlobals::GetUnicode(env, jpublicID);
if (!publicID) {
nsString::Recycle(qualifiedName);
return NULL;
}
nsString* systemID = JavaDOMGlobals::GetUnicode(env, jsystemID);
if (!systemID) {
nsString::Recycle(qualifiedName);
nsString::Recycle(publicID);
return NULL;
}
nsIDOMDocumentType* docType = nsnull;
nsresult rv = dom->CreateDocumentType(*qualifiedName, *publicID, *systemID, &docType);
nsString::Recycle(qualifiedName);
nsString::Recycle(publicID);
nsString::Recycle(systemID);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_INVALID_CHARACTER_ERR ||
rv == NS_ERROR_DOM_NAMESPACE_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"DOMImplementation.createDocumentType: failed", rv, exceptionType);
return NULL;
}
return JavaDOMGlobals::CreateNodeSubtype(env, (nsIDOMNode*)docType);
}
/*
* Class: org_mozilla_dom_DOMImplementationImpl
* Method: createDocument
* Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/w3c/dom/DocumentType;)Lorg/w3c/dom/Document;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DOMImplementationImpl_createDocument
(JNIEnv *env, jobject jthis, jstring jnamespaceURI, jstring jqualifiedName, jobject jdoctype)
{
nsIDOMDOMImplementation* dom = (nsIDOMDOMImplementation*)
env->GetLongField(jthis, JavaDOMGlobals::domImplementationPtrFID);
if (!dom || !jnamespaceURI || !jqualifiedName) {
JavaDOMGlobals::ThrowException(env,
"DOMImplementation.createDocument: NULL pointer");
return NULL;
}
nsString* namespaceURI = JavaDOMGlobals::GetUnicode(env, jnamespaceURI);
if (!namespaceURI)
return NULL;
nsString* qualifiedName = JavaDOMGlobals::GetUnicode(env, jqualifiedName);
if (!qualifiedName) {
nsString::Recycle(namespaceURI);
return NULL;
}
nsIDOMDocumentType* docType = nsnull;
if (jdoctype) {
docType = (nsIDOMDocumentType*)
env->GetLongField(jdoctype, JavaDOMGlobals::nodeListPtrFID);
if (!docType) {
JavaDOMGlobals::ThrowException(env,
"DOMImplementation.createDocument: NULL arg pointer");
return NULL;
}
}
nsIDOMDocument* doc = nsnull;
nsresult rv = dom->CreateDocument(*namespaceURI, *qualifiedName, docType, &doc);
nsString::Recycle(namespaceURI);
nsString::Recycle(qualifiedName);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_INVALID_CHARACTER_ERR ||
rv == NS_ERROR_DOM_NAMESPACE_ERR ||
rv == NS_ERROR_DOM_WRONG_DOCUMENT_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"DOMImplementation.createDocument: failed", rv, exceptionType);
return NULL;
}
return JavaDOMGlobals::CreateNodeSubtype(env, (nsIDOMNode*)doc);
}

View File

@@ -1,759 +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 "prlog.h"
#include "nsIDOMDocument.h"
#include "nsIDOMAttr.h"
#include "nsIDOMComment.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMCDATASection.h"
#include "nsIDOMEntityReference.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMDocumentEvent.h"
#include "nsDOMError.h"
#include "javaDOMGlobals.h"
#include "javaDOMEventsGlobals.h"
#include "org_mozilla_dom_DocumentImpl.h"
static NS_DEFINE_IID(kIDOMDocumentEventIID, NS_IDOMDOCUMENTEVENT_IID);
// undefine macros from WINBASE.H
#ifdef CreateEvent
#undef CreateEvent
#endif
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: createAttribute
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/Attr;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createAttribute
(JNIEnv *env, jobject jthis, jstring jname)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jname) {
JavaDOMGlobals::ThrowException(env,
"Document.createAttribute: NULL pointer");
return NULL;
}
nsIDOMAttr* ret = nsnull;
nsString* name = JavaDOMGlobals::GetUnicode(env, jname);
if (!name)
return NULL;
nsresult rv = doc->CreateAttribute(*name, &ret);
nsString::Recycle(name);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (rv == NS_ERROR_DOM_INVALID_CHARACTER_ERR) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Document.createAttribute: failed", rv, exceptionType);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::attrClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.createAttribute: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.createAttribute: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: createCDATASection
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/CDATASection;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createCDATASection
(JNIEnv *env, jobject jthis, jstring jdata)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jdata) {
JavaDOMGlobals::ThrowException(env,
"Document.createCDATASection: NULL pointer");
return NULL;
}
nsIDOMCDATASection* ret = nsnull;
nsString* data = JavaDOMGlobals::GetUnicode(env, jdata);
if (!data)
return NULL;
nsresult rv = doc->CreateCDATASection(*data, &ret);
nsString::Recycle(data);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (rv == NS_ERROR_DOM_NOT_SUPPORTED_ERR) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Document.createCDATASection: failed", rv, exceptionType);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::cDataSectionClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.createCDATASection: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.createCDATASection: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: createComment
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/Comment;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createComment
(JNIEnv *env, jobject jthis, jstring jdata)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jdata) {
JavaDOMGlobals::ThrowException(env,
"Document.createComment: NULL pointer");
return NULL;
}
nsIDOMComment* ret = nsnull;
nsString* data = JavaDOMGlobals::GetUnicode(env, jdata);
if (!data)
return NULL;
nsresult rv = doc->CreateComment(*data, &ret);
nsString::Recycle(data);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Document.createComment: failed", rv);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::commentClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.createComment: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.createComment: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: createDocumentFragment
* Signature: ()Lorg/w3c/dom/DocumentFragment;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createDocumentFragment
(JNIEnv *env, jobject jthis)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc) {
JavaDOMGlobals::ThrowException(env,
"Document.createDocumentFragment: NULL pointer");
return NULL;
}
nsIDOMDocumentFragment* ret = nsnull;
nsresult rv = doc->CreateDocumentFragment(&ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Document.createDocumentFragment: failed", rv);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::documentFragmentClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.createDocumentFragment: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.createDocumentFragment: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: createElement
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/Element;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createElement
(JNIEnv *env, jobject jthis, jstring jtagName)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jtagName) {
JavaDOMGlobals::ThrowException(env,
"Document.createElement: NULL pointer");
return NULL;
}
nsIDOMElement* ret = nsnull;
nsString* tagName = JavaDOMGlobals::GetUnicode(env, jtagName);
if (!tagName)
return NULL;
nsresult rv = doc->CreateElement(*tagName, &ret);
nsString::Recycle(tagName);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (rv == NS_ERROR_DOM_INVALID_CHARACTER_ERR) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Document.createElement: failed", rv, exceptionType);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::elementClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.createElement: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.createElement: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: createEntityReference
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/EntityReference;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createEntityReference
(JNIEnv *env, jobject jthis, jstring jname)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jname) {
JavaDOMGlobals::ThrowException(env,
"Document.createEntityReference: NULL pointer");
return NULL;
}
nsIDOMEntityReference* ret = nsnull;
nsString* name = JavaDOMGlobals::GetUnicode(env, jname);
if (!name)
return NULL;
nsresult rv = doc->CreateEntityReference(*name, &ret);
nsString::Recycle(name);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_INVALID_CHARACTER_ERR ||
rv == NS_ERROR_DOM_NOT_SUPPORTED_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Document.createEntityReference: failed", rv, exceptionType);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::entityReferenceClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.createEntityReference: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.createEntityReference: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: createProcessingInstruction
* Signature: (Ljava/lang/String;Ljava/lang/String;)Lorg/w3c/dom/ProcessingInstruction;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createProcessingInstruction
(JNIEnv *env, jobject jthis, jstring jtarget, jstring jdata)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jtarget || !jdata) {
JavaDOMGlobals::ThrowException(env,
"Document.createProcessingInstruction: NULL pointer");
return NULL;
}
nsIDOMProcessingInstruction* ret = nsnull;
nsString* target = JavaDOMGlobals::GetUnicode(env, jtarget);
if (!target)
return NULL;
nsString* data = JavaDOMGlobals::GetUnicode(env, jdata);
if (!data) {
nsString::Recycle(target);
return NULL;
}
nsresult rv = doc->CreateProcessingInstruction(*target, *data, &ret);
nsString::Recycle(target);
nsString::Recycle(data);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_NOT_SUPPORTED_ERR ||
rv == NS_ERROR_DOM_INVALID_CHARACTER_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Document.createProcessingInstruction failed", rv, exceptionType);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::processingInstructionClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.createProcessingInstruction: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.createProcessingInstruction: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: createTextNode
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/Text;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createTextNode
(JNIEnv *env, jobject jthis, jstring jdata)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jdata) {
JavaDOMGlobals::ThrowException(env,
"Document.createTextNode: NULL pointer");
return NULL;
}
nsIDOMText* ret = nsnull;
nsString* data = JavaDOMGlobals::GetUnicode(env, jdata);
if (!data)
return NULL;
nsresult rv = doc->CreateTextNode(*data, &ret);
nsString::Recycle(data);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Document.createTextNode failed", rv);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::textClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.createTextNode: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.createTextNode: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: getDoctype
* Signature: ()Lorg/w3c/dom/DocumentType;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_getDoctype
(JNIEnv *env, jobject jthis)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc)
return NULL;
nsIDOMDocumentType* docType = nsnull;
nsresult rv = doc->GetDoctype(&docType);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Document.getDoctype: failed", rv);
return NULL;
}
if (!docType)
return NULL;
jobject jDocType = env->AllocObject(JavaDOMGlobals::documentTypeClass);
if (!jDocType) {
JavaDOMGlobals::ThrowException(env,
"Document.getDoctype: failed to allocate object");
return NULL;
}
env->SetLongField(jDocType, JavaDOMGlobals::nodePtrFID, (jlong) docType);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.getDoctype: failed to set node ptr");
return NULL;
}
docType->AddRef();
return jDocType;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: getDocumentElement
* Signature: ()Lorg/w3c/dom/Element;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_getDocumentElement
(JNIEnv *env, jobject jthis)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc) {
JavaDOMGlobals::ThrowException(env,
"Document.getDocumentElement: NULL pointer");
return NULL;
}
nsIDOMElement* element = nsnull;
nsresult rv = doc->GetDocumentElement(&element);
if (NS_FAILED(rv) || !element) {
JavaDOMGlobals::ThrowException(env,
"Document.getDocumentElement: failed", rv);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::elementClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.getDocumentElement: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) element);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.getDocumentElement: failed to set node ptr");
return NULL;
}
element->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: getElementsByTagName
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/NodeList;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_getElementsByTagName
(JNIEnv *env, jobject jthis, jstring jtagName)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jtagName) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementsByTagName: NULL pointer");
return NULL;
}
nsIDOMNodeList* elements = nsnull;
nsString* tagName = JavaDOMGlobals::GetUnicode(env, jtagName);
if (!tagName)
return NULL;
nsresult rv = doc->GetElementsByTagName(*tagName, &elements);
nsString::Recycle(tagName);
if (NS_FAILED(rv) || !elements) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementsByTagName: failed", rv);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::nodeListClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementsByTagName: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) elements);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementsByTagName: failed to set node ptr");
return NULL;
}
elements->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: getImplementation
* Signature: ()Lorg/w3c/dom/DOMImplementation;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_getImplementation
(JNIEnv *env, jobject jthis)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc) {
JavaDOMGlobals::ThrowException(env,
"Document.getImplementation: NULL pointer");
return NULL;
}
nsIDOMDOMImplementation* impl = nsnull;
nsresult rv = doc->GetImplementation(&impl);
if (NS_FAILED(rv) || !impl) {
JavaDOMGlobals::ThrowException(env,
"Document.getImplementation: failed", rv);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::domImplementationClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.getImplementation: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) impl);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.getImplementation: failed to set node ptr");
return NULL;
}
impl->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: createEvent
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/events/Event;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createEvent
(JNIEnv *env, jobject jthis, jstring jtype)
{
nsISupports *doc = (nsISupports*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jtype) {
JavaDOMGlobals::ThrowException(env,
"Document.createEvent: NULL pointer");
return NULL;
}
nsString* type = JavaDOMGlobals::GetUnicode(env, jtype);
if (!type)
return NULL;
nsIDOMDocumentEvent* docEvent = nsnull;
doc->QueryInterface(kIDOMDocumentEventIID, (void **) &docEvent);
if(!docEvent) {
JavaDOMGlobals::ThrowException(env,
"Document.createEvent: NULL DOMDocumentEvent pointer");
return NULL;
}
nsIDOMEvent* event = nsnull;
nsresult rv = docEvent->CreateEvent(*type, &event);
nsString::Recycle(type);
if (NS_FAILED(rv) || !event) {
JavaDOMGlobals::ThrowException(env,
"Document.createEvent: failed", rv);
return NULL;
}
return JavaDOMEventsGlobals::CreateEventSubtype(env, event);
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: getElementsByTagNameNS
* Signature: (Ljava/lang/String;Ljava/lang/String;)Lorg/w3c/dom/NodeList;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_getElementsByTagNameNS
(JNIEnv *env, jobject jthis, jstring jnamespaceURI, jstring jlocalName)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jnamespaceURI || !jlocalName) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementsByTagNameNS: NULL pointer");
return NULL;
}
nsString* namespaceURI = JavaDOMGlobals::GetUnicode(env, jnamespaceURI);
if (!namespaceURI)
return NULL;
nsString* localName = JavaDOMGlobals::GetUnicode(env, jlocalName);
if (!localName) {
nsString::Recycle(namespaceURI);
return NULL;
}
nsIDOMNodeList* elements = nsnull;
nsresult rv = doc->GetElementsByTagNameNS(*namespaceURI, *localName, &elements);
nsString::Recycle(namespaceURI);
nsString::Recycle(localName);
if (NS_FAILED(rv) || !elements) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementsByTagNameNS: failed", rv);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::nodeListClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementsByTagNameNS: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) elements);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementsByTagNameNS: failed to set node ptr");
return NULL;
}
elements->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentImpl
* Method: getElementById
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/Element;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_getElementById
(JNIEnv *env, jobject jthis, jstring jelementId)
{
nsIDOMDocument* doc = (nsIDOMDocument*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!doc || !jelementId) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementById: NULL pointer");
return NULL;
}
nsString* elementId = JavaDOMGlobals::GetUnicode(env, jelementId);
if (!elementId)
return NULL;
nsIDOMElement* element = nsnull;
nsresult rv = doc->GetElementById(*elementId, &element);
nsString::Recycle(elementId);
if (NS_FAILED(rv) || !element) {
JavaDOMGlobals::ThrowException(env,
"Document.getElementById: failed", rv);
return NULL;
}
return JavaDOMGlobals::CreateNodeSubtype(env, (nsIDOMNode*)element);
}

View File

@@ -1,243 +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 "prlog.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMNamedNodeMap.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_DocumentTypeImpl.h"
/*
* Class: org_mozilla_dom_DocumentTypeImpl
* Method: getEntities
* Signature: ()Lorg/w3c/dom/NamedNodeMap;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getEntities
(JNIEnv *env, jobject jthis)
{
nsIDOMDocumentType* docType = (nsIDOMDocumentType*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!docType) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DocumentType.getEntities: NULL pointer\n"));
return NULL;
}
nsIDOMNamedNodeMap* nodeMap = nsnull;
nsresult rv = docType->GetEntities(&nodeMap);
if (NS_FAILED(rv) || !nodeMap) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getEntities: failed (%x)\n", rv));
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::namedNodeMapClass);
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getEntities: failed to allocate object\n"));
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::namedNodeMapPtrFID, (jlong) nodeMap);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getEntities: failed to set node ptr: %x\n", nodeMap));
return NULL;
}
nodeMap->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentTypeImpl
* Method: getName
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getName
(JNIEnv *env, jobject jthis)
{
nsIDOMDocumentType* docType = (nsIDOMDocumentType*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!docType) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DocumentType.getName: NULL pointer\n"));
return NULL;
}
nsString ret;
nsresult rv = docType->GetName(ret);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getName: failed (%x)\n", rv));
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getName: NewString failed\n"));
}
return jret;
}
/*
* Class: org_mozilla_dom_DocumentTypeImpl
* Method: getNotations
* Signature: ()Lorg/w3c/dom/NamedNodeMap;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getNotations
(JNIEnv *env, jobject jthis)
{
nsIDOMDocumentType* docType = (nsIDOMDocumentType*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!docType) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DocumentType.getNotations: NULL pointer\n"));
return NULL;
}
nsIDOMNamedNodeMap* nodeMap = nsnull;
nsresult rv = docType->GetNotations(&nodeMap);
if (NS_FAILED(rv) || !nodeMap) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getNotations: failed (%x)\n", rv));
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::namedNodeMapClass);
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getNotations: failed to allocate object\n"));
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::namedNodeMapPtrFID, (jlong) nodeMap);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getNotations: failed to set node ptr: %x\n", nodeMap));
return NULL;
}
nodeMap->AddRef();
return jret;
}
/*
* Class: org_mozilla_dom_DocumentTypeImpl
* Method: getPublicId
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getPublicId
(JNIEnv *env, jobject jthis)
{
nsIDOMDocumentType* docType = (nsIDOMDocumentType*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!docType) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DocumentType.getPublicId: NULL pointer\n"));
return NULL;
}
nsString ret;
nsresult rv = docType->GetPublicId(ret);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getPublicId: failed (%x)\n", rv));
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getPublicId: NewString failed\n"));
}
return jret;
}
/*
* Class: org_mozilla_dom_DocumentTypeImpl
* Method: getSystemId
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getSystemId
(JNIEnv *env, jobject jthis)
{
nsIDOMDocumentType* docType = (nsIDOMDocumentType*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!docType) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DocumentType.getSystemId: NULL pointer\n"));
return NULL;
}
nsString ret;
nsresult rv = docType->GetSystemId(ret);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getSystemId: failed (%x)\n", rv));
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getSystemId: NewString failed\n"));
}
return jret;
}
/*
* Class: org_mozilla_dom_DocumentTypeImpl
* Method: getInternalSubset
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getInternalSubset
(JNIEnv *env, jobject jthis)
{
nsIDOMDocumentType* docType = (nsIDOMDocumentType*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!docType) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("DocumentType.getInternalSubset: NULL pointer\n"));
return NULL;
}
nsString ret;
nsresult rv = docType->GetInternalSubset(ret);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getInternalSubset: failed (%x)\n", rv));
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("DocumentType.getInternalSubset: NewString failed\n"));
}
return jret;
}

View File

@@ -1,770 +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 "prlog.h"
#include "nsIDOMElement.h"
#include "nsIDOMAttr.h"
#include "nsIDOMNodeList.h"
#include "nsDOMError.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_ElementImpl.h"
/*
* Class: org_mozilla_dom_ElementImpl
* Method: getAttribute
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ElementImpl_getAttribute
(JNIEnv *env, jobject jthis, jstring jname)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jname) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttribute: NULL pointer");
return NULL;
}
nsString* cname = JavaDOMGlobals::GetUnicode(env, jname);
if (!cname)
return NULL;
nsString attr;
nsresult rv = element->GetAttribute(*cname, attr);
nsString::Recycle(cname);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttribute: failed", rv);
return NULL;
}
jstring jattr = env->NewString(attr.GetUnicode(), attr.Length());
if (!jattr) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttribute: NewString failed");
return NULL;
}
return jattr;
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: getAttributeNode
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/Attr;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_getAttributeNode
(JNIEnv *env, jobject jthis, jstring jname)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jname) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttributeNode: NULL pointer");
return NULL;
}
nsString* cname = JavaDOMGlobals::GetUnicode(env, jname);
if (!cname)
return NULL;
nsIDOMAttr* attr = nsnull;
nsresult rv = element->GetAttributeNode(*cname, &attr);
nsString::Recycle(cname);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttributeNode: failed", rv);
return NULL;
}
if (!attr)
return NULL;
jobject jattr = env->AllocObject(JavaDOMGlobals::attrClass);
if (!jattr) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttributeNode: failed to allocate object");
return NULL;
}
env->SetLongField(jattr, JavaDOMGlobals::nodePtrFID, (jlong) attr);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttributeNode: failed to set node ptr");
return NULL;
}
attr->AddRef();
return jattr;
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: getElementsByTagName
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/NodeList;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_getElementsByTagName
(JNIEnv *env, jobject jthis, jstring jname)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jname) {
JavaDOMGlobals::ThrowException(env,
"Element.getElementsByTagName: NULL pointer");
return NULL;
}
nsString* cname = JavaDOMGlobals::GetUnicode(env, jname);
if (!cname)
return NULL;
nsIDOMNodeList* nodes = nsnull;
nsresult rv = element->GetElementsByTagName(*cname, &nodes);
nsString::Recycle(cname);
if (NS_FAILED(rv) || !nodes) {
JavaDOMGlobals::ThrowException(env,
"Element.getElementsByTagName: failed", rv);
return NULL;
}
jobject jnodes = env->AllocObject(JavaDOMGlobals::nodeListClass);
if (!jnodes) {
JavaDOMGlobals::ThrowException(env,
"Element.getElementsByTagName: failed to allocate object");
return NULL;
}
env->SetLongField(jnodes, JavaDOMGlobals::nodeListPtrFID, (jlong) nodes);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Element.getElementsByTagName: failed to set node ptr");
return NULL;
}
nodes->AddRef();
return jnodes;
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: getTagName
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ElementImpl_getTagName
(JNIEnv *env, jobject jthis)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element) {
JavaDOMGlobals::ThrowException(env,
"Element.getTagName: NULL pointer");
return NULL;
}
nsString tagName;
nsresult rv = element->GetTagName(tagName);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Element.getTagName: failed", rv);
return NULL;
}
jstring jTagName = env->NewString(tagName.GetUnicode(), tagName.Length());
if (!jTagName) {
JavaDOMGlobals::ThrowException(env,
"Element.getTagName: NewString failed");
return NULL;
}
return jTagName;
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: normalize
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_ElementImpl_normalize
(JNIEnv *env, jobject jthis)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element) {
JavaDOMGlobals::ThrowException(env,
"Element.normalize: NULL pointer");
return;
}
nsresult rv = element->Normalize();
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Element.normalize: failed", rv);
return;
}
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: removeAttribute
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_ElementImpl_removeAttribute
(JNIEnv *env, jobject jthis, jstring jname)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jname) {
JavaDOMGlobals::ThrowException(env,
"Element.removeAttribute: NULL pointer");
return;
}
nsString* name = JavaDOMGlobals::GetUnicode(env, jname);
if (!name)
return;
nsresult rv = element->RemoveAttribute(*name);
nsString::Recycle(name);
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,
"Element.removeAttribute: failed", rv, exceptionType);
return;
}
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: removeAttributeNode
* Signature: (Lorg/w3c/dom/Attr;)Lorg/w3c/dom/Attr;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_removeAttributeNode
(JNIEnv *env, jobject jthis, jobject joldAttr)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !joldAttr) {
JavaDOMGlobals::ThrowException(env,
"Element.removeAttributeNode: NULL pointer");
return NULL;
}
nsIDOMAttr* oldAttr = (nsIDOMAttr*)
env->GetLongField(joldAttr, JavaDOMGlobals::nodePtrFID);
if (!oldAttr) {
JavaDOMGlobals::ThrowException(env,
"Element.removeAttributeNode: NULL arg pointer");
return NULL;
}
nsIDOMAttr* ret = nsnull;
nsresult rv = element->RemoveAttributeNode(oldAttr, &ret);
if (NS_FAILED(rv) || !ret) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ||
rv == NS_ERROR_DOM_NOT_FOUND_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Element.removeAttributeNode: failed", rv, exceptionType);
return NULL;
}
jobject jattr = env->AllocObject(JavaDOMGlobals::attrClass);
if (!jattr) {
JavaDOMGlobals::ThrowException(env,
"Element.removeAttributeNode: failed to allocate object");
return NULL;
}
env->SetLongField(jattr, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Element.removeAttributeNode: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jattr;
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: setAttribute
* Signature: (Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_ElementImpl_setAttribute
(JNIEnv *env, jobject jthis, jstring jname, jstring jvalue)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jname || !jvalue) {
JavaDOMGlobals::ThrowException(env,
"Element.setAttribute: NULL pointer");
return;
}
nsString* name = JavaDOMGlobals::GetUnicode(env, jname);
if (!name)
return;
nsString* value = JavaDOMGlobals::GetUnicode(env, jvalue);
if (!value) {
nsString::Recycle(name);
return;
}
nsresult rv = element->SetAttribute(*name, *value);
nsString::Recycle(value);
nsString::Recycle(name);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_INVALID_CHARACTER_ERR ||
rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Element.setAttribute: failed", rv, exceptionType);
return;
}
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: setAttributeNode
* Signature: (Lorg/w3c/dom/Attr;)Lorg/w3c/dom/Attr;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_setAttributeNode
(JNIEnv *env, jobject jthis, jobject jnewAttr)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jnewAttr) {
JavaDOMGlobals::ThrowException(env,
"Element.setAttributeNode: NULL pointer");
return NULL;
}
nsIDOMAttr* newAttr = (nsIDOMAttr*)
env->GetLongField(jnewAttr, JavaDOMGlobals::nodePtrFID);
if (!newAttr) {
JavaDOMGlobals::ThrowException(env,
"Element.setAttributeNode: NULL arg pointer");
return NULL;
}
nsIDOMAttr* ret = nsnull;
nsresult rv = element->SetAttributeNode(newAttr, &ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ||
rv == NS_ERROR_DOM_WRONG_DOCUMENT_ERR ||
rv == NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Element.setAttributeNode: failed", rv, exceptionType);
return NULL;
}
if (!ret)
return NULL;
jobject jattr = env->AllocObject(JavaDOMGlobals::attrClass);
if (!jattr) {
JavaDOMGlobals::ThrowException(env,
"Element.setAttributeNode: failed to allocate object");
return NULL;
}
env->SetLongField(jattr, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Element.setAttributeNode: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jattr;
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: getAttributeNS
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ElementImpl_getAttributeNS
(JNIEnv *env, jobject jthis, jstring jnamespaceURI, jstring jlocalName)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jnamespaceURI || !jlocalName) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttributeNS: NULL pointer");
return NULL;
}
nsString* namespaceURI = JavaDOMGlobals::GetUnicode(env, jnamespaceURI);
if (!namespaceURI)
return NULL;
nsString* localName = JavaDOMGlobals::GetUnicode(env, jlocalName);
if (!localName) {
nsString::Recycle(namespaceURI);
return NULL;
}
nsString ret;
nsresult rv = element->GetAttributeNS(*namespaceURI, *localName, ret);
nsString::Recycle(namespaceURI);
nsString::Recycle(localName);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttributeNS: failed");
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Element.getAttributeNS: NewString failed\n"));
}
return jret;
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: setAttributeNS
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_ElementImpl_setAttributeNS
(JNIEnv *env, jobject jthis, jstring jnamespaceURI, jstring jqualifiedName, jstring jvalue)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jnamespaceURI || !jqualifiedName || !jvalue) {
JavaDOMGlobals::ThrowException(env,
"Element.setAttributeNS: NULL pointer");
return;
}
nsString* namespaceURI = JavaDOMGlobals::GetUnicode(env, jnamespaceURI);
if (!namespaceURI)
return;
nsString* qualifiedName = JavaDOMGlobals::GetUnicode(env, jqualifiedName);
if (!qualifiedName) {
nsString::Recycle(namespaceURI);
return;
}
nsString* value = JavaDOMGlobals::GetUnicode(env, jvalue);
if (!value) {
nsString::Recycle(namespaceURI);
nsString::Recycle(qualifiedName);
return;
}
nsresult rv = element->SetAttributeNS(*namespaceURI, *qualifiedName, *value);
nsString::Recycle(namespaceURI);
nsString::Recycle(qualifiedName);
nsString::Recycle(value);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_INVALID_CHARACTER_ERR ||
rv == NS_ERROR_DOM_NAMESPACE_ERR ||
rv == NS_ERROR_DOM_WRONG_DOCUMENT_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"ElementImpl.setAttributeNS: failed", rv, exceptionType);
}
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: removeAttributeNS
* Signature: (Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_ElementImpl_removeAttributeNS
(JNIEnv *env, jobject jthis, jstring jnamespaceURI, jstring jlocalName)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jnamespaceURI || !jlocalName) {
JavaDOMGlobals::ThrowException(env,
"Element.removeAttributeNS: NULL pointer");
return;
}
nsString* namespaceURI = JavaDOMGlobals::GetUnicode(env, jnamespaceURI);
if (!namespaceURI)
return;
nsString* localName = JavaDOMGlobals::GetUnicode(env, jlocalName);
if (!localName) {
nsString::Recycle(namespaceURI);
return;
}
nsresult rv = element->RemoveAttributeNS(*namespaceURI, *localName);
nsString::Recycle(namespaceURI);
nsString::Recycle(localName);
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,
"Element.removeAttributeNS: failed", rv, exceptionType);
}
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: getAttributeNodeNS
* Signature: (Ljava/lang/String;Ljava/lang/String;)Lorg/w3c/dom/Attr;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_getAttributeNodeNS
(JNIEnv *env, jobject jthis, jstring jnamespaceURI, jstring jlocalName)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jnamespaceURI || !jlocalName) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttributeNodeNS: NULL pointer");
return NULL;
}
nsString* namespaceURI = JavaDOMGlobals::GetUnicode(env, jnamespaceURI);
if (!namespaceURI)
return NULL;
nsString* localName = JavaDOMGlobals::GetUnicode(env, jlocalName);
if (!localName) {
nsString::Recycle(namespaceURI);
return NULL;
}
nsIDOMAttr* attr = nsnull;
nsresult rv = element->GetAttributeNodeNS(*namespaceURI, *localName, &attr);
nsString::Recycle(namespaceURI);
nsString::Recycle(localName);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Element.getAttributeNodeNS: failed", rv);
return NULL;
}
if (!attr)
return NULL;
return JavaDOMGlobals::CreateNodeSubtype(env, (nsIDOMNode*)attr);
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: setAttributeNodeNS
* Signature: (Lorg/w3c/dom/Attr;)Lorg/w3c/dom/Attr;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_setAttributeNodeNS
(JNIEnv *env, jobject jthis, jobject jnewAttr)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jnewAttr) {
JavaDOMGlobals::ThrowException(env,
"Element.setAttributeNodeNS: NULL pointer");
return NULL;
}
nsIDOMAttr* newAttr = (nsIDOMAttr*)
env->GetLongField(jnewAttr, JavaDOMGlobals::nodePtrFID);
if (!newAttr) {
JavaDOMGlobals::ThrowException(env,
"Element.setAttributeNodeNS: NULL arg pointer");
return NULL;
}
nsIDOMAttr* ret = nsnull;
nsresult rv = element->SetAttributeNodeNS(newAttr, &ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ||
rv == NS_ERROR_DOM_WRONG_DOCUMENT_ERR ||
rv == NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Element.setAttributeNodeNS: failed", rv, exceptionType);
return NULL;
}
if (!ret)
return NULL;
return JavaDOMGlobals::CreateNodeSubtype(env, (nsIDOMNode*)ret);
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: getElementsByTagNameNS
* Signature: (Ljava/lang/String;Ljava/lang/String;)Lorg/w3c/dom/NodeList;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_getElementsByTagNameNS
(JNIEnv *env, jobject jthis, jstring jnamespaceURI, jstring jlocalName)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jnamespaceURI || !jlocalName) {
JavaDOMGlobals::ThrowException(env,
"Element.getElementsByTagNameNS: NULL pointer");
return NULL;
}
nsString* namespaceURI = JavaDOMGlobals::GetUnicode(env, jnamespaceURI);
if (!namespaceURI)
return NULL;
nsString* localName = JavaDOMGlobals::GetUnicode(env, jlocalName);
if (!localName) {
nsString::Recycle(namespaceURI);
return NULL;
}
nsIDOMNodeList* nodes = nsnull;
nsresult rv = element->GetElementsByTagNameNS(*namespaceURI, *localName, &nodes);
nsString::Recycle(namespaceURI);
nsString::Recycle(localName);
if (NS_FAILED(rv) || !nodes) {
JavaDOMGlobals::ThrowException(env,
"Element.getElementsByTagNameNS: failed", rv);
return NULL;
}
jobject jnodes = env->AllocObject(JavaDOMGlobals::nodeListClass);
if (!jnodes) {
JavaDOMGlobals::ThrowException(env,
"Element.getElementsByTagNameNS: failed to allocate object");
return NULL;
}
env->SetLongField(jnodes, JavaDOMGlobals::nodeListPtrFID, (jlong) nodes);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Element.getElementsByTagNameNS: failed to set node ptr");
return NULL;
}
nodes->AddRef();
return jnodes;
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: hasAttribute
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_ElementImpl_hasAttribute
(JNIEnv *env, jobject jthis, jstring jname)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jname) {
JavaDOMGlobals::ThrowException(env,
"Element.hasAttribute: NULL pointer");
return JNI_FALSE;
}
nsString* name = JavaDOMGlobals::GetUnicode(env, jname);
if (!name)
return JNI_FALSE;
PRBool hasAttr = PR_FALSE;
nsresult rv = element->HasAttribute(*name, &hasAttr);
nsString::Recycle(name);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Element.hasAttribute: failed", rv);
return JNI_FALSE;
}
return (hasAttr == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_dom_ElementImpl
* Method: hasAttributeNS
* Signature: (Ljava/lang/String;Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_ElementImpl_hasAttributeNS
(JNIEnv *env, jobject jthis, jstring jnamespaceURI, jstring jlocalName)
{
nsIDOMElement* element = (nsIDOMElement*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!element || !jnamespaceURI || !jlocalName) {
JavaDOMGlobals::ThrowException(env,
"Element.hasAttributeNS: NULL pointer");
return JNI_FALSE;
}
nsString* namespaceURI = JavaDOMGlobals::GetUnicode(env, jnamespaceURI);
if (!namespaceURI)
return JNI_FALSE;
nsString* localName = JavaDOMGlobals::GetUnicode(env, jlocalName);
if (!localName) {
nsString::Recycle(namespaceURI);
return JNI_FALSE;
}
PRBool hasAttr = PR_FALSE;
nsresult rv = element->HasAttributeNS(*namespaceURI, *localName, &hasAttr);
nsString::Recycle(namespaceURI);
nsString::Recycle(localName);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Element.hasAttributeNS: failed", rv);
return JNI_FALSE;
}
return (hasAttr == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}

View File

@@ -1,128 +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 "prlog.h"
#include "nsIDOMEntity.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_EntityImpl.h"
/*
* Class: org_mozilla_dom_EntityImpl
* Method: getNotationName
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_EntityImpl_getNotationName
(JNIEnv *env, jobject jthis)
{
nsIDOMEntity* entity = (nsIDOMEntity*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!entity) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("Entity.getNotationName: NULL pointer\n"));
return NULL;
}
nsString ret;
nsresult rv = entity->GetNotationName(ret);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Entity.getNotationName: failed (%x)\n", rv));
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Entity.getNotationName: NewString failed\n"));
return NULL;
}
return jret;
}
/*
* Class: org_mozilla_dom_EntityImpl
* Method: getPublicId
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_EntityImpl_getPublicId
(JNIEnv *env, jobject jthis)
{
nsIDOMEntity* entity = (nsIDOMEntity*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!entity) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("Entity.getPublicId: NULL pointer\n"));
return NULL;
}
nsString ret;
nsresult rv = entity->GetPublicId(ret);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Entity.getPublicId: failed (%x)\n", rv));
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Entity.getPublicId: NewString failed\n"));
return NULL;
}
return jret;
}
/*
* Class: org_mozilla_dom_EntityImpl
* Method: getSystemId
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_EntityImpl_getSystemId
(JNIEnv *env, jobject jthis)
{
nsIDOMEntity* entity = (nsIDOMEntity*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!entity) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("Entity.getSystemId: NULL pointer\n"));
return NULL;
}
nsString ret;
nsresult rv = entity->GetSystemId(ret);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Entity.getSystemId: failed (%x)\n", rv));
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Entity.getSystemId: NewString failed\n"));
return NULL;
}
return jret;
}

View File

@@ -1,207 +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 "prlog.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMNode.h"
#include "javaDOMGlobals.h"
#include "nsDOMError.h"
#include "org_mozilla_dom_NamedNodeMapImpl.h"
/*
* Class: org_mozilla_dom_NamedNodeMapImpl
* Method: getLength
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_getLength
(JNIEnv *env, jobject jthis)
{
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
env->GetLongField(jthis, JavaDOMGlobals::namedNodeMapPtrFID);
if (!map) {
JavaDOMGlobals::ThrowException(env,
"NodeMap.getLength: NULL pointer");
return 0;
}
PRUint32 length = 0;
nsresult rv = map->GetLength(&length);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"NodeMap.getLength: failed", rv);
return 0;
}
return (jint) length;
}
/*
* Class: org_mozilla_dom_NamedNodeMapImpl
* Method: getNamedItem
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/Node;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_getNamedItem
(JNIEnv *env, jobject jthis, jstring jname)
{
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
env->GetLongField(jthis, JavaDOMGlobals::namedNodeMapPtrFID);
if (!map || !jname) {
JavaDOMGlobals::ThrowException(env,
"NodeMap.getNamedItem: NULL pointer");
return NULL;
}
nsIDOMNode* node = nsnull;
nsString* name = JavaDOMGlobals::GetUnicode(env, jname);
if (!name)
return NULL;
nsresult rv = map->GetNamedItem(*name, &node);
nsString::Recycle(name);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"NodeMap.getNamedItem: failed", rv);
return NULL;
}
if (!node)
return NULL;
return JavaDOMGlobals::CreateNodeSubtype(env, node);
}
/*
* Class: org_mozilla_dom_NamedNodeMapImpl
* Method: item
* Signature: (I)Lorg/w3c/dom/Node;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_item
(JNIEnv *env, jobject jthis, jint jindex)
{
if (jindex < 0 || jindex > JavaDOMGlobals::javaMaxInt) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("NamedNodeMap.item: invalid index value (%d)\n", jindex));
return NULL;
}
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
env->GetLongField(jthis, JavaDOMGlobals::namedNodeMapPtrFID);
if (!map) {
JavaDOMGlobals::ThrowException(env,
"NodeMap.item: NULL pointer");
return NULL;
}
nsIDOMNode* node = nsnull;
nsresult rv = map->Item((PRUint32) jindex, &node);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"NodeMap.item: failed", rv);
return NULL;
}
if (!node)
return NULL;
return JavaDOMGlobals::CreateNodeSubtype(env, node);
}
/*
* Class: org_mozilla_dom_NamedNodeMapImpl
* Method: removeNamedItem
* Signature: (Ljava/lang/String;)Lorg/w3c/dom/Node;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_removeNamedItem
(JNIEnv *env, jobject jthis, jstring jname)
{
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
env->GetLongField(jthis, JavaDOMGlobals::namedNodeMapPtrFID);
if (!map || !jname) {
JavaDOMGlobals::ThrowException(env,
"NodeMap.removeNamedItem: NULL pointer");
return NULL;
}
nsIDOMNode* node = nsnull;
nsString* name = JavaDOMGlobals::GetUnicode(env, jname);
if (!name)
return NULL;
nsresult rv = map->RemoveNamedItem(*name, &node);
nsString::Recycle(name);
if (NS_FAILED(rv) || !node) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (rv == NS_ERROR_DOM_NOT_FOUND_ERR) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"NodeMap.removeNamedItem: failed", rv, exceptionType);
return NULL;
}
return JavaDOMGlobals::CreateNodeSubtype(env, node);
}
/*
* Class: org_mozilla_dom_NamedNodeMapImpl
* Method: setNamedItem
* Signature: (Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_setNamedItem
(JNIEnv *env, jobject jthis, jobject jarg)
{
nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)
env->GetLongField(jthis, JavaDOMGlobals::namedNodeMapPtrFID);
if (!map || !jarg) {
JavaDOMGlobals::ThrowException(env,
"NodeMap.setNamedItem: NULL pointer");
return NULL;
}
nsIDOMNode* arg = (nsIDOMNode*)
env->GetLongField(jarg, JavaDOMGlobals::namedNodeMapPtrFID);
if (!arg) {
JavaDOMGlobals::ThrowException(env,
"NodeMap.setNamedItem: NULL item pointer");
return NULL;
}
nsIDOMNode* node = nsnull;
nsresult rv = map->SetNamedItem(arg, &node);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ||
rv == NS_ERROR_DOM_WRONG_DOCUMENT_ERR ||
rv == NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"NodeMap.setNamedItem: failed", rv, exceptionType);
return NULL;
}
if (!node)
return NULL;
return JavaDOMGlobals::CreateNodeSubtype(env, node);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,192 +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 "prlog.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_NodeListImpl.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
/*
* Class: org_mozilla_dom_NodeListImpl
* Method: XPCOM_equals
* Signature: (Ljava/lang/Object;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_NodeListImpl_XPCOM_1equals
(JNIEnv *env, jobject jthis, jobject jarg)
{
jboolean b_retFlag = JNI_FALSE;
nsIDOMNodeList* p_this =
(nsIDOMNodeList*) env->GetLongField(jthis, JavaDOMGlobals::nodeListPtrFID);
if (!p_this) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NodeList.equals: NULL pointer\n"));
return b_retFlag;
}
nsIDOMNodeList* p_arg =
(nsIDOMNodeList*) env->GetLongField(jarg, JavaDOMGlobals::nodeListPtrFID);
if (!p_arg) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NodeList.equals: NULL arg pointer\n"));
return b_retFlag;
}
nsISupports* thisSupports = nsnull;
nsISupports* argSupports = nsnull;
nsresult rvThis =
p_this->QueryInterface(kISupportsIID, (void**)(&thisSupports));
if (NS_FAILED(rvThis) || !thisSupports) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("NodeList.equals: this->QueryInterface failed (%x)\n", rvThis));
return b_retFlag;
}
nsresult rvArg =
p_arg->QueryInterface(kISupportsIID, (void**)(&argSupports));
if (NS_FAILED(rvArg) || !argSupports) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("NodeList.equals: arg->QueryInterface failed (%x)\n", rvArg));
thisSupports->Release();
return b_retFlag;
}
if (thisSupports == argSupports)
b_retFlag = JNI_TRUE;
thisSupports->Release();
argSupports->Release();
return b_retFlag;
}
/*
* Class: org_mozilla_dom_NodeListImpl
* Method: XPCOM_hashCode
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_NodeListImpl_XPCOM_1hashCode
(JNIEnv *env, jobject jthis)
{
nsIDOMNodeList* p_this =
(nsIDOMNodeList*) env->GetLongField(jthis, JavaDOMGlobals::nodeListPtrFID);
if (!p_this) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NodeList.hashCode: NULL pointer\n"));
return (jint) 0;
}
nsISupports* thisSupports = nsnull;
nsresult rvThis =
p_this->QueryInterface(kISupportsIID, (void**)(&thisSupports));
if (NS_FAILED(rvThis) || !thisSupports) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("NodeList.hashCode: QueryInterface failed (%x)\n", rvThis));
return (jint) 0;
}
thisSupports->Release();
return (jint) thisSupports;
}
/*
* Class: org_mozilla_dom_NodeListImpl
* Method: finalize
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_NodeListImpl_finalize
(JNIEnv *env, jobject jthis)
{
nsIDOMNodeList* nodes = (nsIDOMNodeList*)
env->GetLongField(jthis, JavaDOMGlobals::nodeListPtrFID);
if (!nodes) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NodeList.finalize: NULL pointer\n"));
return;
}
JavaDOMGlobals::AddToGarbage(nodes);
}
/*
* Class: org_mozilla_dom_NodeListImpl
* Method: getLength
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_NodeListImpl_getLength
(JNIEnv *env, jobject jthis)
{
nsIDOMNodeList* nodes = (nsIDOMNodeList*)
env->GetLongField(jthis, JavaDOMGlobals::nodeListPtrFID);
if (!nodes) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NodeList.getLength: NULL pointer\n"));
return 0;
}
PRUint32 length = 0;
nsresult rv = nodes->GetLength(&length);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("NodeList.getLength: failed (%x)\n", rv));
return 0;
}
return (jint) length;
}
/*
* Class: org_mozilla_dom_NodeListImpl
* Method: item
* Signature: (I)Lorg/w3c/dom/Node;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeListImpl_item
(JNIEnv *env, jobject jthis, jint jindex)
{
if (jindex < 0 || jindex > JavaDOMGlobals::javaMaxInt) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("NodeList.item: invalid index value (%d)\n", jindex));
return NULL;
}
nsIDOMNodeList* nodes = (nsIDOMNodeList*)
env->GetLongField(jthis, JavaDOMGlobals::nodeListPtrFID);
if (!nodes) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("NodeList.item: NULL pointer\n"));
return NULL;
}
nsIDOMNode* node = NULL;
nsresult rv = nodes->Item((PRUint32) jindex, &node);
if (NS_FAILED(rv) || !node) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("NodeList.item: failed (%x)\n", rv));
return NULL;
}
return JavaDOMGlobals::CreateNodeSubtype(env, node);
}

View File

@@ -1,94 +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 "prlog.h"
#include "nsIDOMNotation.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_NotationImpl.h"
/*
* Class: org_mozilla_dom_NotationImpl
* Method: getPublicId
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NotationImpl_getPublicId
(JNIEnv *env, jobject jthis)
{
nsIDOMNotation* notation = (nsIDOMNotation*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!notation) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("Notation.getPublicId: NULL pointer\n"));
return NULL;
}
nsString ret;
nsresult rv = notation->GetPublicId(ret);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Notation.getPublicId: failed (%x)\n", rv));
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Notation.getPublicId: NewString failed\n"));
return NULL;
}
return jret;
}
/*
* Class: org_mozilla_dom_NotationImpl
* Method: getSystemId
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NotationImpl_getSystemId
(JNIEnv *env, jobject jthis)
{
nsIDOMNotation* notation = (nsIDOMNotation*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!notation) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_WARNING,
("Notation.getSystemId: NULL pointer\n"));
return NULL;
}
nsString ret;
nsresult rv = notation->GetSystemId(ret);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Notation.getSystemId: failed (%x)\n", rv));
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Notation.getSystemId: NewString failed\n"));
return NULL;
}
return jret;
}

View File

@@ -1,129 +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 "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);
nsString::Recycle(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;
}
}

View File

@@ -1,82 +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 "prlog.h"
#include "nsIDOMText.h"
#include "nsDOMError.h"
#include "javaDOMGlobals.h"
#include "org_mozilla_dom_TextImpl.h"
/*
* Class: org_mozilla_dom_TextImpl
* Method: splitText
* Signature: (I)Lorg/w3c/dom/Text;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_TextImpl_splitText
(JNIEnv *env, jobject jthis, jint joffset)
{
if (joffset < 0 || joffset > JavaDOMGlobals::javaMaxInt) {
JavaDOMGlobals::ThrowException(env, "Text.splitText: failed",
NS_ERROR_DOM_INDEX_SIZE_ERR,
JavaDOMGlobals::EXCEPTION_DOM);
return NULL;
}
nsIDOMText* text = (nsIDOMText*)
env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);
if (!text) {
JavaDOMGlobals::ThrowException(env,
"Text.splitText: NULL pointer");
return NULL;
}
nsIDOMText* ret = nsnull;
nsresult rv = text->SplitText((PRUint32) joffset, &ret);
if (NS_FAILED(rv) || !ret) {
JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;
if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&
(rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ||
rv == NS_ERROR_DOM_INDEX_SIZE_ERR)) {
exceptionType = JavaDOMGlobals::EXCEPTION_DOM;
}
JavaDOMGlobals::ThrowException(env,
"Text.splitText: failed", rv, exceptionType);
return NULL;
}
jobject jret = env->AllocObject(JavaDOMGlobals::textClass);
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Text.splitText: failed to allocate object");
return NULL;
}
env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);
if (env->ExceptionOccurred()) {
JavaDOMGlobals::ThrowException(env,
"Text.splitText: failed to set node ptr");
return NULL;
}
ret->AddRef();
return jret;
}

View File

@@ -1,383 +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 "prlog.h"
#include "nsIDOMNode.h"
#include"nsIDOMEvent.h"
#include"nsIDOMEventTarget.h"
#include"javaDOMEventsGlobals.h"
#include "org_mozilla_dom_events_EventImpl.h"
// static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: getCurrentTarget
* Signature: ()Lorg/w3c/dom/events/EventTarget;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_EventImpl_getCurrentTarget
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.getCurrentNode: NULL pointer\n");
return NULL;
}
nsIDOMEventTarget* ret = nsnull;
nsresult rv = event->GetCurrentTarget(&ret);
if (NS_FAILED(rv) || !ret) {
JavaDOMGlobals::ThrowException(env,
"Event.getCurrentNode: failed", rv);
return NULL;
}
nsIDOMNode* node = nsnull;
rv = ret->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
printf("========== rv:%x node:%x", rv, node);
// return JavaDOMGlobals::CreateNodeSubtype(env, ret);
return JavaDOMGlobals::CreateNodeSubtype(env, node);
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: getEventPhase
* Signature: ()S
*/
JNIEXPORT jshort JNICALL Java_org_mozilla_dom_events_EventImpl_getEventPhase
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.getEventPhase: NULL native pointer\n");
return 0;
}
PRUint16 eventPhase = 0;
nsresult rv = event->GetEventPhase(&eventPhase);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.getEventPhase: failed", rv);
return 0;
}
jfieldID phaseFID = NULL;
switch(eventPhase) {
case nsIDOMEvent::BUBBLING_PHASE:
phaseFID = JavaDOMEventsGlobals::eventPhaseBubblingFID;
break;
case nsIDOMEvent::CAPTURING_PHASE:
phaseFID = JavaDOMEventsGlobals::eventPhaseCapturingFID;
break;
case nsIDOMEvent::AT_TARGET:
phaseFID = JavaDOMEventsGlobals::eventPhaseAtTargetFID;
break;
}
jshort ret = 0;
if (phaseFID) {
ret = env->GetStaticShortField(JavaDOMEventsGlobals::eventClass, phaseFID);
if (env->ExceptionOccurred()) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Event.getEventPhase: slection of phaseFID failed\n"));
return ret;
}
} else {
JavaDOMGlobals::ThrowException(env,
"Event.getEventPhase: illegal phase");
}
return ret;
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: getBubbles
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_EventImpl_getBubbles
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.getBubbles: NULL pointer");
return JNI_FALSE;
}
PRBool canBubble = PR_FALSE;
nsresult rv = event->GetBubbles(&canBubble);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.getBubbles: failed", rv);
return JNI_FALSE;
}
return (canBubble == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: getCancelable
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_EventImpl_getCancelable
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.getCancelable: NULL pointer");
return JNI_FALSE;
}
PRBool cancelable = PR_FALSE;
nsresult rv = event->GetCancelable(&cancelable);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.getCancelable: failed", rv);
return JNI_FALSE;
}
return (cancelable == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: getTarget
* Signature: ()Lorg/w3c/dom/events/EventTarget;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_EventImpl_getTarget
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.getTarget: NULL pointer");
return NULL;
}
nsIDOMEventTarget* ret = nsnull;
nsresult rv = event->GetTarget(&ret);
if (NS_FAILED(rv) || !ret) {
JavaDOMGlobals::ThrowException(env,
"Event.getTarget: failed", rv);
return NULL;
}
nsIDOMNode* node = nsnull;
rv = ret->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
printf("========== rv:%x node:%x", rv, node);
// return JavaDOMGlobals::CreateNodeSubtype(env, ret);
return JavaDOMGlobals::CreateNodeSubtype(env, node);
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: getType
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_dom_events_EventImpl_getType
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.getType: NULL pointer");
return NULL;
}
nsString ret;
nsresult rv = event->GetType(ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.getType: failed", rv);
return NULL;
}
jstring jret = env->NewString(ret.GetUnicode(), ret.Length());
if (!jret) {
JavaDOMGlobals::ThrowException(env,
"Event.getType: NewString failed");
return NULL;
}
return jret;
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: preventBubble
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_preventBubble
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.preventBubble: NULL pointer");
return;
}
nsresult rv = event->PreventBubble();
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.preventBubble: failed", rv);
}
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: preventCapture
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_preventCapture
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.preventCapture: NULL pointer");
return;
}
nsresult rv = event->PreventCapture();
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.preventCapture: failed", rv);
}
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: preventDefault
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_preventDefault
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.preventDefault: NULL pointer");
return;
}
nsresult rv = event->PreventDefault();
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.preventDefault: failed", rv);
}
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: initEvent
* Signature: (Ljava/lang/String;ZZ)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_initEvent
(JNIEnv *env, jobject jthis, jstring jeventTypeArg, jboolean jcanBubbleArg, jboolean jcancelableArg)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event || !jeventTypeArg) {
JavaDOMGlobals::ThrowException(env,
"Event.initEvent: NULL pointer");
return;
}
nsString* cvalue = JavaDOMGlobals::GetUnicode(env, jeventTypeArg);
if (!cvalue)
return;
PRBool canBubble = jcanBubbleArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
PRBool cancelable = jcancelableArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
nsresult rv = event->InitEvent(*cvalue, canBubble, cancelable);
nsString::Recycle(cvalue);
if (NS_FAILED(rv)) {
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
("Event.initEvent: failed (%x)\n", rv));
}
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: stopPropagation
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_stopPropagation
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.stopPropagation: NULL pointer");
return;
}
nsresult rv = event->StopPropagation();
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.stopPropagation: failed", rv);
}
}
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: getTimeStamp
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_mozilla_dom_events_EventImpl_getTimeStamp
(JNIEnv *env, jobject jthis)
{
nsIDOMEvent* event = (nsIDOMEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.getTimeStamp: NULL pointer");
return 0;
}
PRUint64 aTimeStamp;
nsresult rv = event->GetTimeStamp(&aTimeStamp);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"Event.getTimeStamp: failed", rv);
return 0;
}
return (jlong)aTimeStamp;
}

View File

@@ -1,374 +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 "prlog.h"
#include "nsIDOMNode.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMEventTarget.h"
#include "javaDOMEventsGlobals.h"
#include "org_mozilla_dom_events_MouseEventImpl.h"
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getAltKey
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getAltKey
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getAltKey: NULL pointer");
return JNI_FALSE;
}
PRBool altKey = PR_FALSE;
nsresult rv = event->GetAltKey(&altKey);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getAltKey: failed", rv);
return JNI_FALSE;
}
return (altKey == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getButton
* Signature: ()S
*/
JNIEXPORT jshort JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getButton
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getButton: NULL pointer");
return 0;
}
PRUint16 code = 0;
nsresult rv = event->GetButton(&code);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getButton: failed", rv);
return 0;
}
return (jshort) code;
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getClientX
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getClientX
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getClientX: NULL pointer");
return 0;
}
PRInt32 clientX = 0;
nsresult rv = event->GetClientX(&clientX);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getClientX: failed", rv);
return 0;
}
return (jint) clientX;
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getClientY
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getClientY
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getClientY: NULL pointer");
return 0;
}
PRInt32 clientY = 0;
nsresult rv = event->GetClientY(&clientY);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getClientY: failed", rv);
return 0;
}
return (jint) clientY;
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getCtrlKey
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getCtrlKey
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getCtrlKey: NULL pointer");
return JNI_FALSE;
}
PRBool ctrlKey = PR_FALSE;
nsresult rv = event->GetCtrlKey(&ctrlKey);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getCtrlKey: failed", rv);
return JNI_FALSE;
}
return (ctrlKey == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getMetaKey
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getMetaKey
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getMetaKey: NULL pointer");
return JNI_FALSE;
}
PRBool metaKey = PR_FALSE;
nsresult rv = event->GetMetaKey(&metaKey);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getMetaKey: failed", rv);
return JNI_FALSE;
}
return (metaKey == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getScreenX
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getScreenX
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getScreenX: NULL pointer\n");
return 0;
}
PRInt32 screenX = 0;
nsresult rv = event->GetScreenX(&screenX);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getScreenX: failed", rv);
return 0;
}
return (jint) screenX;
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getScreenY
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getScreenY
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getScreenY: NULL pointer");
return 0;
}
PRInt32 screenY = 0;
nsresult rv = event->GetScreenY(&screenY);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getScreenY: failed", rv);
return 0;
}
return (jint) screenY;
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getShiftKey
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getShiftKey
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getShiftKey: NULL pointer");
return JNI_FALSE;
}
PRBool shiftKey = PR_FALSE;
nsresult rv = event->GetShiftKey(&shiftKey);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getShiftKey: failed", rv);
return JNI_FALSE;
}
return (shiftKey == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getRelatedTarget
* Signature: ()Lorg/w3c/dom/events/EventTarget;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getRelatedTarget
(JNIEnv *env, jobject jthis)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getRelatedNode: NULL pointer");
return NULL;
}
nsIDOMEventTarget* ret = nsnull;
nsresult rv = event->GetRelatedTarget(&ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.getRelatedNode: failed", rv);
return NULL;
}
if (!ret)
return NULL;
nsIDOMNode* node = nsnull;
rv = ret->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
printf("========== rv:%x node:%x", rv, node);
// return JavaDOMGlobals::CreateNodeSubtype(env, ret);
return JavaDOMGlobals::CreateNodeSubtype(env, node);
}
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: initMouseEvent
* Signature: (Ljava/lang/String;ZZLorg/w3c/dom/views/AbstractView;IIIIIZZZZSLorg/w3c/dom/Node;)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_events_MouseEventImpl_initMouseEvent
(JNIEnv *env, jobject jthis,
jstring jtypeArg,
jboolean jcanBubbleArg,
jboolean jcancelableArg,
jobject jviewArg,
jint jdetailArg,
jint jscreenXArg,
jint jscreenYArg,
jint jclientXArg,
jint jclientYArg,
jboolean jctrlKeyArg,
jboolean jaltKeyArg,
jboolean jshiftKeyArg,
jboolean jmetaKeyArg,
jshort jbuttonArg,
jobject jrelatedNodeArg)
{
nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"MouseEvent.initMouseEvent: NULL pointer");
return;
}
nsString* cvalue = JavaDOMGlobals::GetUnicode(env, jtypeArg);
if (!cvalue)
return;
PRBool canBubble = jcanBubbleArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
PRBool cancelable = jcancelableArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
PRBool ctrlKeyArg = jctrlKeyArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
PRBool altKeyArg = jaltKeyArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
PRBool shiftKeyArg = jshiftKeyArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
PRBool metaKeyArg = jmetaKeyArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
nsresult rv = event->InitMouseEvent(*cvalue,
ctrlKeyArg,
altKeyArg,
shiftKeyArg,
metaKeyArg,
(PRInt32)jscreenXArg,
(PRInt32)jscreenYArg,
(PRInt32)jclientXArg,
(PRInt32)jclientYArg,
(PRUint16)jbuttonArg,
(PRUint16)jdetailArg);
nsString::Recycle(cvalue);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"UIEvent.initUIEvent: failed", rv);
}
}

View File

@@ -1,122 +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 "prlog.h"
#include"javaDOMEventsGlobals.h"
#include "org_mozilla_dom_events_UIEventImpl.h"
#include "nsIDOMUIEvent.h"
#include "nsIDOMAbstractView.h"
/*
* Class: org_mozilla_dom_events_UIEventImpl
* Method: getView
* Signature: ()Lorg/w3c/dom/views/AbstractView;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_UIEventImpl_getView
(JNIEnv *env, jobject jthis)
{
nsIDOMUIEvent* event = (nsIDOMUIEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"Event.getCurrentNode: NULL pointer");
return NULL;
}
nsIDOMAbstractView* aView = nsnull;
nsresult rv = event->GetView(&aView);
if (NS_FAILED(rv) || !aView) {
JavaDOMGlobals::ThrowException(env,
"UIEvent.getView: failed", rv);
return NULL;
}
// REMIND: Abstract View
return NULL; //JavaDOMEventGlobals::CreateEventSubtype(env, ret);
}
/*
* Class: org_mozilla_dom_events_UIEventImpl
* Method: getDetail
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_UIEventImpl_getDetail
(JNIEnv *env, jobject jthis)
{
nsIDOMUIEvent* event = (nsIDOMUIEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event) {
JavaDOMGlobals::ThrowException(env,
"UIEvent.getDetail: NULL pointer");
return 0;
}
PRInt32 aDetail = 0;
nsresult rv = event->GetDetail(&aDetail);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"UIEvent.getDetail: failed", rv);
return 0;
}
return (jint)aDetail;
}
/*
* Class: org_mozilla_dom_events_UIEventImpl
* Method: initUIEvent
* Signature: (Ljava/lang/String;ZZLorg/w3c/dom/views/AbstractView;I)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_dom_events_UIEventImpl_initUIEvent
(JNIEnv *env, jobject jthis,
jstring jtypeArg,
jboolean jcanBubbleArg,
jboolean jcancelableArg,
jobject jviewArg,
jint jdetailArg)
{
nsIDOMUIEvent* event = (nsIDOMUIEvent*)
env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
if (!event || !jtypeArg || !jviewArg) {
JavaDOMGlobals::ThrowException(env,
"Event.initUIEvent: NULL pointer\n");
return;
}
nsString* cvalue = JavaDOMGlobals::GetUnicode(env, jtypeArg);
if (!cvalue)
return;
PRBool canBubble = jcanBubbleArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
PRBool cancelable = jcancelableArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
// REMIND: need to deal with AbstractView
// NS_IMETHOD InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg)=0;
nsresult rv = event->InitUIEvent(*cvalue, canBubble, cancelable, NULL, (PRUint32)jdetailArg);
nsString::Recycle(cvalue);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
"UIEvent.initUIEvent: failed", rv);
}
}

View File

@@ -1,32 +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):
IGNORE_MANIFEST=1
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH = ..\..
DIRS = classes src jni
include <$(DEPTH)\config\rules.mak>

View File

@@ -1,25 +0,0 @@
Index: nsWebShell.cpp
===================================================================
RCS file: /cvsroot/mozilla/webshell/src/nsWebShell.cpp,v
retrieving revision 1.467
diff -r1.467 nsWebShell.cpp
119a120,125
> #ifdef JAVA_DOM
> #include "nsIJavaDOM.h"
> static NS_DEFINE_IID(kJavaDOMCID, NS_JAVADOM_CID);
> static NS_DEFINE_IID(kIJavaDOMIID, NS_IJAVADOM_IID);
> #endif // JAVA_DOM
>
1579a1586,1597
> #ifdef JAVA_DOM
> nsresult jrv = NS_OK;
> NS_WITH_SERVICE(nsIDocumentLoaderObserver, javaDOM, kJavaDOMCID, &jrv);
> if (NS_FAILED(jrv) || !javaDOM) {
> fprintf(stderr,
> "nsWebShell::Init: GetService of JavaDOM failed (error %x)\n",
> jrv);
> } else {
> printf("\n webshell: added JAVADOM as observer...\n");
> mDocLoader->AddObserver(javaDOM);
> }
> #endif // JAVA_DOM

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,64 +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):
DEPTH = ../../..
topsrcdir = $(DEPTH)
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))
include $(topsrcdir)/config/rules.mk

View File

@@ -1,64 +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):
DEPTH = ../../..
topsrcdir = $(DEPTH)
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))
include $(topsrcdir)/config/rules.mk

View File

@@ -1,84 +0,0 @@
#!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
# 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):
DEPTH=..\..\..
IGNORE_MANIFEST=1
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>
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,75 +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;
};
#endif /* __nsIJavaDOM_h__ */

View File

@@ -1,653 +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"
#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
#include "ProxyJNI.h"
#include "nsIServiceManager.h"
nsJVMManager* nsJavaDOMImpl::jvmManager = NULL;
JavaDOMSecurityContext* nsJavaDOMImpl::securityContext = NULL;
static NS_DEFINE_CID(kJVMManagerCID,NS_JVMMANAGER_CID);
#else
JavaVM* nsJavaDOMImpl::jvm = NULL;
#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);
jclass nsJavaDOMImpl::domAccessorClass = 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;
#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;
}
nsJavaDOMImpl::nsJavaDOMImpl()
{
NS_INIT_ISUPPORTS();
}
PRBool nsJavaDOMImpl::Init(JNIEnv** jniEnv) {
JNIEnv* env = GetJNIEnv();
if (!env) return PR_FALSE;
*jniEnv = env;
if (!domAccessorClass) {
domAccessorClass = env->FindClass("org/mozilla/dom/DOMAccessor");
if (!domAccessorClass) return PR_FALSE;
domAccessorClass = (jclass) env->NewGlobalRef(domAccessorClass);
if (!domAccessorClass) return PR_FALSE;
startURLLoadMID =
env->GetStaticMethodID(domAccessorClass,
"startURLLoad",
"(Ljava/lang/String;Ljava/lang/String;J)V");
if (Cleanup(env) == PR_TRUE) {
domAccessorClass = NULL;
return PR_FALSE;
}
endURLLoadMID =
env->GetStaticMethodID(domAccessorClass,
"endURLLoad",
"(Ljava/lang/String;IJ)V");
if (Cleanup(env) == PR_TRUE) {
domAccessorClass = NULL;
return PR_FALSE;
}
progressURLLoadMID =
env->GetStaticMethodID(domAccessorClass,
"progressURLLoad",
"(Ljava/lang/String;IIJ)V");
if (Cleanup(env) == PR_TRUE) {
domAccessorClass = NULL;
return PR_FALSE;
}
statusURLLoadMID =
env->GetStaticMethodID(domAccessorClass,
"statusURLLoad",
"(Ljava/lang/String;Ljava/lang/String;J)V");
if (Cleanup(env) == PR_TRUE) {
domAccessorClass = NULL;
return PR_FALSE;
}
startDocumentLoadMID =
env->GetStaticMethodID(domAccessorClass,
"startDocumentLoad",
"(Ljava/lang/String;)V");
if (Cleanup(env) == PR_TRUE) {
domAccessorClass = NULL;
return PR_FALSE;
}
endDocumentLoadMID =
env->GetStaticMethodID(domAccessorClass,
"endDocumentLoad",
"(Ljava/lang/String;IJ)V");
if (Cleanup(env) == PR_TRUE) {
domAccessorClass = NULL;
return PR_FALSE;
}
}
return PR_TRUE;
}
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);
container->Release();
if (NS_SUCCEEDED(rv) && docshell) {
rv = docshell->GetContentViewer(&contentv);
docshell->Release();
if (NS_SUCCEEDED(rv) && contentv) {
rv = contentv->QueryInterface(kIDocumentViewerIID, (void**) &docv);
contentv->Release();
if (NS_SUCCEEDED(rv) && docv) {
rv = docv->GetDocument(document);
docv->Release();
if (NS_SUCCEEDED(rv) && 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;
}
NS_IMETHODIMP nsJavaDOMImpl::OnStartDocumentLoad(nsIDocumentLoader* loader,
nsIURI* aURL,
const char* aCommand)
{
JNIEnv* env = NULL;
if (Init(&env) == PR_FALSE) return NS_ERROR_FAILURE;
char* urlSpec = (char*) "";
if (aURL)
aURL->GetSpec(&urlSpec);
jstring jURL = env->NewStringUTF(urlSpec);
if (!jURL) return NS_ERROR_FAILURE;
env->CallStaticVoidMethod(domAccessorClass,
startDocumentLoadMID,
jURL);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus)
{
JNIEnv* env = NULL;
if (Init(&env) == PR_FALSE) return NS_ERROR_FAILURE;
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);
env->CallStaticVoidMethod(domAccessorClass,
endDocumentLoadMID,
jURL,
(jint) aStatus,
(jlong)domDoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnStartURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel)
{
JNIEnv* env = NULL;
if (Init(&env) == PR_FALSE) return NS_ERROR_FAILURE;
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);
env->CallStaticVoidMethod(domAccessorClass,
startURLLoadMID,
jURL,
jContentType,
(jlong)domDoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnProgressURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
PRUint32 aProgress,
PRUint32 aProgressMax)
{
JNIEnv* env = NULL;
if (Init(&env) == PR_FALSE) return NS_ERROR_FAILURE;
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);
env->CallStaticVoidMethod(domAccessorClass,
progressURLLoadMID,
jURL,
(jint) aProgress,
(jint) aProgressMax,
(jlong)domDoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnStatusURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsString& aMsg)
{
JNIEnv* env = NULL;
if (Init(&env) == PR_FALSE) return NS_ERROR_FAILURE;
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);
env->CallStaticVoidMethod(domAccessorClass,
statusURLLoadMID,
jURL,
jMessage,
(jlong)domDoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::OnEndURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus)
{
JNIEnv* env = NULL;
if (Init(&env) == PR_FALSE) return NS_ERROR_FAILURE;
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);
#if defined(DEBUG)
dump_document(domDoc, urlSpec);
#endif
env->CallStaticVoidMethod(domAccessorClass,
endURLLoadMID,
jURL,
(jint) aStatus,
(jlong)domDoc);
if (Cleanup(env) == PR_TRUE) return NS_ERROR_FAILURE;
return NS_OK;
}
NS_IMETHODIMP nsJavaDOMImpl::HandleUnknownContentType(nsIDocumentLoader* loader,
nsIChannel* channel,
const char *aContentType,
const char *aCommand)
{
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

View File

@@ -1,77 +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 jmethodID startURLLoadMID;
static jmethodID endURLLoadMID;
static jmethodID progressURLLoadMID;
static jmethodID statusURLLoadMID;
static jmethodID startDocumentLoadMID;
static jmethodID endDocumentLoadMID;
static JNIEnv* GetJNIEnv(void);
static void StartJVM(void);
static PRBool Init(JNIEnv**);
// cleanup after a JNI method invocation
static PRBool Cleanup(JNIEnv* env);
nsIDOMDocument* GetDocument(nsIDocumentLoader* loader);
};
#endif /* __nsJavaDOMImpl_h__ */

View File

@@ -1,81 +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):
*/
package org.mozilla.dom.test;
public class BWBaseTest implements Execution
{
/**
* This is a dummy implementation of interface method
*
* @param obj Object instance (Node/Document/....)
*
* @return if test has passed then return true else false
*
*
*/
public boolean execute(Object obj)
{
return true;
}
/**
* Send a null Object. Classes extending this class will override this
* method
*
*
* @return Null object reference
*
*/
public Object returnObject()
{
return null;
}
/**
* This method indicates whether a particular method is UNSUPPORTED or
* not.
*
*/
public void setUnsupported()
{
UNSUPPORTED = true;
}
/**
* This method indicates whether a particular method is UNSUPPORTED or
* not.
*
*
* @return Value of boolean varibale UNSUPPORTED.
*
*/
public boolean isUnsupported()
{
return UNSUPPORTED;
}
public static boolean FAILED=false;
public static boolean PASSED=true;
public boolean UNSUPPORTED=false;
}

View File

@@ -1,102 +0,0 @@
JavaTest Template:
Woking on similar lines as JavaSpec, this template generator parses an
input Class file and creates unique Test Template Files for
each public method complying with all combinations of its parameter list.
It is mainly used for doing a white box testing for all API's (methods).
This will ensure that all Java Testcase Files follow a given template.
It uses reflection to figure out all constructors and public methods
for a given class.
The file-naming convention for output files is a straight forward one.
<class Name>_<method name>_<param combinations>.java
param combinations is based on all permutations depending on the values
of different data types (as listed below)
Listed below is all possible values for types of parameter.
String = (null, "DUMMY_STRING")
int = (0, Integer.MIN_VALUE, Integer.MAX_VALUE)
float = (0, Float.MIN_VALUE, Float.MAX_VALUE)
double = (0, Double.MIN_VALUE, Double.MAX_VALUE)
long = (0, Long.MIN_VALUE, Long.MAX_VALUE)
short = (0, Short.MIN_VALUE, Short.MAX_VALUE)
char = (Character.MAX_VALUE)
boolean = (true, false)
byte = (Byte.MIN_VALUE, Byte.MAX_VALUE)
Integer = (null, 0, Integer.MIN_VALUE, Integer.MAX_VALUE)
Float = (null, 0, Float.MIN_VALUE, Float.MAX_VALUE)
Double = (null, 0, Double.MIN_VALUE, Double.MAX_VALUE)
Long = (null, 0, Long.MIN_VALUE, Long.MAX_VALUE)
Short = (null, 0, Short.MIN_VALUE, Short.MAX_VALUE)
Character = (null, Character.MAX_VALUE)
Byte = (null, Byte.MIN_VALUE, Byte.MAX_VALUE)
Object = (null, "NOTNULL")
So for a method 'm' for class 'c' with two String parameters
the output files generated will be
c_m_String_String_0.java --> (null, null)
c_m_String_String_1.java --> ("DUMMY_STRING", null)
c_m_String_String_2.java --> (null, "DUMMY_STRING")
C_m_String_String_3.java --> ("DUMMY_STRING", "DUMMY_STRING")
--------------------------------------------------------------------------
How to run
==========
java BWJavaTestTemplate [ -d <output directory> ] classname
<output directory> is the location where u want to generate these
TestCase files
--------------------------------------------------------------------------
For Example
===========
Class: x.java
public class x
{
public x(String arg)
{
}
private void modifyVal(String instr)
{
}
public void setVal (String ival)
{
}
public void setIndexVal (String ival, int index)
{
}
}
Generated Files are
x_setVal_String_0.java
x_setVal_String_1.java
x_setIndexVal_String_int_0.java
x_setIndexVal_String_int_1.java
x_setIndexVal_String_int_2.java
x_setIndexVal_String_int_3.java
x_setIndexVal_String_int_4.java
x_setIndexVal_String_int_5.java
x_x_String_0.java
x_x_String_1.java
x.txt
--------------------------------------------------------------------------
NOTE: Right now the author name in each of those generated files is left
empty. Future version will reflect the same from configuration files

View File

@@ -1,192 +0,0 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.51 [en] (X11; U; SunOS 5.6 sun4u) [Netscape]">
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
<b><u><font color="#993399"><font size=+1>JavaTest Template</font></font></u></b>
<br>&nbsp;
<p>Woking on similar lines as JavaSpec, this template generator parses
an
<br>input Class file and creates unique Test Template Files for
<br>each public method complying with all combinations of its parameter
list.
<br>It is mainly used for doing a white box testing for all API's (methods).
<p>This will ensure that all Java Testcase Files follow a given template.
<p>It uses reflection to figure out all constructors and public methods
<br>for a given class.
<br>The file-naming convention for output files is a straight forward one.
<br>[class Name]_[method name]_[param combinations].java
<p>param combinations is based on all permutations depending on the values
<br>of different data types (as listed below)
<br>&nbsp;
<p>Listed below is all possible values for types of parameter.
<br>&nbsp;
<table BORDER COLS=2 WIDTH="100%" BGCOLOR="#99FFCC" NOSAVE >
<tr NOSAVE>
<td WIDTH="100" NOSAVE>String</td>
<td>(null, "DUMMY_STRING")</td>
</tr>
<tr>
<td>int</td>
<td>(0, Integer.MIN_VALUE, Integer.MAX_VALUE)</td>
</tr>
<tr>
<td>float</td>
<td>(0, Float.MIN_VALUE, Float.MAX_VALUE)</td>
</tr>
<tr>
<td>double</td>
<td>(0, Double.MIN_VALUE, Double.MAX_VALUE)</td>
</tr>
<tr>
<td>long</td>
<td>(0, Long.MIN_VALUE, Long.MAX_VALUE)</td>
</tr>
<tr>
<td>short</td>
<td>(0, Short.MIN_VALUE, Short.MAX_VALUE)</td>
</tr>
<tr>
<td>char</td>
<td>(Character.MAX_VALUE)</td>
</tr>
<tr>
<td>boolean</td>
<td>(true, false)</td>
</tr>
<tr>
<td>byte</td>
<td>(Byte.MIN_VALUE, Byte.MAX_VALUE)</td>
</tr>
<tr>
<td>Integer</td>
<td>(null, 0, Integer.MIN_VALUE, Integer.MAX_VALUE)</td>
</tr>
<tr>
<td>Float</td>
<td>&nbsp;(null, 0, Float.MIN_VALUE, Float.MAX_VALUE)</td>
</tr>
<tr>
<td>Double</td>
<td>(null, 0, Double.MIN_VALUE, Double.MAX_VALUE)</td>
</tr>
<tr>
<td>Long</td>
<td>(null, 0, Long.MIN_VALUE, Long.MAX_VALUE)</td>
</tr>
<tr>
<td>Short</td>
<td>(null, 0, Short.MIN_VALUE, Short.MAX_VALUE)</td>
</tr>
<tr>
<td>Character</td>
<td>(null, Character.MAX_VALUE)</td>
</tr>
<tr>
<td>Byte</td>
<td>(null, Byte.MIN_VALUE, Byte.MAX_VALUE)</td>
</tr>
<tr>
<td>Object</td>
<td>(null, "NOTNULL")</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<p>So for a method 'm' for class 'c' with two String parameters the output
files generated will be
<br>c_m_String_String_0.java --> (null, null)
<br>c_m_String_String_1.java --> ("DUMMY_STRING", null)
<br>c_m_String_String_2.java --> (null, "DUMMY_STRING")
<br>C_m_String_String_3.java --> ("DUMMY_STRING", "DUMMY_STRING")
<p>
<hr NOSHADE WIDTH="100%">
<h2>
<b><u><font color="#993399"><font size=+1>How to run</font></font></u></b></h2>
<p><br>java BWJavaTestTemplate [ -d&nbsp;<output directory>] classname
<br><output directory>is the location where u want to generate these
<br>TestCase files
<br>
<hr NOSHADE WIDTH="100%">
<h2>
<u><font color="#993399">Example</font></u></h2>
<font color="#FF6666">Class: x.java</font><font color="#FF6666"></font>
<p><font color="#FF6666">&nbsp;&nbsp; public class x</font>
<br><font color="#FF6666">&nbsp;&nbsp; {</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public x(String
arg)</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font><font color="#FF6666"></font>
<p><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp; private void modifyVal(String
instr)</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp; {</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp; }</font><font color="#FF6666"></font>
<p><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp; public void setVal (String
ival)</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp; {</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp; }</font><font color="#FF6666"></font>
<p><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp; public void setIndexVal
(String ival, int index)</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp; {</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp;&nbsp; }</font>
<br><font color="#FF6666">&nbsp; }</font>
<br><font color="#FF6666"></font>&nbsp;<font color="#FF6666"></font>
<p>Generated Files are
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x_setVal_String_0.java</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x_setIndexVal_String_int_0.java</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x_setIndexVal_String_int_1.java</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x_setIndexVal_String_int_2.java</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x_setIndexVal_String_int_3.java</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x_setIndexVal_String_int_4.java</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x_setIndexVal_String_int_5.java</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x_x_String_0.java</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x_x_String_1.java</font>
<br><font color="#FF6666">&nbsp;&nbsp;&nbsp; x.txt</font><font color="#FF6666"></font>
<p>
<hr NOSHADE WIDTH="100%">
<p><u><font color="#993399"><font size=+1>NOTE</font></font></u>
<p>Right now the author name in each of those generated files is left&nbsp;
empty. Future version will reflect the same from configuration files.
</body>
</html>

View File

@@ -1,895 +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):
*/
package org.mozilla.dom.test;
import java.lang.*;
import java.util.*;
import java.io.*;
import java.lang.reflect.*;
import org.mozilla.dom.*;
class BWJavaTemplate
{
ReflectionTest rt=null;
String fullclass=null;
String jclass=null;
String packageName=null;
String outputDir=null;
Vector outputFiles=null;
private Method[] methods = null;
private String currMethod=new String();
private String currParamList=new String();
private Hashtable rules = null;
public BWJavaTemplate(String ajclass, String aoutDir, String rulesFile)
{
outputDir = aoutDir+System.getProperty("file.separator");
fullclass = ajclass;
if (fullclass == null) {
System.out.println("Class Name cannot be NULL... ");
return;
}
if (rulesFile != null) {
loadRules(rulesFile);
}
int idx = fullclass.lastIndexOf(".");
if ( idx != -1)
{
packageName = fullclass.substring(0, idx);
jclass = fullclass.substring(idx+1);
System.out.println("packageName is " + packageName);
} else {
jclass = fullclass;
}
System.out.println("class Name is " + jclass);
rt = new ReflectionTest();
if (rt == null) {
System.out.println("Could not instantiate ReflectionTest...\n");
return;
}
outputFiles = new Vector();
System.out.println("Parsing constructors and methods ...");
if (!(parseClassConstructor()) && !(parseClassMethod())) {
System.out.println("Can't parse neither COnstructors nor Methods !!!\n");
return;
}
DataOutputStream dos = null;
String txtFile = jclass + ".txt";
try {
dos = new DataOutputStream( new FileOutputStream(outputDir+txtFile));
} catch (Exception e) {
System.out.println("ERROR: Could not create File " + txtFile);
return;
}
try {
//dos.write("#Class|Method|Parameter|FileName\n".getBytes());
for(int i=0; i<outputFiles.size(); i++)
{
dos.write(((String)outputFiles.elementAt(i)).getBytes());
dos.write("\n".getBytes());
}
} catch (IOException e) {
System.out.println("ERROR: Could not write to File " + txtFile);
return;
}
try {
dos.close();
} catch (Exception e) {
System.out.println("ERROR: Could not close File " + txtFile);
return;
}
}
private void loadRules(String rulesFile) {
try {
/* Input stream routines*/
FileInputStream in = new FileInputStream(rulesFile);
LineNumberReader ln = new LineNumberReader((Reader)(new InputStreamReader((InputStream)in)));
/*Parsing rules file*/
rules = new Hashtable();
String str = null;
int pos = -1;
while((str = ln.readLine()) != null) {
if ((pos = str.indexOf(' ')) <= 0 || pos == str.length()) {
System.out.println("WARNIG: rules file format error at line "+ln.getLineNumber());
} else {
//System.out.println("Rules: "+str.substring(0, pos)+" <-> "+str.substring(pos+1));
rules.put((Object)str.substring(0, pos), (Object)str.substring(pos+1));
}
}
} catch (Exception e) {
System.out.println("WARNING: Can't read rules file "+rulesFile+": "+e.fillInStackTrace()+"\n");
rules = null;
}
}
/**
* Parses the class constructors and create class files
*
* @return Either true or false
*/
public boolean parseClassConstructor()
{
Class cl = null;
try {
cl = Class.forName(fullclass);
} catch (Exception e) {
System.out.println("Could not find class file " + fullclass);
return false;
}
if (Modifier.isAbstract(cl.getModifiers()))
return false;
if (Modifier.isInterface(cl.getModifiers()))
return false;
Constructor constructors[] = rt.getConstructors(cl);
String paramString = null;
int staticFlag=0;
for (int i = 0; i < constructors.length; i++)
{
staticFlag=0;
String returnType = "void";
Constructor c = constructors[i];
Class[] paramTypes = c.getParameterTypes();
String conName = c.getName();
currMethod = conName;
int mod = c.getModifiers();
if (Modifier.isStatic(mod))
staticFlag = 1;
else if (!(Modifier.isPublic(mod)))
continue;
paramString = new String();
ParamCombination pcomb = null;
pcomb = new ParamCombination(paramTypes.length);
if (pcomb == null)
{
System.out.println("Could not instantiate ParamCombination...\n");
return false;
}
for (int j = 0; j < paramTypes.length; j++)
{
// Construct parameter string (param1_param2_...)
String pstr = paramTypes[j].getName();
String tstr = new String("");
// check if param is an Array and accordingly get
// component type.
if (pstr.startsWith("["))
{
int index = pstr.lastIndexOf("[") + 1;
tstr = "Arr" + (new Integer(index)).toString();
pstr = (pstr.substring(index)).trim();
if (pstr.length() == 1) {
if (pstr.compareTo("I") == 0)
tstr = tstr + "int";
else if (pstr.compareTo("F") == 0)
tstr = tstr + "float";
else if (pstr.compareTo("D") == 0)
tstr = tstr + "double";
else if (pstr.compareTo("S") == 0)
tstr = tstr + "short";
else if (pstr.compareTo("C") == 0)
tstr = tstr + "char";
else if (pstr.compareTo("B") == 0)
tstr = tstr + "byte";
} else {
// Remove the leading 'L' from the string
pstr = pstr.substring(1);
}
// Remove trailing semicolon
int slen = pstr.length();
pstr = pstr.substring(0, slen-1);
}
// Remove . from paramname (java.lang.String)
int idx = pstr.lastIndexOf(".");
if (idx != -1)
{
pstr = pstr.substring(idx + 1);
}
tstr = tstr + pstr;
paramString = paramString + "_" + tstr;
/* get value list for parameter */
pcomb.addElement(getParameterValueList(tstr));
}
// remove leading underscore
if (paramString.length() > 1)
paramString = paramString.substring(1);
currParamList = paramString;
String combstr[] = pcomb.getValueList();
if (combstr != null)
{
for (int k=0; k< combstr.length; k++)
{
String pstr = paramString + "_" + (new Integer(k)).toString();
createTemplate(jclass, jclass, pstr, combstr[k], returnType, staticFlag);
}
} else {
createTemplate(jclass, jclass, null, null, returnType, staticFlag);
}
}
return true;
}
/**
* Parses the class methods and create class files
*
* @return Either true or false
*/
public boolean parseClassMethod()
{
Class cl = null;
try {
cl = Class.forName(fullclass);
} catch (Exception e) {
System.out.println("Could not find class file " + fullclass);
return false;
}
methods = rt.getMethods(cl);
String paramString = null;
int staticFlag=0;
for (int i = 0; i < methods.length; i++)
{
System.out.println("Parsing method: "+jclass+" -> "+methods[i].getName());
staticFlag=0;
Method m = methods[i];
Class[] paramTypes = m.getParameterTypes();
String conName = m.getName();
String returnType = (m.getReturnType()).getName();
currMethod = conName;
int mod = m.getModifiers();
if (Modifier.isStatic(mod))
staticFlag = 1;
else if (!(Modifier.isPublic(mod)))
continue;
paramString = new String();
ParamCombination pcomb = null;
System.out.println("Number of parms: "+paramTypes.length);
pcomb = new ParamCombination(paramTypes.length);
if (pcomb == null)
{
System.out.println("Could not instantiate ParamCombination...\n");
return false;
}
if (Modifier.isStatic(m.getModifiers()))
staticFlag = 1;
for (int j = 0; j < paramTypes.length; j++)
{
// Construct parameter string (param1_param2_...)
String pstr = paramTypes[j].getName();
String tstr = new String("");
// check if param is an Array and accordingly get
// component type.
if (pstr.startsWith("["))
{
int index = pstr.lastIndexOf("[") + 1;
tstr = "Arr" + (new Integer(index)).toString();
pstr = (pstr.substring(index)).trim();
if (pstr.length() == 1) {
if (pstr.compareTo("I") == 0)
tstr = tstr + "int";
else if (pstr.compareTo("F") == 0)
tstr = tstr + "float";
else if (pstr.compareTo("D") == 0)
tstr = tstr + "double";
else if (pstr.compareTo("S") == 0)
tstr = tstr + "short";
else if (pstr.compareTo("C") == 0)
tstr = tstr + "char";
else if (pstr.compareTo("B") == 0)
tstr = tstr + "byte";
} else {
// Remove the leading 'L' from the string
pstr = pstr.substring(1);
}
// Remove trailing semicolon
int slen = pstr.length();
pstr = pstr.substring(0, slen-1);
}
// Remove . from paramname (java.lang.String)
int idx = pstr.lastIndexOf(".");
if (idx != -1)
{
pstr = pstr.substring(idx + 1);
}
tstr = tstr + pstr;
paramString = paramString + "_" + tstr;
/* get value list for parameter */
pcomb.addElement(getParameterValueList(tstr));
}
// remove leading underscore
if (paramString.length() > 1)
paramString = paramString.substring(1);
String combstr[] = pcomb.getValueList();
if (combstr != null)
{
for (int k=0; k< combstr.length; k++)
{
String pstr = paramString + "_" + (new Integer(k)).toString();
currParamList = paramString;
createTemplate(jclass, conName, pstr, combstr[k], returnType, staticFlag);
}
} else {
createTemplate(jclass, conName, null, null, returnType, staticFlag);
}
}
return true;
}
/**
* GetParses the class constructors and create class files
*
* @param Name of the paramter class
* @return Vector of all permissbile values for this class
* viz: for String class it will be null/"dummy"
*/
public Vector getParameterValueList(String param)
{
Vector result = null;
if (param == null) return null;
result = new Vector();
if (param.compareTo("String") == 0)
{
result.addElement("null");
result.addElement("\"DUMMY_STRING\"");
} else
if (param.compareTo("int") == 0)
{
result.addElement("0");
result.addElement("Integer.MIN_VALUE");
result.addElement("Integer.MAX_VALUE");
} else
if (param.compareTo("float") == 0)
{
result.addElement("0");
result.addElement("Float.MAX_VALUE");
result.addElement("Float.NaN");
} else
if (param.compareTo("double") == 0)
{
result.addElement("0");
result.addElement("Double.MAX_VALUE");
result.addElement("Double.NaN");
} else
if (param.compareTo("long") == 0)
{
result.addElement("0");
result.addElement("Long.MIN_VALUE");
result.addElement("Long.MAX_VALUE");
} else
if (param.compareTo("short") == 0)
{
result.addElement("0");
result.addElement("Short.MIN_VALUE");
result.addElement("Short.MAX_VALUE");
} else
if (param.compareTo("char") == 0)
{
result.addElement("Character.MAX_VALUE");
} else
if (param.compareTo("boolean") == 0)
{
result.addElement("true");
result.addElement("false");
} else
if (param.compareTo("byte") == 0)
{
result.addElement("Byte.MIN_VALUE");
result.addElement("Byte.MAX_VALUE");
} else
if (param.compareTo("Integer") == 0)
{
result.addElement("null");
result.addElement("new Integer(0)");
result.addElement("new Integer(Integer.MIN_VALUE)");
result.addElement("new Integer(Integer.MAX_VALUE)");
} else
if (param.compareTo("Float") == 0)
{
result.addElement("null");
result.addElement("new Float(0)");
result.addElement("new Float(Float.MAX_VALUE)");
result.addElement("new Float(Float.NaN)");
} else
if (param.compareTo("Double") == 0)
{
result.addElement("null");
result.addElement("new Double(0)");
result.addElement("new Double(Double.MAX_VALUE)");
result.addElement("new Double(Double.NaN)");
} else
if (param.compareTo("Long") == 0)
{
result.addElement("null");
result.addElement("new Long(0)");
result.addElement("new Long(Long.MIN_VALUE)");
result.addElement("new Long(Long.MAX_VALUE)");
} else
if (param.compareTo("Short") == 0)
{
result.addElement("null");
result.addElement("new Short(0)");
result.addElement("new Short(Short.MIN_VALUE)");
result.addElement("new Short(Short.MAX_VALUE)");
} else
if (param.compareTo("Character") == 0)
{
result.addElement("'" + (new Character(Character.MAX_VALUE)).toString() + "`");
} else
if (param.compareTo("Byte") == 0)
{
result.addElement("null");
result.addElement("new Byte(Byte.MIN_VALUE)");
result.addElement("new Byte(Byte.MAX_VALUE)");
} else
if (rules != null && rules.get(param) != null) {
result.addElement((String)rules.get(param));
result.addElement("null");
} else {
result.addElement("null");
result.addElement("NOTNULL");
}
return result;
}
/**
* Create Template Java File
*
* @param className Name of the class file
* @param methodName Name of the method
* @param paramString Concated string of parameter types separated by
* underscores.
* @param valueList A concated String of values for the above
* parameters in the given order
* @param returnType Return Type for the given method.
*
*
* @return void
*/
public void createTemplate( String className,
String methodName,
String paramString,
String valueList,
String returnType,
int staticFlag
)
{
if (className == null) return;
if (methodName == null) return;
if (returnType == null) return;
if (paramString != null)
if (valueList == null) return;
String cName = new String();
String filename = new String();
if (paramString != null){
cName = className + "_" + methodName + "_" + paramString;
filename = cName + ".java";
} else {
cName = className + "_" + methodName;
filename = cName + ".java";
}
DataOutputStream raf = null;
try {
raf = new DataOutputStream( new FileOutputStream(outputDir+filename));
} catch (Exception e) {
System.out.println("ERROR: Could not create File " + filename);
return;
}
try {
String fstr = new String();
fstr = fstr + "/**";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " * @version 1.00 ";
fstr = fstr + "\n";
fstr = fstr + " * @author ";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " * TESTID ";
fstr = fstr + "\n";
fstr = fstr + " * ";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " */";
fstr = fstr + "\n";
fstr = fstr + "package org.mozilla.dom.test;";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + "import java.util.*;";
fstr = fstr + "\n";
fstr = fstr + "import java.io.*;";
fstr = fstr + "\n";
fstr = fstr + "import org.mozilla.dom.test.*;";
fstr = fstr + "\n";
fstr = fstr + "import org.mozilla.dom.*;";
fstr = fstr + "\n";
fstr = fstr + "import org.w3c.dom.*;";
fstr = fstr + "\n";
fstr = fstr + "import org.w3c.dom.html.*;";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + "public class " + cName;
fstr = fstr + " extends BWBaseTest implements Execution";
fstr = fstr + "\n";
fstr = fstr + "{";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + " /**";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " ***********************************************************";
fstr = fstr + "\n";
fstr = fstr + " * Constructor";
fstr = fstr + "\n";
fstr = fstr + " ***********************************************************";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " */";
fstr = fstr + "\n";
fstr = fstr + " public " + cName + "()";
fstr = fstr + "\n";
fstr = fstr + " {";
fstr = fstr + "\n";
fstr = fstr + " }";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + " /**";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " ***********************************************************";
fstr = fstr + "\n";
fstr = fstr + " * Starting point of application";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " * @param args Array of command line arguments";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " ***********************************************************";
fstr = fstr + "\n";
fstr = fstr + " */";
fstr = fstr + "\n";
fstr = fstr + " public static void main(String[] args)";
fstr = fstr + "\n";
fstr = fstr + " {";
fstr = fstr + "\n";
fstr = fstr + " }";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + " /**";
fstr = fstr + "\n";
fstr = fstr + " ***********************************************************";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " * Execute Method ";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " * @param tobj Object reference (Node/Document/...)";
fstr = fstr + "\n";
fstr = fstr + " * @return true or false depending on whether test passed or failed.";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " ***********************************************************";
fstr = fstr + "\n";
fstr = fstr + " */";
fstr = fstr + "\n";
fstr = fstr + " public boolean execute(Object tobj)";
fstr = fstr + "\n";
fstr = fstr + " {";
fstr = fstr + "\n";
fstr = fstr + " if (tobj == null) {";
fstr = fstr + "\n";
fstr = fstr + " TestLoader.logPrint(\"Object is NULL...\");";
fstr = fstr + "\n";
fstr = fstr + " return BWBaseTest.FAILED;";
fstr = fstr + "\n";
fstr = fstr + " }";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + " String os = System.getProperty(\"OS\");";
fstr = fstr + "\n";
fstr = fstr + " osRoutine(os);";
fstr = fstr + "\n";
/* String pString=valueList;
if (valueList == null)
pString= new String("");
*/
if (rules != null && rules.get(className) != null)
fstr =fstr + makeTestRoutine(className, returnType, methodName, valueList);
fstr = fstr + " return BWBaseTest.PASSED;";
fstr = fstr + "\n";
fstr = fstr + " }";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + " /**";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " ***********************************************************";
fstr = fstr + "\n";
fstr = fstr + " * Routine where OS specific checks are made. ";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " * @param os OS Name (SunOS/Linus/MacOS/...)";
fstr = fstr + "\n";
fstr = fstr + " ***********************************************************";
fstr = fstr + "\n";
fstr = fstr + " *";
fstr = fstr + "\n";
fstr = fstr + " */";
fstr = fstr + "\n";
fstr = fstr + " private void osRoutine(String os)";
fstr = fstr + "\n";
fstr = fstr + " {";
fstr = fstr + "\n";
fstr = fstr + " if(os == null) return;";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + " os = os.trim();";
fstr = fstr + "\n";
fstr = fstr + " if(os.compareTo(\"SunOS\") == 0) {}";
fstr = fstr + "\n";
fstr = fstr + " else if(os.compareTo(\"Linux\") == 0) {}";
fstr = fstr + "\n";
fstr = fstr + " else if(os.compareTo(\"Windows\") == 0) {}";
fstr = fstr + "\n";
fstr = fstr + " else if(os.compareTo(\"MacOS\") == 0) {}";
fstr = fstr + "\n";
fstr = fstr + " else {}";
fstr = fstr + "\n";
fstr = fstr + " }";
fstr = fstr + "\n";
fstr = fstr + "}";
fstr = fstr + "\n";
raf.write(fstr.getBytes());
} catch (IOException e) {
System.out.println("ERROR: Could not write to File " + filename);
return;
}
try {
raf.close();
} catch (Exception e) {
System.out.println("ERROR: Could not close File " + filename);
return;
}
DataOutputStream dos = null;
String txtFile = className + ".txt";
try {
dos = new DataOutputStream( new FileOutputStream(outputDir+txtFile));
} catch (Exception e) {
System.out.println("ERROR: Could not create File " + txtFile);
return;
}
String str = className + ":" + currMethod + ":" + currParamList + ":" + filename;
outputFiles.addElement(str);
try {
dos.write(str.getBytes());
} catch (IOException e) {
System.out.println("ERROR: Could not write to File " + txtFile);
return;
}
try {
dos.close();
} catch (Exception e) {
System.out.println("ERROR: Could not close File " + txtFile);
return;
}
}
private Method findMethod(String mn) {
if (methods == null)
return null;
for (int i=0; i < methods.length; i++) {
//System.out.println("Comparing: "+mn+" <-> "+methods[i].getName());
if (methods[i].getName().compareTo(mn) == 0)
return methods[i];
}
return null;
}
private String makeTestRoutine(String className, String returnType, String methodName, String valueList) {
String result = new String("");
String tab = " ", tab1=tab+tab, tab2=tab1+tab, tab3=tab2+tab1;
String robj = "", check = "";
String valList = valueList;
if (valueList == null)
valList = "";
/*Weather method returns object ?*/
if (returnType.compareTo("void") != 0) {
robj = returnType + " rc = ";
if (returnType.indexOf('.') > 0)
check = tab3 + "if (rc == null) return BWBaseTest.FAILED;\n";
}
/*Let's try to find set<->get pair for methods with one argument ...*/
if (methodName.startsWith("set") && valueList.indexOf(',') < 0 && valueList.compareTo("null") != 0) {
String getMethod = "get" + methodName.substring(3);
//System.out.println("GET_METHOD "+getMethod);
Method m;
if ((m = findMethod(getMethod)) != null && m.getParameterTypes().length == 0) {
String equals = ".equals";
/* Weather return type is standard ?*/
if (m.getReturnType().getName().indexOf('.') < 0)
equals = "==";
check = tab3+"if (!(obj."+getMethod+"()"+equals+"("+valueList+"))) return BWBaseTest.FAILED;\n";
}
}
result += tab1 + "Document d = (Document)tobj;\n";
result += tab1 + "if (d != null) {\n";
result += tab2 + "try {\n";
result += tab3 + className+" obj = " + rules.get(className)+";\n";
result += tab3 + robj + "obj." + methodName + "("+valList+");\n" + check;
result += tab2 + "} catch (Exception e) {\n";
result += tab3 + "return BWBaseTest.FAILED;\n";
result += tab2 + "}\n";
result += tab1 + "} else {\n";
result += tab2 + "return BWBaseTest.FAILED;\n";
result += tab1 + "}\n";
return result;
}
public static void usage()
{
System.out.println("Usage: java JavaTestTemplate [-d <output dir>] [-r <rules_file>] <className>");
}
public static void main(String args[])
{
if (args.length == 0)
{
BWJavaTemplate.usage();
return;
}
String className = null;
String outDirectory = null;
String rulesFile = null;
switch(args.length) {
case(0):
BWJavaTemplate.usage();
return;
case(1):
if(args[0].charAt(0) == '-') {
BWJavaTemplate.usage();
return;
}
className = args[0];
break;
default:
for(int i=0; i<args.length;) {
if(args[i].charAt(0) != '-') {
if (className != null) {
BWJavaTemplate.usage();
return;
}
className = args[i];
i++;
} else {
switch(args[i].charAt(1)) {
case('d'):
outDirectory = args[i+1];
i+=2;
break;
case('r'):
rulesFile = args[i+1];
i+=2;
break;
default:
BWJavaTemplate.usage();
return;
} //end of switch
}
}
} //end of switch
/*
if (args.length == 3) {
if (args[0].compareTo("-d") != 0) {
BWJavaTemplate.usage();
return;
} else {
outDirectory = args[1];
className = args[2];
}
} else {
outDirectory = new String(".");
className = args[0];
}
*/
BWJavaTemplate jt = new BWJavaTemplate(className, outDirectory, rulesFile);
}
}

View File

@@ -1,7 +0,0 @@
BW_TESTDIR=/workspace/mozilla/java/dom/tests/src
BW_TESTFILE=BWTestClass.lst
BW_LOGDIR=/workspace/mozilla/java/dom/tests/src/log
BW_LOGFILE=BWTest.log
BW_THREADMODE=S
BW_HTMLTEST=file:
BW_XMLTEST=file:

View File

@@ -1 +0,0 @@
org.mozilla.dom.test.AttrImpl_getName

View File

@@ -1,237 +0,0 @@
org.mozilla.dom.test.AttrImpl_getName
org.mozilla.dom.test.AttrImpl_getSpecified
org.mozilla.dom.test.AttrImpl_getValue
org.mozilla.dom.test.AttrImpl_getOwnerElement
org.mozilla.dom.test.AttrImpl_setValue_String_0
org.mozilla.dom.test.AttrImpl_setValue_String_1
org.mozilla.dom.test.CharacterDataImpl_appendData_String_0
org.mozilla.dom.test.CharacterDataImpl_appendData_String_1
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_0
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_1
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_2
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_3
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_4
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_5
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_6
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_7
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_8
org.mozilla.dom.test.CharacterDataImpl_getData
org.mozilla.dom.test.CharacterDataImpl_getLength
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_0
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_1
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_2
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_3
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_4
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_5
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_0
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_1
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_10
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_11
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_12
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_13
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_14
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_15
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_16
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_17
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_2
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_3
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_4
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_5
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_6
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_7
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_8
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_9
org.mozilla.dom.test.CharacterDataImpl_setData_String_0
org.mozilla.dom.test.CharacterDataImpl_setData_String_1
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_0
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_1
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_2
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_3
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_4
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_5
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_6
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_7
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_8
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_0
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_1
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_2
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_3
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_4
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_0
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_String_0
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_0
org.mozilla.dom.test.DocumentImpl_createAttribute_String_0
org.mozilla.dom.test.DocumentImpl_createAttribute_String_1
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_0
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_1
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_2
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_3
org.mozilla.dom.test.DocumentImpl_createCDATASection_String_0
org.mozilla.dom.test.DocumentImpl_createCDATASection_String_1
org.mozilla.dom.test.DocumentImpl_createComment_String_0
org.mozilla.dom.test.DocumentImpl_createComment_String_1
org.mozilla.dom.test.DocumentImpl_createDocumentFragment
org.mozilla.dom.test.DocumentImpl_createElement_String_0
org.mozilla.dom.test.DocumentImpl_createElement_String_1
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_0
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_1
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_2
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_3
org.mozilla.dom.test.DocumentImpl_createEntityReference_String_0
org.mozilla.dom.test.DocumentImpl_createEvent_String_0
org.mozilla.dom.test.DocumentImpl_createEvent_String_1
org.mozilla.dom.test.DocumentImpl_createProcessingInstruction_String_String_0
org.mozilla.dom.test.DocumentImpl_createProcessingInstruction_String_String_1
org.mozilla.dom.test.DocumentImpl_createProcessingInstruction_String_String_2
org.mozilla.dom.test.DocumentImpl_createProcessingInstruction_String_String_3
org.mozilla.dom.test.DocumentImpl_createTextNode_String_0
org.mozilla.dom.test.DocumentImpl_createTextNode_String_1
org.mozilla.dom.test.DocumentImpl_getDoctype
org.mozilla.dom.test.DocumentImpl_getDocumentElement
org.mozilla.dom.test.DocumentImpl_getElementsByTagName_String_0
org.mozilla.dom.test.DocumentImpl_getElementsByTagName_String_1
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_0
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_1
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_2
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_3
org.mozilla.dom.test.DocumentImpl_getElementById_String_0
org.mozilla.dom.test.DocumentImpl_getElementById_String_1
org.mozilla.dom.test.DocumentImpl_getImplementation
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_0
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_1
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_2
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_3
org.mozilla.dom.test.DocumentTypeImpl_getEntities
org.mozilla.dom.test.DocumentTypeImpl_getName
org.mozilla.dom.test.DocumentTypeImpl_getNotations
org.mozilla.dom.test.DocumentTypeImpl_getPublicId
org.mozilla.dom.test.DocumentTypeImpl_getSystemId
org.mozilla.dom.test.DocumentTypeImpl_getInternalSubset
org.mozilla.dom.test.ElementImpl_getAttributeNode_String_0
org.mozilla.dom.test.ElementImpl_getAttributeNode_String_1
org.mozilla.dom.test.ElementImpl_getAttribute_String_0
org.mozilla.dom.test.ElementImpl_getAttribute_String_1
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_0
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_1
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_2
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_3
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_0
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_1
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_2
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_3
org.mozilla.dom.test.ElementImpl_getElementsByTagName_String_0
org.mozilla.dom.test.ElementImpl_getElementsByTagName_String_1
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_0
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_1
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_2
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_3
org.mozilla.dom.test.ElementImpl_getTagName
org.mozilla.dom.test.ElementImpl_hasAttribute_String_0
org.mozilla.dom.test.ElementImpl_hasAttribute_String_1
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_0
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_1
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_2
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_3
org.mozilla.dom.test.ElementImpl_normalize
org.mozilla.dom.test.ElementImpl_removeAttributeNode_Attr_0
org.mozilla.dom.test.ElementImpl_removeAttributeNode_Attr_1
org.mozilla.dom.test.ElementImpl_removeAttribute_String_0
org.mozilla.dom.test.ElementImpl_removeAttribute_String_1
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_0
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_1
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_2
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_3
org.mozilla.dom.test.ElementImpl_setAttributeNode_Attr_0
org.mozilla.dom.test.ElementImpl_setAttributeNode_Attr_1
org.mozilla.dom.test.ElementImpl_setAttributeNode_Attr_2
org.mozilla.dom.test.ElementImpl_setAttributeNodeNS_Attr_0
org.mozilla.dom.test.ElementImpl_setAttributeNodeNS_Attr_1
org.mozilla.dom.test.ElementImpl_setAttribute_String_String_0
org.mozilla.dom.test.ElementImpl_setAttribute_String_String_1
org.mozilla.dom.test.ElementImpl_setAttribute_String_String_2
org.mozilla.dom.test.ElementImpl_setAttribute_String_String_3
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_0
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_1
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_2
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_3
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_4
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_5
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_6
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_7
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_8
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_9
org.mozilla.dom.test.NamedNodeMapImpl_getLength
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItem_String_0
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItem_String_1
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItemNS_String_String_0
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItemNS_String_String_1
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItemNS_String_String_2
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItemNS_String_String_3
org.mozilla.dom.test.NamedNodeMapImpl_item_int_0
org.mozilla.dom.test.NamedNodeMapImpl_item_int_1
org.mozilla.dom.test.NamedNodeMapImpl_item_int_2
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItem_String_0
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItem_String_1
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItemNS_String_String_0
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItemNS_String_String_1
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItemNS_String_String_2
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItemNS_String_String_3
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItem_Node_0
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItem_Node_1
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItem_Node_2
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItemNS_Node_0
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItemNS_Node_1
org.mozilla.dom.test.NodeImpl_appendChild_Node_0
org.mozilla.dom.test.NodeImpl_appendChild_Node_1
org.mozilla.dom.test.NodeImpl_cloneNode_boolean_0
org.mozilla.dom.test.NodeImpl_cloneNode_boolean_1
org.mozilla.dom.test.NodeImpl_equals_Object_0
org.mozilla.dom.test.NodeImpl_equals_Object_1
org.mozilla.dom.test.NodeImpl_equals_Object_2
org.mozilla.dom.test.NodeImpl_getAttributes
org.mozilla.dom.test.NodeImpl_getChildNodes
org.mozilla.dom.test.NodeImpl_getFirstChild
org.mozilla.dom.test.NodeImpl_getLastChild
org.mozilla.dom.test.NodeImpl_getNextSibling
org.mozilla.dom.test.NodeImpl_getNodeName
org.mozilla.dom.test.NodeImpl_getNodeType
org.mozilla.dom.test.NodeImpl_getNodeValue
org.mozilla.dom.test.NodeImpl_getOwnerDocument
org.mozilla.dom.test.NodeImpl_getParentNode
org.mozilla.dom.test.NodeImpl_getPreviousSibling
org.mozilla.dom.test.NodeImpl_getNamespaceURI
org.mozilla.dom.test.NodeImpl_getPrefix
org.mozilla.dom.test.NodeImpl_getLocalName
org.mozilla.dom.test.NodeImpl_hasChildNodes
org.mozilla.dom.test.NodeImpl_hashCode
org.mozilla.dom.test.NodeImpl_insertBefore_Node_Node_0
org.mozilla.dom.test.NodeImpl_insertBefore_Node_Node_1
org.mozilla.dom.test.NodeImpl_insertBefore_Node_Node_2
org.mozilla.dom.test.NodeImpl_insertBefore_Node_Node_3
org.mozilla.dom.test.NodeImpl_removeChild_Node_0
org.mozilla.dom.test.NodeImpl_removeChild_Node_1
org.mozilla.dom.test.NodeImpl_replaceChild_Node_Node_0
org.mozilla.dom.test.NodeImpl_replaceChild_Node_Node_1
org.mozilla.dom.test.NodeImpl_replaceChild_Node_Node_2
org.mozilla.dom.test.NodeImpl_replaceChild_Node_Node_3
org.mozilla.dom.test.NodeImpl_setNodeValue_String_0
org.mozilla.dom.test.NodeImpl_setNodeValue_String_1
org.mozilla.dom.test.NodeImpl_toString
org.mozilla.dom.test.NodeImpl_normalize
org.mozilla.dom.test.NodeImpl_setPrefix_String_0
org.mozilla.dom.test.NodeImpl_setPrefix_String_1
org.mozilla.dom.test.NodeImpl_supports_String_String_0
org.mozilla.dom.test.NodeImpl_supports_String_String_1
org.mozilla.dom.test.NodeImpl_supports_String_String_2
org.mozilla.dom.test.NodeImpl_supports_String_String_3
org.mozilla.dom.test.NodeListImpl_getLength
org.mozilla.dom.test.NodeListImpl_item_int_0
org.mozilla.dom.test.NodeListImpl_item_int_1
org.mozilla.dom.test.NodeListImpl_item_int_2
org.mozilla.dom.test.ProcessingInstructionImpl_getData
org.mozilla.dom.test.ProcessingInstructionImpl_getTarget
org.mozilla.dom.test.ProcessingInstructionImpl_setData_String_0
org.mozilla.dom.test.ProcessingInstructionImpl_setData_String_1
org.mozilla.dom.test.TextImpl_splitText_int_0
org.mozilla.dom.test.TextImpl_splitText_int_1
org.mozilla.dom.test.TextImpl_splitText_int_2

View File

@@ -1,228 +0,0 @@
org.mozilla.dom.test.AttrImpl_getName
org.mozilla.dom.test.AttrImpl_getSpecified
org.mozilla.dom.test.AttrImpl_getValue
org.mozilla.dom.test.AttrImpl_getOwnerElement
org.mozilla.dom.test.AttrImpl_setValue_String_0
org.mozilla.dom.test.AttrImpl_setValue_String_1
org.mozilla.dom.test.CharacterDataImpl_appendData_String_0
org.mozilla.dom.test.CharacterDataImpl_appendData_String_1
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_0
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_1
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_2
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_3
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_4
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_5
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_6
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_7
org.mozilla.dom.test.CharacterDataImpl_deleteData_int_int_8
org.mozilla.dom.test.CharacterDataImpl_getData
org.mozilla.dom.test.CharacterDataImpl_getLength
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_0
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_1
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_2
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_3
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_4
org.mozilla.dom.test.CharacterDataImpl_insertData_int_String_5
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_0
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_1
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_10
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_11
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_12
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_13
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_14
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_15
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_16
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_17
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_2
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_3
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_4
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_5
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_6
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_7
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_8
org.mozilla.dom.test.CharacterDataImpl_replaceData_int_int_String_9
org.mozilla.dom.test.CharacterDataImpl_setData_String_0
org.mozilla.dom.test.CharacterDataImpl_setData_String_1
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_0
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_1
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_2
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_3
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_4
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_5
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_6
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_7
org.mozilla.dom.test.CharacterDataImpl_substringData_int_int_8
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_0
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_1
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_2
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_3
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_0
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_1
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_2
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_3
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_4
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_0
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_1
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_2
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_3
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_4
org.mozilla.dom.test.DocumentImpl_createAttribute_String_0
org.mozilla.dom.test.DocumentImpl_createAttribute_String_1
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_0
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_1
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_2
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_3
org.mozilla.dom.test.DocumentImpl_createComment_String_0
org.mozilla.dom.test.DocumentImpl_createComment_String_1
org.mozilla.dom.test.DocumentImpl_createDocumentFragment
org.mozilla.dom.test.DocumentImpl_createElement_String_0
org.mozilla.dom.test.DocumentImpl_createElement_String_1
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_0
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_1
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_2
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_3
org.mozilla.dom.test.DocumentImpl_createEvent_String_0
org.mozilla.dom.test.DocumentImpl_createEvent_String_1
org.mozilla.dom.test.DocumentImpl_createEvent_String_2
org.mozilla.dom.test.DocumentImpl_createTextNode_String_0
org.mozilla.dom.test.DocumentImpl_createTextNode_String_1
org.mozilla.dom.test.DocumentImpl_getDoctype
org.mozilla.dom.test.DocumentImpl_getDocumentElement
org.mozilla.dom.test.DocumentImpl_getElementsByTagName_String_0
org.mozilla.dom.test.DocumentImpl_getElementsByTagName_String_1
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_0
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_1
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_2
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_3
org.mozilla.dom.test.DocumentImpl_getElementById_String_0
org.mozilla.dom.test.DocumentImpl_getElementById_String_1
org.mozilla.dom.test.DocumentImpl_getElementById_String_2
org.mozilla.dom.test.DocumentImpl_getImplementation
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_0
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_1
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_2
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_3
org.mozilla.dom.test.ElementImpl_getAttributeNode_String_0
org.mozilla.dom.test.ElementImpl_getAttributeNode_String_1
org.mozilla.dom.test.ElementImpl_getAttribute_String_0
org.mozilla.dom.test.ElementImpl_getAttribute_String_1
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_0
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_1
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_2
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_3
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_0
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_1
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_2
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_3
org.mozilla.dom.test.ElementImpl_getElementsByTagName_String_0
org.mozilla.dom.test.ElementImpl_getElementsByTagName_String_1
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_0
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_1
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_2
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_3
org.mozilla.dom.test.ElementImpl_getTagName
org.mozilla.dom.test.ElementImpl_hasAttribute_String_0
org.mozilla.dom.test.ElementImpl_hasAttribute_String_1
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_0
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_1
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_2
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_3
org.mozilla.dom.test.ElementImpl_normalize
org.mozilla.dom.test.ElementImpl_removeAttributeNode_Attr_0
org.mozilla.dom.test.ElementImpl_removeAttributeNode_Attr_1
org.mozilla.dom.test.ElementImpl_removeAttribute_String_0
org.mozilla.dom.test.ElementImpl_removeAttribute_String_1
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_0
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_1
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_2
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_3
org.mozilla.dom.test.ElementImpl_setAttributeNode_Attr_0
org.mozilla.dom.test.ElementImpl_setAttributeNode_Attr_1
org.mozilla.dom.test.ElementImpl_setAttributeNode_Attr_2
org.mozilla.dom.test.ElementImpl_setAttributeNodeNS_Attr_0
org.mozilla.dom.test.ElementImpl_setAttributeNodeNS_Attr_1
org.mozilla.dom.test.ElementImpl_setAttribute_String_String_0
org.mozilla.dom.test.ElementImpl_setAttribute_String_String_1
org.mozilla.dom.test.ElementImpl_setAttribute_String_String_2
org.mozilla.dom.test.ElementImpl_setAttribute_String_String_3
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_0
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_1
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_2
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_3
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_4
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_5
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_6
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_7
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_8
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_9
org.mozilla.dom.test.NamedNodeMapImpl_getLength
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItem_String_0
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItem_String_1
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItemNS_String_String_0
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItemNS_String_String_1
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItemNS_String_String_2
org.mozilla.dom.test.NamedNodeMapImpl_getNamedItemNS_String_String_3
org.mozilla.dom.test.NamedNodeMapImpl_item_int_0
org.mozilla.dom.test.NamedNodeMapImpl_item_int_1
org.mozilla.dom.test.NamedNodeMapImpl_item_int_2
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItem_String_0
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItem_String_1
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItemNS_String_String_0
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItemNS_String_String_1
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItemNS_String_String_2
org.mozilla.dom.test.NamedNodeMapImpl_removeNamedItemNS_String_String_3
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItem_Node_0
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItem_Node_1
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItem_Node_2
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItemNS_Node_0
org.mozilla.dom.test.NamedNodeMapImpl_setNamedItemNS_Node_1
org.mozilla.dom.test.NodeImpl_appendChild_Node_0
org.mozilla.dom.test.NodeImpl_appendChild_Node_1
org.mozilla.dom.test.NodeImpl_cloneNode_boolean_0
org.mozilla.dom.test.NodeImpl_cloneNode_boolean_1
org.mozilla.dom.test.NodeImpl_equals_Object_0
org.mozilla.dom.test.NodeImpl_equals_Object_1
org.mozilla.dom.test.NodeImpl_equals_Object_2
org.mozilla.dom.test.NodeImpl_getAttributes
org.mozilla.dom.test.NodeImpl_getChildNodes
org.mozilla.dom.test.NodeImpl_getFirstChild
org.mozilla.dom.test.NodeImpl_getLastChild
org.mozilla.dom.test.NodeImpl_getNextSibling
org.mozilla.dom.test.NodeImpl_getNodeName
org.mozilla.dom.test.NodeImpl_getNodeType
org.mozilla.dom.test.NodeImpl_getNodeValue
org.mozilla.dom.test.NodeImpl_getOwnerDocument
org.mozilla.dom.test.NodeImpl_getParentNode
org.mozilla.dom.test.NodeImpl_getPreviousSibling
org.mozilla.dom.test.NodeImpl_getNamespaceURI
org.mozilla.dom.test.NodeImpl_getPrefix
org.mozilla.dom.test.NodeImpl_getLocalName
org.mozilla.dom.test.NodeImpl_hasChildNodes
org.mozilla.dom.test.NodeImpl_hashCode
org.mozilla.dom.test.NodeImpl_insertBefore_Node_Node_0
org.mozilla.dom.test.NodeImpl_insertBefore_Node_Node_1
org.mozilla.dom.test.NodeImpl_insertBefore_Node_Node_2
org.mozilla.dom.test.NodeImpl_insertBefore_Node_Node_3
org.mozilla.dom.test.NodeImpl_removeChild_Node_0
org.mozilla.dom.test.NodeImpl_removeChild_Node_1
org.mozilla.dom.test.NodeImpl_replaceChild_Node_Node_0
org.mozilla.dom.test.NodeImpl_replaceChild_Node_Node_1
org.mozilla.dom.test.NodeImpl_replaceChild_Node_Node_2
org.mozilla.dom.test.NodeImpl_replaceChild_Node_Node_3
org.mozilla.dom.test.NodeImpl_setNodeValue_String_0
org.mozilla.dom.test.NodeImpl_setNodeValue_String_1
org.mozilla.dom.test.NodeImpl_toString
org.mozilla.dom.test.NodeListImpl_getLength
org.mozilla.dom.test.NodeListImpl_item_int_0
org.mozilla.dom.test.NodeListImpl_item_int_1
org.mozilla.dom.test.NodeListImpl_item_int_2
org.mozilla.dom.test.NodeImpl_normalize
org.mozilla.dom.test.NodeImpl_setPrefix_String_0
org.mozilla.dom.test.NodeImpl_setPrefix_String_1
org.mozilla.dom.test.NodeImpl_supports_String_String_0
org.mozilla.dom.test.NodeImpl_supports_String_String_1
org.mozilla.dom.test.NodeImpl_supports_String_String_2
org.mozilla.dom.test.NodeImpl_supports_String_String_3
org.mozilla.dom.test.TextImpl_splitText_int_0
org.mozilla.dom.test.TextImpl_splitText_int_1
org.mozilla.dom.test.TextImpl_splitText_int_2

View File

@@ -1,112 +0,0 @@
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_0
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_1
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_2
org.mozilla.dom.test.DOMImplementationImpl_hasFeature_String_String_4
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_0
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_1
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_2
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_3
org.mozilla.dom.test.DOMImplementationImpl_createDocumentType_String_String_String_4
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_0
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_1
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_2
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_3
org.mozilla.dom.test.DOMImplementationImpl_createDocument_String_String_DocumentType_4
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_0
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_1
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_2
org.mozilla.dom.test.DocumentImpl_createAttributeNS_String_String_3
org.mozilla.dom.test.DocumentImpl_createCDATASection_String_0
org.mozilla.dom.test.DocumentImpl_createCDATASection_String_1
org.mozilla.dom.test.DocumentImpl_createComment_String_0
org.mozilla.dom.test.DocumentImpl_createComment_String_1
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_0
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_1
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_2
org.mozilla.dom.test.DocumentImpl_createElement_createElementNS_String_String_3
org.mozilla.dom.test.DocumentImpl_createEvent_String_0
org.mozilla.dom.test.DocumentImpl_createEvent_String_1
org.mozilla.dom.test.DocumentImpl_createEvent_String_2
org.mozilla.dom.test.DocumentImpl_createEntityReference_String_0
org.mozilla.dom.test.DocumentImpl_createEntityReference_String_1
org.mozilla.dom.test.DocumentImpl_createProcessingInstruction_String_String_0
org.mozilla.dom.test.DocumentImpl_createProcessingInstruction_String_String_1
org.mozilla.dom.test.DocumentImpl_createProcessingInstruction_String_String_2
org.mozilla.dom.test.DocumentImpl_createProcessingInstruction_String_String_3
org.mozilla.dom.test.DocumentImpl_createTextNode_String_0
org.mozilla.dom.test.DocumentImpl_createTextNode_String_1
org.mozilla.dom.test.DocumentImpl_getDoctype_xml
org.mozilla.dom.test.DocumentImpl_getDocumentElement
org.mozilla.dom.test.DocumentImpl_getElementsByTagName_String_0
org.mozilla.dom.test.DocumentImpl_getElementsByTagName_String_1
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_0
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_1
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_2
org.mozilla.dom.test.DocumentImpl_getElementsByTagNameNS_String_String_3
org.mozilla.dom.test.DocumentImpl_getElementById_String_0
org.mozilla.dom.test.DocumentImpl_getElementById_String_1
org.mozilla.dom.test.DocumentImpl_getElementById_String_2
org.mozilla.dom.test.DocumentImpl_getImplementation
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_0
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_1
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_2
org.mozilla.dom.test.DocumentImpl_importNode_Node_boolean_3
org.mozilla.dom.test.DocumentTypeImpl_getEntities
org.mozilla.dom.test.DocumentTypeImpl_getName
org.mozilla.dom.test.DocumentTypeImpl_getNotations
org.mozilla.dom.test.DocumentTypeImpl_getPublicId
org.mozilla.dom.test.DocumentTypeImpl_getSystemId
org.mozilla.dom.test.DocumentTypeImpl_getInternalSubset
org.mozilla.dom.test.ProcessingInstructionImpl_getData
org.mozilla.dom.test.ProcessingInstructionImpl_getTarget
org.mozilla.dom.test.ProcessingInstructionImpl_setData_String_0
org.mozilla.dom.test.ProcessingInstructionImpl_setData_String_1
org.mozilla.dom.test.TextImpl_splitText_int_0
org.mozilla.dom.test.TextImpl_splitText_int_1
org.mozilla.dom.test.TextImpl_splitText_int_2
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_0
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_1
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_2
org.mozilla.dom.test.ElementImpl_getAttributeNS_String_String_3
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_0
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_1
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_2
org.mozilla.dom.test.ElementImpl_getAttributeNodeNS_String_String_3
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_0
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_1
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_2
org.mozilla.dom.test.ElementImpl_getElementsByTagNameNS_String_String_3
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_0
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_1
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_2
org.mozilla.dom.test.ElementImpl_hasAttributeNS_String_String_3
org.mozilla.dom.test.ElementImpl_hasAttribute_String_0
org.mozilla.dom.test.ElementImpl_hasAttribute_String_1
org.mozilla.dom.test.ElementImpl_hasAttribute_String_2
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_0
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_1
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_2
org.mozilla.dom.test.ElementImpl_removeAttributeNS_String_String_3
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_0
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_1
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_2
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_3
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_4
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_5
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_6
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_7
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_8
org.mozilla.dom.test.ElementImpl_setAttributeNS_String_String_String_9
org.mozilla.dom.test.ElementImpl_setAttributeNodeNS_Attr_0
org.mozilla.dom.test.ElementImpl_setAttributeNodeNS_Attr_1
org.mozilla.dom.test.NodeImpl_getLocalName
org.mozilla.dom.test.NodeImpl_getNamespaceURI
org.mozilla.dom.test.NodeImpl_getPrefix_0
org.mozilla.dom.test.NodeImpl_getPrefix_1
org.mozilla.dom.test.NodeImpl_setPrefix_String_0
org.mozilla.dom.test.NodeImpl_setPrefix_String_1
org.mozilla.dom.test.NodeImpl_supports_String_String_0
org.mozilla.dom.test.NodeImpl_supports_String_String_1
org.mozilla.dom.test.NodeImpl_supports_String_String_2
org.mozilla.dom.test.NodeImpl_supports_String_String_3

View File

@@ -1,119 +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):
*/
package org.mozilla.dom.test;
public class BWTestThread extends Thread
{
/**
* Constructor
*
* @param str Thread Name
*
* @return
*
*/
public BWTestThread (String astr)
{
super(astr);
threadName = astr;
if (threadName == null)
threadName = "defaultThread";
}
/**
* Set the Test Case ClassObject which has to be launched by this thread.
* and the Base Document Object.
* all these objects extend from BWBaseTest class.
*
* @param aobj Test Class Object reference
* (subclassed from BWBaseTest).
* @param atargetObj Base Document Object Reference
*
*
* @return
*
*/
public void setTestObject(Object aobj, Object atargetObj)
{
classObj = aobj;
targetObj = atargetObj;
}
/**
* Get the Test Case Object Reference.
*
* @return Test Object Reference
*
*/
public Object getTestObject()
{
return classObj;
}
/**
* Get the Thread Name
*
* @return thread name string
*
*/
public String getThreadName()
{
return threadName;
}
/**
* Thread Run Method
*
* @return
*
*/
public void run()
{
if (classObj == null) return;
if (targetObj == null) return;
try {
Thread.sleep (10);
} catch (Exception e) {
}
execute();
}
public synchronized void execute()
{
if (((BWBaseTest)classObj).execute(targetObj)) {
TestLoader.txtPrint(threadName, "PASSED");
} else {
TestLoader.txtPrint(threadName, "FAILED");
}
}
private Object classObj=null;
private Object targetObj=null;
private String threadName=null;
}

View File

@@ -1,200 +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):
*/
package org.mozilla.dom;
import java.util.Vector;
import java.util.Enumeration;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.mozilla.dom.test.*;
import java.security.AccessController;
public final class DOMAccessor {
private static Vector documentLoadListeners = new Vector();
private static JavaDOMPermission permission = new JavaDOMPermission("JavaDOM");
static {
System.loadLibrary("javadomjni");
addDocumentLoadListener(new TestListener());
}
private void DOMAccessorImpl() {}
private static native void register();
private static native void unregister();
private static native Node getNodeByHandle(long p);
private static native void doGC();
public static synchronized void
addDocumentLoadListener(DocumentLoadListener listener) {
if (documentLoadListeners.size() == 0) {
register();
}
documentLoadListeners.addElement(listener);
}
public static synchronized void
removeDocumentLoadListener(DocumentLoadListener listener) {
documentLoadListeners.removeElement(listener);
if (documentLoadListeners.size() == 0) {
unregister();
}
}
public static synchronized void
startURLLoad(String url, String contentType, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.startURLLoad(url, contentType, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
endURLLoad(String url, int status, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.endURLLoad(url, status, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
progressURLLoad(String url, int progress, int progressMax,
long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.progressURLLoad(url, progress, progressMax, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
statusURLLoad(String url, String message, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.statusURLLoad(url, message, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
startDocumentLoad(String url) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.startDocumentLoad(url);
}
doGC();
}
public static synchronized void
endDocumentLoad(String url, int status, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.endDocumentLoad(url, status, (Document)getNodeByHandle(p_doc));
}
doGC();
}
}
class TestListener implements DocumentLoadListener {
public void endDocumentLoad(String url, int status, Document doc) {
if (url.endsWith(".xul")
|| url.endsWith(".js")
|| url.endsWith(".css")
//|| url.startsWith("file:")
)
return;
if ((!(url.endsWith(".html"))) && (!(url.endsWith(".xml"))))
return;
if (url.endsWith(".html"))
{
if (url.indexOf("test.html") == -1) {
System.err.println("TestCases Tuned to run with test.html...");
return;
}
}
if (url.endsWith(".xml"))
{
if (url.indexOf("test.xml") == -1) {
System.err.println("TestCases Tuned to run with test.xml...");
return;
}
}
Object obj = (Object) doc;
System.out.println("Loading new TestLoader...\n");
TestLoader tl = new TestLoader(obj, 0);
if (tl != null) {
Object retobj = tl.loadTest();
}
//doc = null;
}
public void startURLLoad(String url, String contentType, 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 endURLLoad(String url, int status, Document doc) {}
} //end of class

View File

@@ -1,201 +0,0 @@
/*
The contents of this file are subject to the Mozilla Public License
Version 1.0 (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 Initial Developer of the Original Code is Sun Microsystems,
Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems,
Inc. All Rights Reserved.
*/
package org.mozilla.dom;
import java.io.FileOutputStream;
import java.io.BufferedOutputStream;
import java.io.PrintStream;
import java.io.IOException;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.*;
import org.mozilla.dom.test.*;
public class DOMFactory implements DocumentLoadListener {
private static final boolean debug = false;
public DocumentLoadListener getDocumentLoadListener() {
return this;
}
public void startURLLoad(String url, String contentType, Document doc) {
if (debug)
System.err.println("DOM: start URL load - " +
url.toString() + " " +
contentType);
}
public void endURLLoad(String url, int status, Document doc) {
if (debug)
System.err.println("DOM: end URL load - " +
url.toString() + " " +
Integer.toHexString(status));
if (url.endsWith(".xul") ||
url.endsWith(".js") ||
url.endsWith(".css") ||
url.startsWith("file:")) return;
if ((!(url.endsWith(".html"))) && (!(url.endsWith(".xml"))))
return;
if (url.endsWith(".html"))
{
if (url.indexOf("test.html") == -1) {
System.out.println("TestCases Tuned to run with test.html...");
return;
}
}
if (url.endsWith(".xml"))
{
if (url.indexOf("test.xml") == -1) {
System.out.println("TestCases Tuned to run with test.xml...");
return;
}
}
Object obj = (Object) doc;
TestLoader tl = new TestLoader(obj, 0);
if (tl != null) {
Object retobj = tl.loadTest();
}
doc = null;
}
public void progressURLLoad(String url, int progress, int progressMax, Document doc) {
if (debug)
System.err.println("DOM: progress URL load - " +
url.toString() + " " +
Integer.toString(progress) + "/" +
Integer.toString(progressMax));
}
public void statusURLLoad(String url, String message, Document doc) {
if (debug)
System.err.println("DOM: status URL load - " +
url.toString() + " (" +
message + ")");
}
public void startDocumentLoad(String url) {
if (debug)
System.err.println("DOM: start load - " +
url.toString());
}
public void endDocumentLoad(String url, int status, Document doc) {
if (debug) {
System.err.println("DOM: end load - " +
url.toString() + " " +
Integer.toHexString(status));
}
}
private void dump(PrintStream ps, Node node, int indent, boolean mapNode) {
ps.println();
for (int i=0; i<indent; i++)
ps.print(' ');
ps.print("name=\"" + node.getNodeName() + "\"" +
" type=" + dumpType(node.getNodeType()) +
" value=\"" + normalize(node.getNodeValue()) + "\"");
if (mapNode)
return;
NamedNodeMap map = node.getAttributes();
dumpMap(ps, map, indent);
NodeList children = node.getChildNodes();
if (children == null)
return;
int length = children.getLength();
for (int i=0; i < length; i++) {
dump(ps, children.item(i), indent+2, false);
}
}
private void dumpMap(PrintStream ps, NamedNodeMap map, int indent) {
if (map == null) return;
ps.println();
int length = map.getLength();
if (length > 0) {
for (int i=0; i<indent; i++)
ps.print(' ');
ps.print("------- start attributes -------");
}
for (int i=0; i < length; i++) {
Node item = map.item(i);
dump(ps, item, indent, true);
}
if (length > 0) {
ps.println();
for (int i=0; i<indent; i++)
ps.print(' ');
ps.print("------- end attributes -------");
}
}
private static String dumpType(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";
}
private static String normalize(String s) {
int len = s.length();
StringBuffer sb = new StringBuffer(len);
char c = ' ';
char pc = ' ';
for (int i=0; i < len; i++) {
c = s.charAt(i);
if ((pc == ' ' || pc == '\n' || pc == '\t') &&
(c == ' ' || c == '\n' || c == '\t'))
continue;
sb.append(c);
pc = c;
}
return sb.toString();
}
}

View File

@@ -1,93 +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):
*/
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

@@ -1,37 +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):
*/
package org.mozilla.dom.test;
public interface Execution
{
/**
*
* @param targetObj Object instance (Node/Document/....)
*
* @return Return true or false
*
*/
public boolean execute(Object targetObj);
}

View File

@@ -1,59 +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):
HOMEDIR=../
SRCDIR=$(HOMEDIR)/src
CLASSDIR=$(HOMEDIR)/classes
JAVAC=javac
TESTPACKAGE=org/mozilla/dom/test
DOMPACKAGE=org/mozilla/dom
all:
@echo "******************************************************"
@echo "Make changes to $(SRCDIR)/mozilla.csh"
@echo "and source it else it may not compile..."
@echo "******************************************************"
@echo ""
mkdir -p $(CLASSDIR)
$(JAVAC) -d $(CLASSDIR) $(JAVAFILES)
cd api; make
cd newsrc; make
JAVAFILES= Execution.java \
BWBaseTest.java \
TestLoader.java \
ParamCombination.java \
ReflectionTest.java \
BWTestThread.java \
BWJavaTemplate.java
DOMFILE= DocumentImpl.java \
DOMAccessor.java
clean:
for i in ${JAVAFILES} ; do \
file=$$i; \
classfile=`echo $$file | sed 's/java/class/g'` ; \
/bin/rm $(CLASSDIR)/$(TESTPACKAGE)/$$classfile ; done
/bin/rm $(CLASSDIR)/$(DOMPACKAGE)/DOMFactory.class ;
cd api; make clean

View File

@@ -1,59 +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):
HOMEDIR=../
SRCDIR=$(HOMEDIR)/src
CLASSDIR=$(HOMEDIR)/classes
JAVAC=javac
TESTPACKAGE=org/mozilla/dom/test
DOMPACKAGE=org/mozilla/dom
all:
@echo "******************************************************"
@echo "Make changes to $(SRCDIR)/mozilla.csh"
@echo "and source it else it may not compile..."
@echo "******************************************************"
@echo ""
mkdir -p $(CLASSDIR)
$(JAVAC) -d $(CLASSDIR) $(JAVAFILES)
cd api; make
cd newsrc; make
JAVAFILES= Execution.java \
BWBaseTest.java \
TestLoader.java \
ParamCombination.java \
ReflectionTest.java \
BWTestThread.java \
BWJavaTemplate.java
DOMFILE= DocumentImpl.java \
DOMAccessor.java
clean:
for i in ${JAVAFILES} ; do \
file=$$i; \
classfile=`echo $$file | sed 's/java/class/g'` ; \
/bin/rm $(CLASSDIR)/$(TESTPACKAGE)/$$classfile ; done
/bin/rm $(CLASSDIR)/$(DOMPACKAGE)/DOMFactory.class ;
cd api; make clean

View File

@@ -1,80 +0,0 @@
#!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
# 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):
HOMEDIR=..
SRCDIR=$(HOMEDIR)\src
CLASSDIR=$(HOMEDIR)\classes
JAVAC=javac
TESTPACKAGE=org\mozilla\dom\test
DOMPACKAGE=org\mozilla\dom
GENERATOR_FILES=BWJavaTemplate.java \
ReflectionTest.java \
ParamCombination.java
JAVAFILES= Execution.java \
BWBaseTest.java \
TestLoader.java \
ParamCombination.java \
ReflectionTest.java \
BWTestThread.java \
BWJavaTemplate.java
DOMFILE=DOMAccessor.java \
DocumentImpl.java
all: testloader
@echo done
@cd api
@nmake -f Makefile.win
@cd ..\newsrc
@nmake -f Makefile.win
testloader:
@echo "******************************************************"
@echo "Make changes to $(SRCDIR)\mozilla.bat"
@echo "and execute it else it may not compile..."
@echo "******************************************************"
@echo ""
@echo Building test accessory classes ...
@$(JAVAC) -d $(CLASSDIR) $(JAVAFILES)
accessor:
!if !defined(USE_APPLET_FOR_REGISTRATION)
@echo Building DOMAccessor ...
@$(JAVAC) -d $(CLASSDIR) $(DOMFILE)
!endif
generator:
javac $(GENERATOR_FILES) -d $(CLASSDIR)
clean:
del /f/q $(CLASSDIR)\$(TESTPACKAGE)\*.class
del /f/q $(CLASSDIR)\$(DOMPACKAGE)\*.class

View File

@@ -1,134 +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):
*/
package org.mozilla.dom.test;
import java.lang.*;
import java.util.*;
class ParamCombination
{
Object arrayOfVector[] = null;
int totalCombinations = 0;
int currIndex = 0;
/**
*
* Constructor
*
* @param paramLength No. of parameters which shall serve as index
* to array ofVectors
* @return void
*
*/
public ParamCombination(int paramLength)
{
arrayOfVector = new Object[paramLength];
if (arrayOfVector == null) return;
}
/**
*
* This routine adds a new Vector into arrayOfVector
*
* @param v Vector class containing values in string format
* viz: 0/null/DUMMY_STRING
* @return void
*
*/
public void addElement(Vector v)
{
if (v != null)
{
arrayOfVector[currIndex++] = v;
if (totalCombinations == 0) totalCombinations = v.size();
else totalCombinations = totalCombinations * v.size();
}
}
/**
*
* This routine adds a new Vector into arrayOfVector
*
* @return array of Strings containing all combinations of values in
* each Vector in vector array
*
*/
public String[] getValueList()
{
if (totalCombinations == 0) return null;
String str[] = new String[totalCombinations];
int len = arrayOfVector.length;
if (len == 1)
{
Vector v = (Vector)arrayOfVector[0];
for (int j=0; j< v.size(); j++)
str[j] = (String)v.elementAt(j);
return str;
}
Vector tmpVect = (Vector)arrayOfVector[len -1];
for (int i=arrayOfVector.length-2; i>= 0; i--)
{
tmpVect = getCombination((Vector)arrayOfVector[i], tmpVect);
}
for (int i=0; i< tmpVect.size(); i++)
{
str[i] = (String)tmpVect.elementAt(i);
}
return str;
}
/**
*
* Get all combinations of values in Vectors v1 and v2
*
* @param v1 Vector class containing values in string format
* viz: 0/null/DUMMY_STRING
* @param v2 Vector class containing values in string format
* viz: 0/null/DUMMY_STRING
* @return vector containing combinations of above values.
* viz: null, null
* null, DUMMY_STRING
* 0, null...
*
*/
private Vector getCombination( Vector v1, Vector v2)
{
Vector store = new Vector();
for (int i=0; i< v1.size(); i++)
{
String vstr1 = (String)v1.elementAt(i);
for (int j=0; j< v2.size(); j++)
{
String vstr2 = (String)v2.elementAt(j);
String newstr = vstr1 + ", " + vstr2;
store.addElement(newstr);
}
}
return store;
}
}

View File

@@ -1,121 +0,0 @@
This document describes steps required to run the Test Suite for JavaDOM API
throught a PLUGLET.
You have to build PLUGLETS before building this
( see http://www.mozilla.org/projects/blackwood/java-plugins )
For Solaris
===========
1) open mozilla.csh
2) make changes to variables
MOZILLA_FIVE_HOME - Absolute path where mozilla-bin
executable is located.
JAVA_HOME - Absolute Path to J2SE1.3 dir.
TEST_PATH - Absolute Directory Path where file
BWTestClass.lst is located.
PLUGLET - Absolute dir. where DOMPLUGLET.jar
is located
3) source mozilla.csh
this will set up the environment
4) Edit BWProperties file and change the locations for variables
BW_TESTDIR (Absolute Directory Path where file BWTestClass.lst is
located)
BW_LOGDIR (Absolute Directory Path where log files need to be
created)
BW_THREADMODE (Execute tests in single thread [S] or
multi-thread [M] mode. Takes values S/M.)
5) Set PLUGLET enviornment to point to classes dir.
setenv PLUGLET /opt/mozilla/java/dom/tests/classes
6) Set LD_PRELOAD to point to libXm.so
setenv LD_PRELOAD libXm.so
7) Invoke autorun.sh from command prompt.
sh autorun.sh
8) The results are recorded in HTML file BWTest.html
and in log file BWTest.log
Individual test Log files are also found in 'log' directory.
---------------------------------------------------------------------------
To Invoke a specific test case
sh autorun.sh -t org.mozilla.dom.test.AttrImpl_getName
NOTE: All TestCase list is recorded in file BWTestClass.lst.ORIG
If your machine is slow and loading time of mozilla is high then
accordingly increase DELAY_FACTOR to a higher value in autorun.sh.
=============================================================================
For WIN32
===========
Assumes you have installed PERL and the following variables are set in your environment:
MOZILLA_HOME - top directory in mozilla's tree
JAVA_HOME - path to JDK
1) open mozilla.bat
2) make changes to variables
MOZILLA_BIN - Mozilla's executable file name
(e.g. mozilla.exe or viewer.exe)
TEST_PATH - path to the current directory
(where mozilla.bat is)
PLUGLET - Absolute dir. where DOMPLUGLET.jar
is located
3) execute mozilla.bat from command prompt
this will create new console and set up the environment for this
command prompt
4) Edit BWProperties file and change the locations for variables
BW_TESTDIR (Absolute Directory Path where file BWTestClass.lst is
located)
BW_LOGDIR (Absolute Directory Path where log files need to be
created)
BW_THREADMODE (Execute tests in single thread [S] or
multi-thread [M] mode. Takes values S/M.)
NOTE: Since on Windows file separator is a `\`, it should be escaped
by another '\'. So if a file is in c:\mozilla\tests then it
would be written as c:\\mozilla\\tests.
5) Invoke autorun.pl from command prompt.
perl autorun.pl
6) The results are recorded in HTML file BWTest.html
and in log file BWTest.log
Individual test Log files are also found in 'log' directory.
---------------------------------------------------------------------------
To Invoke a specific test case
perl autorun.pl -t org.mozilla.dom.test.AttrImpl_getName
NOTE: All Test Cases are recorded in file BWTestClass.lst.ORIG
---------------------------------------------------------------------------
BUGS:
Currently a bug is filed against getDocumentType method of object Document.
for XML (see Bugzilla ID: 15118).
Hence all the tests which depend on the same will fail, namely
DocumentTypeImpl->getEntities
DocumentTypeImpl->getInternalSubset
DocumentTypeImpl->getName
DocumentTypeImpl->getNotations
DocumentTypeImpl->getPublicId
DocumentTypeImpl->getSystemId
DocumentImpl->getDoctype_xml

View File

@@ -1,341 +0,0 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.51 [en] (X11; U; SunOS 5.7 sun4u) [Netscape]">
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
<center>
<h3>
<b>README for DOM API Test Execution</b></h3>
<a href="#solaris">Solaris</a>
&nbsp;
&nbsp;
<a href="#winnt">WinNT</a>
&nbsp;
&nbsp;
<a href="#linux">Linux</a>
&nbsp;
&nbsp;
<a href="#mac">Macintosh</a>
</center>
<a name=solaris>
<center>
<hr NOSHADE WIDTH="100%"></center>
<i><u><font color="#990000"><font size=+3>Solaris</font></font></u></i>
<ul>
<li>
<b><font size=+1>open <font color="#FF6666">mozilla.csh</font></font></b></li>
<li>
<b><font size=+1>make changes to variables</font></b></li>
</ul>
<ul>&nbsp;
<center><table BORDER COLS=2 WIDTH="80%" BGCOLOR="#99FFCC" NOSAVE >
<tr NOSAVE>
<td WIDTH="30%" NOSAVE><b><font color="#FF6666"><font size=+1>TEST_PATH</font></font></b></td>
<td><b>Absolute Directory Path where file BWTestClass.lst is located.</b></td>
</tr>
<tr NOSAVE>
<td NOSAVE><b><font color="#FF6666"><font size=+1>MOZILLA_FIVE_HOME</font></font></b></td>
<td><b>Absolute Path where mozilla-bin is located.</b></td>
</tr>
<tr>
<td><b><font color="#FF6666"><font size=+1>JAVA_HOME</font></font></b></td>
<td><b>Absolute Path to JDK dir.</b></td>
</tr>
<tr>
<td><b><font color="#FF6666"><font size=+1>USE_APPLET_FOR_REGISTRATION</font></font></b></td>
<td><b>Set this variable if you wish to use applet for running tests (now
available under Win32 only). Otherwise hacked DOMAccessor class is
used.</b></td>
</tr>
</table></center>
<li>
<b><font size=+1>source mozilla.csh this will set up the environment</font></b></li>
<li>
<b><font size=+1>Edit BWProperties file and change the locations for variables</font></b></li>
</ul>
<center><table BORDER COLS=2 WIDTH="80%" BGCOLOR="#99FFCC" NOSAVE >
<tr NOSAVE>
<td WIDTH="30%" NOSAVE><b><font color="#FF6666"><font size=+1>BW_TESTDIR</font></font></b></td>
<td><b>Absolute Directory Path where file BWTestClass.lst is located.</b></td>
</tr>
<tr NOSAVE>
<td NOSAVE><b><font color="#FF6666"><font size=+1>BW_LOGDIR</font></font></b></td>
<td><b>Absolute Directory&nbsp; Path where log files need to be created.</b></td>
</tr>
<tr>
<td><b><font color="#FF6666"><font size=+1>BW_THREADMODE</font></font></b></td>
<td><b>Indicates whether to execute tests in single-thread mode[S]&nbsp;&nbsp;&nbsp;&nbsp;
or multi-thread mode[M].&nbsp; Takes values S/M .</b></td>
</tr>
<tr>
<td><b><font color="#FF6666"><font size=+1>BW_HTMLTEST</font></font></b></td>
<td><b>URL where redirect.html, test.html files are located. Used if you run tests through
TestLoader applet.</b></td>
</tr>
<tr>
<td><b><font color="#FF6666"><font size=+1>BW_XMTEST</font></font></b></td>
<td><b>URL where redirectxml.html, test.xml files are located. Used if you</b>
<br><b>run tests through TestLoader applet</b></td>
</tr>
</table></center>
<ul>&nbsp;</ul>
<ul>
<li>
<b><font size=+1>Copy <font color="#FF6666">redirect.html, test.html</font> and <font color="#FF6666">redirectxml.html, test.xml</font>
files to your web-servers DOCUMENT_ROOT ( By default it is assumed that
they can be&nbsp; accessed as <font color="#3366FF">http://[server name]/text.html</font>&nbsp;
or <font color="#3366FF">http://[servername]/~[username]/text.html</font>).</font></b></li>
</ul>
<ul>
<li>
<b><font size=+1>Invoke autorun.sh from command prompt.</font></b></li>
<ul>
<li>
<b><font size=+1>sh autorun.sh</font></b></li>
</ul>
</ul>
<ul>
<li>
<b><font size=+1>The results are recorded in HTML file <font color="#FF6666">BWTest.html</font>
and in log file <font color="#FF6666">BWTest.log</font> Individual test
Log files are also found in 'log' directory.</font></b></li>
</ul>
<p><br><b><font size=+1>To Invoke a specific test case</font></b>
<blockquote><b><font size=+1>sh autorun.sh -t org.mozilla.dom.test.AttrImpl_getName</font></b></blockquote>
<b><font size=+1><u><font color="#3366FF">NOTE:</font></u>All Test Cases
are recorded in file BWTestClass.lst.ORIG</font></b>
<p><font size=+1><u><font color="#3366FF">ASSUMPTION</font></u><b>: I assume
that u have copied the files test.xml, redirectxml.html, redirect.html, test.html to your DOCUMENT_ROOT
of your WebServer.</b></font>
<br><b><font size=+1>The URL it tries to load is http://[servername]/redirect.html.</font></b>
<br><b><font size=+1>If it is set in users public_html then open file autorun.sh
and change DOCROOT accordingly.</font></b>
<p>
</a>
<hr SIZE=4 NOSHADE WIDTH="100%">
<a name="winnt">
<br><i><u><font color="#990000"><font size=+3>Windows NT</font></font></u></i>
<ol>
<li>
<b>Assumes you have installed PERL and the following variables are set
in your environment:</b></li>
<ul>
<li>
<font color="#FF6666">MOZILLA_HOME</font> - top directory in mozilla's
tree</li>
<li>
<font color="#FF6666">JAVA_HOME</font> - path to JDK</li>
</ul>
<li>
open mozilla.bat</li>
<li>
make changes to variables</li>
<ul>
<li>
<font color="#FF6666">MOZILLA_BIN</font> - Mozilla's executable file name
(e.g. mozilla.exe or viewer.exe)</li>
<li>
<font color="#FF6666">TEST_PATH</font> - path to the current directory
(where mozilla.bat is)</li>
<li>
<font color="#FF6666">TEST_URL</font> - URL where redirect.html and test.html
are located (complte URL looks like that: $TEST_URL/redirect.html). Is used
if you run tests through hacked DOMAccessor only.</li>
</ul>
<li>
execute <b>mozilla.bat</b> from command prompt this will create new console
and set up the environment for this command prompt</li>
<li>
Edit BWProperties file and change the locations for variables</li>
<ul>
<li>
<font color="#FF6666">BW_TESTDIR</font> (Absolute Directory Path where
file BWTestClass.lst is located)</li>
<li>
<font color="#FF6666">BW_LOGDIR</font> (Absolute Directory Path where log
files need to be created)</li>
<li>
<font color="#FF6666">BW_THREADMODE</font> (Execute tests in single thread
[S] or multi-thread [M] mode. Takes values S/M.)</li>
<li>
<font color="#FF6666">BW_HTMLTEST</font> (URL where redirect.html file are
located. Used if you run tests through TestLoader applet)</li>
<li>
<font color="#FF6666">BW_XMLTEST</font> (URL where test.xml file are located.
Used if you run tests through TestLoader applet)</li>
</ul>
<br>
<b>NOTE:</b> Since on Windows file separator is a `\`, it should be escaped by
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;another '\'. So if a file is in c:\mozilla\tests then it would be written as c:\\mozilla\\tests.
<br>
<br>
<li>
There are several ways to run tests:</li>
<ul>
<li>
Invoke autorun.pl from command prompt.</li>
<br><b>perl autorun.pl</b>
<br>For each test new Mozilla is executed.
<li>
For quick testing say</li>
<br><b>mozilla.exe file:/TestLoaderHTML.html</b>
<br>(mozilla.exe file:/TestLoaderXML.html)
<br>if you use applet for registration
<li>
or say</li>
<br><b>mozilla.exe file:/redirect.html</b>
<br>if you use hacked DOMAcceessor.</ul>
<li>
The results are recorded in HTML file BWTest.html and in log file BWTest.log
Individual test Log files are also found in 'log' directory.</li>
</ol>
<!--
<ul>
<li>
<b><font size=+1>open <font color="#FF6666">mozilla.bat</font></font></b></li>
</ul>
<ul>
<li>
<b><font size=+1>make changes to variables</font></b></li>
<ul>
<li>
<b><font color="#FF6666"><font size=+1>BLACKWOOD_HOME</font></font></b></li>
<li>
<b><font color="#FF6666"><font size=+1>MOZILLA_FIVE_HOME</font></font></b></li>
<li>
<b><font color="#FF6666"><font size=+1>JAVA_HOME</font></font></b></li>
<li>
<b><font color="#FF6666"><font size=+1>TEST_PATH</font></font></b></li>
<li>
<b><font color="#FF6666"><font size=+1>TEST_URL</font></font></b></li>
</ul>
</ul>
<ul>
<li>
<b><font size=+1>execute&nbsp; mozilla.bat from command prompt.</font></b></li>
<br><b><font size=+1>&nbsp;this will set up the environment for this command
prompt.</font></b></ul>
<ul>
<li>
<b><font size=+1>Edit BWProperties file and change the locations for variables</font></b></li>
</ul>
<center><table BORDER COLS=2 WIDTH="80%" BGCOLOR="#99FFCC" NOSAVE >
<tr NOSAVE>
<td WIDTH="30%" NOSAVE><b><font color="#FF6666"><font size=+1>BW_TESTDIR</font></font></b></td>
<td><b>Absolute Directory Path where file BWTestClass.lst is located.</b></td>
</tr>
<tr NOSAVE>
<td NOSAVE><b><font color="#FF6666"><font size=+1>BW_LOGDIR</font></font></b></td>
<td><b>Absolute D.irectory&nbsp; Path where log files need to be created.</b></td>
</tr>
<tr>
<td><b><font color="#FF6666"><font size=+1>BW_THREADMODE</font></font></b></td>
<td><b>Indicates whether to execute tests in single-thread mode[S]&nbsp;&nbsp;&nbsp;&nbsp;
or multi-thread mode[M].&nbsp; Takes values S/M .</b></td>
</tr>
</table></center>
<ul>&nbsp;</ul>
<ul>
<li>
<b><font size=+1>Copy files <font color="#CC6600">redirect.html, test.html</font>and <font color="#CC6600">redirectxml.html, test.xml</font>
into some document directory of HTTP server. TEST_URL environment variable
should contain the URL of this directory.</font></b></li>
<br><b><font size=+1>&nbsp;For example, if you placed the files in the
root directory of&nbsp;&nbsp; HTTP server "<font color="#3333FF">myserver</font>",
then value of TEST_URL should be&nbsp; "<font color="#3333FF">http://myserver</font>".</font></b></ul>
<ul>
<li>
<b><font size=+1>Invoke autorun.pl from command prompt.</font></b></li>
<ul>
<li>
<b><font size=+1>perl autorun.pl</font></b></li>
</ul>
</ul>
<ul><b><font size=+1>The results are recorded in HTML file <font color="#FF6666">BWTest.html</font>
and in log file <font color="#FF6666">BWTest.log</font> Individual test
Log files are also found in 'log' directory.</font></b></ul>
-->
</a>
<hr SIZE=4 NOSHADE WIDTH="100%">
<br>&nbsp;
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More