gecko-dev/java
edburns%acm.org 118875675b M mozilla/Makefile.in
- add nspr to libs

M mozilla/nppluglet.cpp

- make sure to store instance pointer for return to browser, this enables
  shutdown to work properly

- When HasPlugletForMimeType is called multiple times, actually check
  the mime type.

M mozilla/nsISimplePlugin.idl

- Fix this so it's callable from JavaScript

M src/PlugletsDir.cpp

- Fix bug for multiple plugin instances

Index: mozilla/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/java/plugins/mozilla/Makefile.in,v
retrieving revision 1.1
diff -u -r1.1 Makefile.in
--- mozilla/Makefile.in	7 Oct 2006 23:31:52 -0000	1.1
+++ mozilla/Makefile.in	14 Oct 2006 12:26:06 -0000
@@ -59,7 +59,7 @@

 XPIDLSRCS = nsISimplePlugin.idl

-SHARED_LIBRARY_LIBS = $(PLUGIN_SDK)/samples/common/$(LIB_PREFIX)plugingate_s.$(LIB_SUFFIX) ../src/$(LIB_PREFIX)pluglet_s.$(LIB_SUFFIX)
+SHARED_LIBRARY_LIBS = $(PLUGIN_SDK)/samples/common/$(LIB_PREFIX)plugingate_s.$(LIB_SUFFIX) ../src/$(LIB_PREFIX)pluglet.$(LIB_SUFFIX) $(XPCOM_LIBS) $(NSPR_LIBS)

 ifeq ($(OS_ARCH),WINNT)
 DEFFILE = $(win_srcdir)/nppluglet.def
Index: mozilla/nppluglet.cpp
===================================================================
RCS file: /cvsroot/mozilla/java/plugins/mozilla/nppluglet.cpp,v
retrieving revision 1.3
diff -u -r1.3 nppluglet.cpp
--- mozilla/nppluglet.cpp	13 Oct 2006 14:45:14 -0000	1.3
+++ mozilla/nppluglet.cpp	14 Oct 2006 12:26:07 -0000
@@ -47,6 +47,8 @@

 #include "nsServiceManagerUtils.h"

+#include "plstr.h"
+
 // service manager which will give the access to all public browser services
 // we will use memory service as an illustration
 nsIServiceManager * gServiceManager = NULL;
@@ -153,17 +155,21 @@
 // nsPluginInstance class implementation
 //
 nsPluginInstance::nsPluginInstance(nsPluginCreateData * aCreateDataStruct) : nsPluginInstanceBase(),
-  mInstance(aCreateDataStruct->instance),
   mInitialized(PR_FALSE),
   mScriptablePeer(nsnull),
   mPluglet(nsnull)
 {
+  mInstance = aCreateDataStruct->instance;
+
   mCreateDataStruct.instance = aCreateDataStruct->instance;
   mCreateDataStruct.type = aCreateDataStruct->type;
   mCreateDataStruct.mode = aCreateDataStruct->mode;
   mCreateDataStruct.argc = aCreateDataStruct->argc;
   mCreateDataStruct.argn = aCreateDataStruct->argn;
   mCreateDataStruct.saved = aCreateDataStruct->saved;
+
+  mCreateDataStruct.instance->pdata = this;
+  mInstance->pdata = this;
   mString[0] = '\0';
 }

@@ -256,19 +262,27 @@
                                                       PRBool *outResult)
 {
     nsresult rv = NS_ERROR_FAILURE;
-
-    nsCOMPtr<nsIPlugin> plugletEngine =
-	do_GetService(PLUGLETENGINE_ContractID, &rv);
     *outResult = PR_FALSE;
+    nsCOMPtr<nsIPlugin> plugletEngine = nsnull;
     nsIID scriptableIID = NS_ISIMPLEPLUGIN_IID;
+
+    if (!mPluglet) {
+        plugletEngine = do_GetService(PLUGLETENGINE_ContractID, &rv);

-    if (NS_SUCCEEDED(rv)) {
-        rv = plugletEngine->CreatePluginInstance(nsnull, scriptableIID,
-                                                 aMimeType,
-                                                 getter_AddRefs(mPluglet));
-        if (NS_SUCCEEDED(rv) && mPluglet) {
+        if (NS_SUCCEEDED(rv)) {
+            rv = plugletEngine->CreatePluginInstance(nsnull, scriptableIID,
+                                                     aMimeType,
+                                                     getter_AddRefs(mPluglet));
+            if (NS_SUCCEEDED(rv) && mPluglet) {
+                *outResult = PR_TRUE;
+            }
+        }
+    }
+    else {
+        if (0 == PL_strcmp(aMimeType, mCreateDataStruct.type)) {
             *outResult = PR_TRUE;
         }
+		rv = NS_OK;
     }

     return rv;
Index: mozilla/nsISimplePlugin.idl
===================================================================
RCS file: /cvsroot/mozilla/java/plugins/mozilla/nsISimplePlugin.idl,v
retrieving revision 1.2
diff -u -r1.2 nsISimplePlugin.idl
--- mozilla/nsISimplePlugin.idl	12 Oct 2006 21:22:47 -0000	1.2
+++ mozilla/nsISimplePlugin.idl	14 Oct 2006 12:26:07 -0000
@@ -40,5 +40,5 @@

 [scriptable, uuid(482e1890-1fe5-11d5-9cf8-0060b0fbd8ac)]
 interface nsISimplePlugin : nsISupports {
-  void hasPlugletForMimeType(in string aMimeType, out boolean isSupported);
+  boolean hasPlugletForMimeType(in string aMimeType);
 };
Index: src/PlugletsDir.cpp
===================================================================
RCS file: /cvsroot/mozilla/java/plugins/src/PlugletsDir.cpp,v
retrieving revision 1.10
diff -u -r1.10 PlugletsDir.cpp
--- src/PlugletsDir.cpp	12 Oct 2006 21:22:47 -0000	1.10
+++ src/PlugletsDir.cpp	14 Oct 2006 12:26:07 -0000
@@ -124,6 +124,9 @@
     if(!mMimeTypeToPlugletFacoryHash) {
 	res = LoadPluglets();
     }
+    else {
+	res = NS_OK;
+    }
     if (NS_SUCCEEDED(res) && mMimeTypeToPlugletFacoryHash) {
 	*plugletFactory = (PlugletFactory *)
 	    PL_HashTableLookup(mMimeTypeToPlugletFacoryHash,
2006-10-14 12:28:15 +00:00
..
build Bug 106386 Correct misspellings in source code 2005-11-25 08:16:51 +00:00
config
dist up_version_to_a5 2005-08-21 01:23:11 +00:00
dom This checkin gets webclient and sorta running with Firefox 1.5.0.1 2006-03-05 03:53:26 +00:00
external
pluggable-jvm Bug 106386 Correct misspellings in source code 2006-08-28 20:12:37 +00:00
plugins M mozilla/Makefile.in 2006-10-14 12:28:15 +00:00
util This checkin gets webclient and sorta running with Firefox 1.5.0.1 2006-03-05 03:53:26 +00:00
webclient make_this_test_run 2006-03-17 00:26:02 +00:00
xpcom Bug 106386 Correct misspellings in source code 2006-08-28 20:12:37 +00:00
.cvsignore update 2004-10-27 01:38:49 +00:00
build.properties.sample This checkin gets webclient and sorta running with Firefox 1.5.0.1 2006-03-05 03:53:26 +00:00
build.xml This change-bundle adds build.xml rules that produce a binary 2004-09-29 19:53:55 +00:00
changelo
makefiles Make plugletjni.lib and .dll build. 2006-03-24 17:57:24 +00:00
README This checkin takes us a little closer to the unit tests running. I'm 2004-02-25 05:44:08 +00:00
README.commercial

20040222

This README documents the Java Enhancers to the Mozilla web browser.

Currently, the only active sub-project is the Webclient Java API to the
Mozilla web browser.  This project also leverages the JavaDOM
sub-project.

Requirements:

* J2SDK 1.3.1 or later

* Apache ant 1.4.1 or later.  If running under J2SDK 1.4.2 or later, you
  need ant 1.6.1, due to javah issues.

* Successfully built debug enabled Mozilla 1.6 tree

How To Build:

* cd to the directory above your top level mozilla directory and cvs
  checkout the Webclient module.

* Modify mozilla/allmakefiles.sh and prepend the contents of the file
  "makefiles", in this directory, to add_makefiles section after the
  "Common makfiles used by everyone" comment.

* re-run ./configure to generate the java makefiles

* put the "mozilla/dist/bin" directory in your LD_LIBRARY_PATH on Unix,
  or PATH on Win32.

* set the value of the environment var MOZ_JDKHOME to be your J2SDK
  directory.

* Create a build.properties file in the mozilla/java directory with the
  following contents.

######
build.unix.classes=true
build.win32.classes=false
build.home=/home/edburns/Projects/mozilla/MOZILLA_1_4/mozilla/dist/classes
compile.debug=true
######

  Of course, set the values of the above properties correctly according
  to your system.

* run "ant" in the mozilla/java directory.  This will build webclient
  and all dependent libraries.  

How to run the Junit tests:

* Make sure junit.jar is properly set in your mozilla/java/build.properties

* Make sure junit.jar is installed in your $ANT_HOME/lib directory

* Set the following variables in your environment

NSPR_LOG_MODULES=webclient:4,webclientstub:4
NSPR_LOG_FILE=logfile.txt

* cd to mozilla/java/webclient

* Kill any running mozilla instances.  These will mess up the
  profilemanager code.

* run ant test

How to run the test browser (broken as of this writing):

* cd to mozilla/java/webclient/src_moz and run the "runem" batch file to
  run the test browser.

Problems?

* post to netscape.public.mozilla.java newsgroup