Landing changes in the OJI_19980727_BRANCH since the OJI_19980727_TIP_MERGE tag.

This commit is contained in:
warren%netscape.com 1998-07-31 20:19:50 +00:00
Родитель 2df7d1c7be
Коммит c9bd5d8074
181 изменённых файлов: 9608 добавлений и 4413 удалений

Просмотреть файл

@ -25,7 +25,7 @@ ifndef NO_MOCHA
DIRS_JS = js
endif
DIRS = config coreconf $(NSPRDIR) jpeg dbm xpcom network
DIRS = config coreconf $(NSPRDIR) jpeg dbm xpcom base network caps
ifdef MOZ_NETCAST
DIRS += netcast
@ -53,7 +53,7 @@ endif
include $(DEPTH)/config/rules.mk
export:: $(OBJS)
export:: envirocheck $(OBJS)
# Running this rule assembles all the SDK source pieces into dist/sdk.
# You'll need to run this rule on every platform to get all the

Просмотреть файл

@ -23,14 +23,18 @@ PROG1 = .\$(OBJDIR)\TestAtoms.exe
PROG2 = .\$(OBJDIR)\CvtURL.exe
PROG3 = .\$(OBJDIR)\TestCRT.exe
RESFILE = timer.res
PROGRAMS = $(PROG0) $(PROG1) $(PROG2) $(PROG3)
PROGRAMS = $(PROG0) $(PROG1) \
!ifdef MODULAR_NETLIB
$(PROG2) $(PROG3) \
!endif
$(NULL)
LINCS=-I..\src -I$(PUBLIC)\xpcom -I$(PUBLIC)\netlib
LLIBS= \
$(DIST)\lib\xpcom32.lib \
$(DIST)\lib\raptorbase.lib \
$(DIST)\lib\netlib.lib \
$(DIST)\lib\network.lib \
$(LIBNSPR) \
$(DIST)\lib\libplc21.lib \
$(RESFILE)
@ -40,14 +44,18 @@ include <$(DEPTH)\config\rules.mak>
install:: $(PROGRAMS)
$(MAKE_INSTALL) $(PROG0) $(DIST)\bin
$(MAKE_INSTALL) $(PROG1) $(DIST)\bin
!ifdef MODULAR_NETLIB
$(MAKE_INSTALL) $(PROG2) $(DIST)\bin
$(MAKE_INSTALL) $(PROG3) $(DIST)\bin
!endif
clobber::
rm -f $(DIST)\bin\TimerTest.exe
rm -f $(DIST)\bin\TestAtoms.exe
!ifdef MODULAR_NETLIB
rm -f $(DIST)\bin\CvtURL.exe
rm -f $(DIST)\bin\TestCRT.exe
!endif
# Move this into config/obj.inc when it's allowed
.cpp{.\$(OBJDIR)\}.exe:
@ -72,4 +80,3 @@ $(PROG1): $(OBJDIR) TestAtoms.cpp
$(PROG2): $(OBJDIR) CvtURL.cpp
$(PROG2): $(OBJDIR) TestCRT.cpp

Просмотреть файл

@ -1 +1 @@
5009808600
5009821211

Просмотреть файл

@ -102,6 +102,9 @@ sub BuildMozilla()
BuildProject(":mozilla:js:macbuild:JavaScriptPPC.mcp", "JavaScript$D.shlb");
MakeAlias(":mozilla:js:macbuild:JavaScript$D.shlb", "$dist_dir");
BuildProject(":mozilla:js:macbuild:LiveConnect.mcp", "LiveConnect$D.shlb");
MakeAlias(":mozilla:js:macbuild:LiveConnect$D.shlb", "$dist_dir");
BuildProject(":mozilla:nav-java:stubs:macbuild:NavJavaStubs.mcp", "NavJava$D.shlb");
MakeAlias(":mozilla:nav-java:stubs:macbuild:NavJava$D.shlb", "$dist_dir");
@ -119,6 +122,7 @@ sub BuildMozilla()
BuildProject(":mozilla:modules:security:freenav:macbuild:NoSecurity.mcp", "Security.o");
BuildProject(":mozilla:modules:libfont:macbuild:FontBroker.mcp", "FontBroker$D.o");
BuildProject(":mozilla:modules:oji:macbuild:oji.mcp", "oji$D.o");
BuildProject(":mozilla:lib:libmocha:macbuild:LibMocha.mcp", "LibMocha$D.o");
if ( $main::MOZ_DARK == 1 )
@ -129,6 +133,7 @@ sub BuildMozilla()
{
BuildProject(":mozilla:network:macbuild:network.mcp", "Network$D.o");
}
BuildProject(":mozilla:caps:macbuild:Caps.mcp", "Caps$D.o");
BuildProject(":mozilla:modules:libimg:macbuild:png.mcp", "png$D.o");
BuildProject(":mozilla:modules:libimg:macbuild:libimg.mcp", "libimg$D.o");
@ -227,6 +232,9 @@ sub DistMozilla()
#JS
InstallFromManifest(":mozilla:js:src:MANIFEST", ":mozilla:dist:js:");
#LIVECONNECT
InstallFromManifest(":mozilla:js:src:liveconnect:MANIFEST", ":mozilla:dist:liveconnect:");
#RDF
InstallFromManifest(":mozilla:modules:rdf:include:MANIFEST", ":mozilla:dist:rdf:");
@ -291,7 +299,8 @@ sub DistMozilla()
InstallFromManifest(":mozilla:lib:libstyle:MANIFEST", ":mozilla:dist:libstyle:");
#PLUGIN
InstallFromManifest(":mozilla:lib:plugin:MANIFEST", ":mozilla:dist:plugin:");
InstallFromManifest(":mozilla:modules:plugin:public:MANIFEST", ":mozilla:dist:plugin:");
InstallFromManifest(":mozilla:modules:plugin:src:MANIFEST", ":mozilla:dist:plugin:");
#LIBHOOK
InstallFromManifest(":mozilla:modules:libhook:public:MANIFEST", ":mozilla:dist:libhook:");
@ -318,8 +327,18 @@ sub DistMozilla()
#SUN_JAVA
InstallFromManifest(":mozilla:sun-java:stubs:include:MANIFEST", ":mozilla:dist:sun-java:");
InstallFromManifest(":mozilla:sun-java:stubs:macjri:MANIFEST", ":mozilla:dist:sun-java:");
#OJI
InstallFromManifest(":mozilla:modules:oji:public:MANIFEST", ":mozilla:dist:oji:");
InstallFromManifest(":mozilla:modules:oji:src:MANIFEST", ":mozilla:dist:oji:");
#CAPS
InstallFromManifest(":mozilla:caps:include:MANIFEST", ":mozilla:dist:caps:");
#BASE
InstallFromManifest(":mozilla:base:public:MANIFEST", ":mozilla:dist:base:");
InstallFromManifest(":mozilla:base:src:MANIFEST", ":mozilla:dist:base:");
}
1;

Просмотреть файл

@ -11,3 +11,5 @@ nsUserDialogHelper.h
nsZip.h
nsLoadZig.h
admin.h
nsCaps.h
nsCapsEnums.h

Просмотреть файл

@ -18,7 +18,7 @@ MODULE = caps
DEPTH = ../..
EXPORTS = nsZip.h nsZig.h nsLoadZig.h nsPrincipal.h nsPrivilege.h nsPrivilegeManager.h nsPrivilegeTable.h nsSystemPrivilegeTable.h nsTarget.h nsUserTarget.h jpermission.h nsUserDialogHelper.h admin.h
EXPORTS = nsZip.h nsZig.h nsLoadZig.h nsPrincipal.h nsPrivilege.h nsPrivilegeManager.h nsPrivilegeTable.h nsSystemPrivilegeTable.h nsTarget.h nsUserTarget.h jpermission.h nsUserDialogHelper.h admin.h nsCaps.h nsCapsEnums.h
include $(DEPTH)/config/rules.mk

Просмотреть файл

@ -28,7 +28,7 @@ IGNORE_MANIFEST=1
MODULE=caps
DEPTH=..\..
EXPORTS=nsZip.h nsZig.h nsLoadZig.h nsPrincipal.h nsPrivilege.h nsPrivilegeManager.h nsPrivilegeTable.h nsSystemPrivilegeTable.h nsTarget.h nsUserTarget.h jpermission.h nsUserDialogHelper.h admin.h
EXPORTS=nsZip.h nsZig.h nsLoadZig.h nsPrincipal.h nsPrivilege.h nsPrivilegeManager.h nsPrivilegeTable.h nsSystemPrivilegeTable.h nsTarget.h nsUserTarget.h jpermission.h nsUserDialogHelper.h admin.h nsCaps.h nsCapsEnums.h
include <$(DEPTH)/config/rules.mak>

Просмотреть файл

@ -22,23 +22,13 @@
#include "prtypes.h"
#include "nsHashtable.h"
#include "nsVector.h"
#include "nsZig.h"
#include "nsCom.h"
/* The following should match what is in nsJVM plugin's java security code */
typedef enum nsPrincipalType {
nsPrincipalType_Unknown=-1,
nsPrincipalType_CodebaseExact=10,
nsPrincipalType_CodebaseRegexp,
nsPrincipalType_Cert,
nsPrincipalType_CertFingerPrint,
nsPrincipalType_CertKey
} nsPrincipalType;
#include "nsCaps.h"
#include "nsCapsEnums.h"
typedef nsVector nsPrincipalArray;
class nsPrincipal {
struct nsPrincipal {
public:
@ -48,7 +38,7 @@ public:
nsPrincipal(nsPrincipalType type, void * key, PRUint32 key_len);
nsPrincipal(nsPrincipalType type, void * key, PRUint32 key_len, char *stringRep);
virtual ~nsPrincipal();
nsPrincipal(nsPrincipalType type, void * key, PRUint32 key_len, nsZig *zigObject);
nsPrincipal(nsPrincipalType type, void * key, PRUint32 key_len, void *zigObject);
PRBool equals(nsPrincipal *principal);
@ -97,7 +87,7 @@ private:
/* Private Field Accessors */
nsPrincipalType itsType;
nsZig * itsZig;
void * itsZig;
char * itsKey;

Просмотреть файл

@ -20,33 +20,12 @@
#define _NS_PRIVILEGE_H_
#include "prtypes.h"
#include "nsCom.h"
/**
* number of possible permissions (allowed, forbidden, or blank)
*/
typedef enum nsPermissionState {
nsPermissionState_Forbidden = 0,
nsPermissionState_Allowed,
nsPermissionState_Blank,
nsPermissionState_NumberOfPermissions
} nsPermissionState;
/**
* number of possible durations (scope, session, or forever)
*/
typedef enum nsDurationState {
nsDurationState_Scope=0,
nsDurationState_Session,
nsDurationState_Forever,
nsDurationState_NumberOfDurations
} nsDurationState;
#include "nsCaps.h"
#include "nsCapsEnums.h"
PRBool nsPrivilegeInitialize(void);
class nsPrivilege {
struct nsPrivilege {
public:
/* Public Field Accessors */

Просмотреть файл

@ -25,18 +25,13 @@
#include "nsHashtable.h"
#include "nsVector.h"
#include "nsCaps.h"
#include "nsTarget.h"
#include "nsPrincipal.h"
#include "nsPrivilege.h"
#include "nsPrivilegeTable.h"
#include "nsSystemPrivilegeTable.h"
#include "nsCom.h"
typedef enum nsSetComparisonType {
nsSetComparisonType_ProperSubset=-1,
nsSetComparisonType_Equal=0,
nsSetComparisonType_NoSubset=1
} nsSetComparisonType;
#include "nsCapsEnums.h"
extern PRBool nsCaps_lock(void);
extern void nsCaps_unlock(void);
@ -45,39 +40,9 @@ PR_BEGIN_EXTERN_C
PRBool CMGetBoolPref(char * pref_name);
PR_END_EXTERN_C
struct NSJSJavaFrameWrapper;
void
setNewNSJSJavaFrameWrapperCallback(struct NSJSJavaFrameWrapper * (*fp)(void));
void
setFreeNSJSJavaFrameWrapperCallback(void (*fp)(struct NSJSJavaFrameWrapper *));
void
setGetStartFrameCallback(void (*fp)(struct NSJSJavaFrameWrapper *));
void
setIsEndOfFrameCallback(PRBool (*fp)(struct NSJSJavaFrameWrapper *));
void
setIsValidFrameCallback(PRBool (*fp)(struct NSJSJavaFrameWrapper *));
void
setGetNextFrameCallback(void * (*fp)(struct NSJSJavaFrameWrapper *, int *));
void
setOJIGetPrincipalArrayCallback(void * (*fp)(struct NSJSJavaFrameWrapper *));
void
setOJIGetAnnotationCallback(void * (*fp)(struct NSJSJavaFrameWrapper *));
void
setOJISetAnnotationCallback(void * (*fp)(struct NSJSJavaFrameWrapper *, void *));
PRBool nsPrivilegeManagerInitialize(void);
class nsPrivilegeManager {
struct nsPrivilegeManager {
public:
/* Public Methods */

Просмотреть файл

@ -21,12 +21,11 @@
#include "prtypes.h"
#include "nsHashtable.h"
#include "nsCaps.h"
#include "nsTarget.h"
#include "nsPrivilege.h"
#include "nsCom.h"
class nsPrivilegeTable {
struct nsPrivilegeTable {
public:

Просмотреть файл

@ -23,11 +23,11 @@
#include "prtypes.h"
#include "plhash.h"
#include "nsPrincipal.h"
#include "nsPrivilege.h"
#include "nsHashtable.h"
#include "nsVector.h"
#include "nsCom.h"
#include "nsCaps.h"
#include "nsPrincipal.h"
#include "nsPrivilege.h"
#include "nsUserDialogHelper.h"
typedef nsVector nsTargetArray;
@ -43,7 +43,7 @@ extern int CAPS_TARGET_RISK_COLOR_HIGH;
extern PRBool CreateSystemTargets(nsPrincipal *sysPrin);
class nsTarget {
struct nsTarget {
public:

Двоичные данные
caps/macbuild/Caps.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -36,6 +36,7 @@ CSRCS = \
jpermission.c \
nsUserTarget.c \
admin.c \
nsCaps.c \
$(NULL)
include $(DEPTH)/config/rules.mk

Просмотреть файл

@ -41,7 +41,6 @@ extern "C" {
PR_PUBLIC_API(const char *)
java_netscape_security_getPrincipals(const char *charSetName)
{
#ifdef DEBUG_raman
nsPrivilegeManager *nsPrivManager = nsPrivilegeManager::getPrivilegeManager();
const char *prins = nsPrivManager->getAllPrincipalsString();
PRBool test_admin_api = PR_FALSE;
@ -54,20 +53,13 @@ java_netscape_security_getPrincipals(const char *charSetName)
java_netscape_security_removePrincipal(NULL, "raman tenneti");
}
return prins;
#else
return NULL;
#endif /* DEBUG_raman */
}
PR_PUBLIC_API(PRBool)
java_netscape_security_removePrincipal(const char *charSetName, char *prinName)
{
#ifdef DEBUG_raman
nsPrivilegeManager *nsPrivManager = nsPrivilegeManager::getPrivilegeManager();
return nsPrivManager->removePrincipal(prinName);
#else
return PR_FALSE;
#endif /* DEBUG_raman */
}
PR_PUBLIC_API(void)
@ -75,22 +67,16 @@ java_netscape_security_getPrivilegeDescs(const char *charSetName, char *prinName
char** forever, char** session,
char **denied)
{
#ifdef DEBUG_raman
nsPrivilegeManager *nsPrivManager = nsPrivilegeManager::getPrivilegeManager();
nsPrivManager->getTargetsWithPrivileges(prinName, forever, session, denied);
#endif /* DEBUG_raman */
}
PR_PUBLIC_API(PRBool)
java_netscape_security_removePrivilege(const char *charSetName, char *prinName,
char *targetName)
{
#ifdef DEBUG_raman
nsPrivilegeManager *nsPrivManager = nsPrivilegeManager::getPrivilegeManager();
return nsPrivManager->removePrincipalsPrivilege(prinName, targetName);
#else
return PR_FALSE;
#endif /* DEBUG_raman */
}

Просмотреть файл

@ -63,6 +63,7 @@ OBJS= \
.\$(OBJDIR)\jpermission.obj \
.\$(OBJDIR)\nsUserTarget.obj \
.\$(OBJDIR)\admin.obj \
.\$(OBJDIR)\nsCaps.obj \
$(NULL)

Просмотреть файл

@ -144,7 +144,7 @@ nsPrincipal::nsPrincipal(nsPrincipalType type, void * key, PRUint32 key_len)
init(type, key, key_len);
}
nsPrincipal::nsPrincipal(nsPrincipalType type, void * key, PRUint32 key_len, nsZig *zigObject)
nsPrincipal::nsPrincipal(nsPrincipalType type, void * key, PRUint32 key_len, void *zigObject)
{
init(type, key, key_len);
itsZig = zigObject;
@ -158,9 +158,9 @@ nsPrincipal::nsPrincipal(nsPrincipalType type, void * key, PRUint32 key_len, cha
nsPrincipal::~nsPrincipal(void)
{
#ifdef DEBUG_RAMAN
#ifdef DEBUG_raman
fprintf(stderr, "Deleting principal %s\n", itsKey);
#endif /* DEBUG_RAMAN */
#endif /* DEBUG_raman */
if (itsKey) {
delete []itsKey;
}
@ -215,6 +215,29 @@ char * nsPrincipal::getVendor(void)
}
}
// XXX copyied from ns/lib/libjar/zig.h
#ifndef ZIG_C_COMPANY
#define ZIG_C_COMPANY 1
#endif
#ifndef ZIG_C_CA
#define ZIG_C_CA 2
#endif
#ifndef ZIG_C_SERIAL
#define ZIG_C_SERIAL 3
#endif
#ifndef ZIG_C_EXPIRES
#define ZIG_C_EXPIRES 4
#endif
#ifndef ZIG_C_NICKNAME
#define ZIG_C_NICKNAME 5
#endif
#ifndef ZIG_C_FP
#define ZIG_C_FP 6
#endif
#ifndef ZIG_C_JAVA
#define ZIG_C_JAVA 100
#endif
char * nsPrincipal::getCompanyName(void)
{
if (itsCompanyName == NULL)
@ -434,9 +457,9 @@ void nsPrincipal::init(nsPrincipalType type, void * key, PRUint32 key_len)
itsKey = new char[key_len+1];
memcpy(itsKey, key, key_len);
itsKey[key_len] = '\0';
#ifdef DEBUG_RAMAN
#ifdef DEBUG_raman
fprintf(stderr, "Creating principal %d, %s\n", type, itsKey);
#endif /* DEBUG_RAMAN */
#endif /* DEBUG_raman */
itsKeyLen = key_len;
itsHashCode = computeHashCode();
itsZig = NULL;
@ -484,7 +507,7 @@ char * nsPrincipal::saveCert(void)
return NULL;
}
result = SOB_stash_cert((ZIG *)itsZig->GetZig(), itsKeyLen, itsKey);
result = SOB_stash_cert((ZIG *)itsZig, itsKeyLen, itsKey);
if (result < 0) {
return SOB_get_error(result);
}
@ -501,7 +524,7 @@ nsPrincipal::getCertAttribute(int attrib)
ZIG *zig = NULL;
if (itsZig != NULL) {
zig = (ZIG *)itsZig->GetZig();
zig = (ZIG *)itsZig;
}
if (SOB_cert_attribute(attrib, zig,

Просмотреть файл

@ -26,12 +26,7 @@
#include "jpermission.h"
#include "rdf.h"
#ifdef DEBUG_raman
/* ifdef'ed out ADMIN UI until we merge changes with rdf branch.
* All these changes are under DEBUG_raman
*/
#include "jsec2rdf.h"
#endif /* DEBUG_raman */
static nsPrivilegeManager * thePrivilegeManager = NULL;
@ -58,10 +53,7 @@ nsPrivilegeTable *gPrivilegeTable;
static PRBool getPrincipalString(nsHashKey *aKey, void *aData);
#ifdef DEBUG_raman
static nsPrincipal *RDF_getPrincipal(JSec_Principal jsec_pr);
#endif /* DEBUG_raman */
static PRBool RDF_RemovePrincipal(nsPrincipal *prin);
static PRBool RDF_RemovePrincipalsPrivilege(nsPrincipal *prin, nsTarget *target);
@ -661,6 +653,8 @@ nsPrivilegeManager::intersectPrincipalArray(nsPrincipalArray* p1,
PRBool nsPrivilegeManager::canExtendTrust(nsPrincipalArray* from,
nsPrincipalArray* to)
{
if ((from == NULL) || (to == NULL))
return PR_FALSE;
nsPrincipalArray * intersect = intersectPrincipalArray(from, to);
if (intersect->GetSize() == from->GetSize())
return PR_TRUE;
@ -981,87 +975,6 @@ nsPrivilegeManager::isPermissionGranted(nsTarget *target,
}
}
/* The following method should call native code */
static struct NSJSJavaFrameWrapper * (*NewNSJSJavaFrameWrapperCallback)(void);
void
setNewNSJSJavaFrameWrapperCallback(struct NSJSJavaFrameWrapper * (*fp)(void))
{
NewNSJSJavaFrameWrapperCallback = fp;
}
static void (*FreeNSJSJavaFrameWrapperCallback)(struct NSJSJavaFrameWrapper *);
void
setFreeNSJSJavaFrameWrapperCallback(void (*fp)(struct NSJSJavaFrameWrapper *))
{
FreeNSJSJavaFrameWrapperCallback = fp;
}
static void (*GetStartFrameCallback)(struct NSJSJavaFrameWrapper *);
void
setGetStartFrameCallback(void (*fp)(struct NSJSJavaFrameWrapper *))
{
GetStartFrameCallback = fp;
}
static PRBool (*IsEndOfFrameCallback)(struct NSJSJavaFrameWrapper *);
void
setIsEndOfFrameCallback(PRBool (*fp)(struct NSJSJavaFrameWrapper *))
{
IsEndOfFrameCallback = fp;
}
static PRBool (*IsValidFrameCallback)(struct NSJSJavaFrameWrapper *);
void
setIsValidFrameCallback(PRBool (*fp)(struct NSJSJavaFrameWrapper *))
{
IsValidFrameCallback = fp;
}
static void * (*GetNextFrameCallback)(struct NSJSJavaFrameWrapper *, int *);
void
setGetNextFrameCallback(void * (*fp)(struct NSJSJavaFrameWrapper *, int *))
{
GetNextFrameCallback = fp;
}
static void * (*GetPrincipalArrayCallback)(struct NSJSJavaFrameWrapper *);
void
setOJIGetPrincipalArrayCallback(void * (*fp)(struct NSJSJavaFrameWrapper *))
{
GetPrincipalArrayCallback = fp;
}
static void * (*GetAnnotationCallback)(struct NSJSJavaFrameWrapper *);
void
setOJIGetAnnotationCallback(void * (*fp)(struct NSJSJavaFrameWrapper *))
{
GetAnnotationCallback = fp;
}
static void * (*SetAnnotationCallback)(struct NSJSJavaFrameWrapper *, void *);
void
setOJISetAnnotationCallback(void * (*fp)(struct NSJSJavaFrameWrapper *, void *))
{
SetAnnotationCallback = fp;
}
char *
nsPrivilegeManager::checkPrivilegeEnabled(nsTargetArray * targetArray,
@ -1087,18 +1000,21 @@ nsPrivilegeManager::checkPrivilegeEnabled(nsTargetArray * targetArray,
return "internal error - null target array";
}
wrapper = (*NewNSJSJavaFrameWrapperCallback)();
if (*nsCapsNewNSJSJavaFrameWrapperCallback == NULL) {
return NULL;
}
wrapper = (*nsCapsNewNSJSJavaFrameWrapperCallback)();
if (wrapper == NULL) {
return NULL;
}
noOfTargets = targetArray->GetSize();
for ((*GetStartFrameCallback)(wrapper);
(!(*IsEndOfFrameCallback)(wrapper));
for ((*nsCapsGetStartFrameCallback)(wrapper);
(!(*nsCapsIsEndOfFrameCallback)(wrapper));
)
{
if ((*IsValidFrameCallback)(wrapper)) {
if ((*nsCapsIsValidFrameCallback)(wrapper)) {
if (depth >= callerDepth) {
scopePerm = nsPermissionState_Blank;
prinPerm = nsPermissionState_Blank;
@ -1109,8 +1025,8 @@ nsPrivilegeManager::checkPrivilegeEnabled(nsTargetArray * targetArray,
goto done;
}
annotation = (nsPrivilegeTable *) (*GetAnnotationCallback)(wrapper);
prinArray = (nsPrincipalArray *) (*GetPrincipalArrayCallback)(wrapper);
annotation = (nsPrivilegeTable *) (*nsCapsGetAnnotationCallback)(wrapper);
prinArray = (nsPrincipalArray *) (*nsCapsGetPrincipalArrayCallback)(wrapper);
/*
* frame->annotation holds a PrivilegeTable, describing
* the scope privileges of this frame. We'll check
@ -1168,7 +1084,7 @@ nsPrivilegeManager::checkPrivilegeEnabled(nsTargetArray * targetArray,
}
}
}
if (!(*GetNextFrameCallback)(wrapper, &depth))
if (!(*nsCapsGetNextFrameCallback)(wrapper, &depth))
break;
}
/*
@ -1186,7 +1102,7 @@ nsPrivilegeManager::checkPrivilegeEnabled(nsTargetArray * targetArray,
errMsg = "access to target forbidden. Target was not enabled on stack (stack included only system code)";
done:
(*FreeNSJSJavaFrameWrapperCallback)(wrapper);
(*nsCapsFreeNSJSJavaFrameWrapperCallback)(wrapper);
return errMsg;
}
@ -1198,23 +1114,26 @@ nsPrivilegeManager::getClassPrincipalsFromStack(PRInt32 callerDepth)
int depth = 0;
struct NSJSJavaFrameWrapper *wrapper = NULL;
wrapper = (*NewNSJSJavaFrameWrapperCallback)();
if (*nsCapsNewNSJSJavaFrameWrapperCallback == NULL) {
return NULL;
}
wrapper = (*nsCapsNewNSJSJavaFrameWrapperCallback)();
if (wrapper == NULL)
return NULL;
for ((*GetStartFrameCallback)(wrapper) ;
(!(*IsEndOfFrameCallback)(wrapper)) ;
for ((*nsCapsGetStartFrameCallback)(wrapper) ;
(!(*nsCapsIsEndOfFrameCallback)(wrapper)) ;
) {
if ((*IsValidFrameCallback)(wrapper)) {
if ((*nsCapsIsValidFrameCallback)(wrapper)) {
if (depth >= callerDepth) {
principalArray = (nsPrincipalArray *) (*GetPrincipalArrayCallback)(wrapper);
principalArray = (nsPrincipalArray *) (*nsCapsGetPrincipalArrayCallback)(wrapper);
break;
}
}
if (!(*GetNextFrameCallback)(wrapper, &depth))
if (!(*nsCapsGetNextFrameCallback)(wrapper, &depth))
break;
}
(*FreeNSJSJavaFrameWrapperCallback)(wrapper);
(*nsCapsFreeNSJSJavaFrameWrapperCallback)(wrapper);
return principalArray;
}
@ -1228,14 +1147,17 @@ nsPrivilegeManager::getPrivilegeTableFromStack(PRInt32 callerDepth,
struct NSJSJavaFrameWrapper *wrapper = NULL;
nsPrivilegeTable *annotation;
wrapper = (*NewNSJSJavaFrameWrapperCallback)();
if (*nsCapsNewNSJSJavaFrameWrapperCallback == NULL) {
return NULL;
}
wrapper = (*nsCapsNewNSJSJavaFrameWrapperCallback)();
if (wrapper == NULL)
return NULL;
for ((*GetStartFrameCallback)(wrapper) ;
(!(*IsEndOfFrameCallback)(wrapper)) ;
for ((*nsCapsGetStartFrameCallback)(wrapper) ;
(!(*nsCapsIsEndOfFrameCallback)(wrapper)) ;
) {
if ((*IsValidFrameCallback)(wrapper)) {
if ((*nsCapsIsValidFrameCallback)(wrapper)) {
if (depth >= callerDepth) {
/*
* it's possible for the annotation to be NULL, meaning
@ -1244,7 +1166,7 @@ nsPrivilegeManager::getPrivilegeTableFromStack(PRInt32 callerDepth,
* default "blank forever" privileges), assign that
* to the annotation, and return it.
*/
annotation = (nsPrivilegeTable *) (*GetAnnotationCallback)(wrapper);
annotation = (nsPrivilegeTable *) (*nsCapsGetAnnotationCallback)(wrapper);
if (createIfNull && annotation == NULL) {
privTable = new nsPrivilegeTable();
if (privTable == NULL) {
@ -1255,22 +1177,21 @@ nsPrivilegeManager::getPrivilegeTableFromStack(PRInt32 callerDepth,
break;
}
PR_ASSERT(privTable != NULL);
(*SetAnnotationCallback)(wrapper, privTable);
(*nsCapsSetAnnotationCallback)(wrapper, privTable);
} else {
privTable = annotation;
}
break;
}
}
if (!(*GetNextFrameCallback)(wrapper, &depth))
if (!(*nsCapsGetNextFrameCallback)(wrapper, &depth))
break;
}
(*FreeNSJSJavaFrameWrapperCallback)(wrapper);
(*nsCapsFreeNSJSJavaFrameWrapperCallback)(wrapper);
return privTable;
}
#ifdef DEBUG_raman
JSec_Principal
static JSec_Principal
RDF_CreatePrincipal(nsPrincipal *prin)
{
/* For certificate principals we should convert the key into string, because
@ -1342,7 +1263,7 @@ RDF_getPrincipal(JSec_Principal jsec_pr)
return prin;
}
JSec_Target
static JSec_Target
RDF_CreateTarget(nsTarget *target)
{
char *targetName = target->getName();
@ -1351,7 +1272,7 @@ RDF_CreateTarget(nsTarget *target)
return RDFJSec_NewTarget(targetName, pr);
}
nsTarget *
static nsTarget *
RDF_getTarget(JSec_Target jsec_target)
{
char *targetName = RDFJSec_GetTargetName(jsec_target);
@ -1410,7 +1331,6 @@ RDF_RemovePrincipalsPrivilege(nsPrincipal *prin, nsTarget *target)
nsCaps_unlock();
return found;
}
#endif /* DEBUG_raman */
/* The following methods are used to save and load the persistent store */
@ -1423,7 +1343,6 @@ void nsPrivilegeManager::save(nsPrincipal *prin,
if (prin->equals(getSystemPrincipal())) {
return;
}
#ifdef DEBUG_raman
nsCaps_lock();
RDFJSec_InitPrivilegeDB();
JSec_Principal pr = RDF_CreatePrincipal(prin);
@ -1433,7 +1352,6 @@ void nsPrivilegeManager::save(nsPrincipal *prin,
RDFJSec_AddPrincipalUse(pr, prUse);
nsCaps_unlock();
#endif /* DEBUG_raman */
}
/* The following routine should be called after setting up the system targets
@ -1441,7 +1359,6 @@ void nsPrivilegeManager::save(nsPrincipal *prin,
*/
void nsPrivilegeManager::load(void)
{
#ifdef DEBUG_raman
nsCaps_lock();
RDFJSec_InitPrivilegeDB();
RDF_Cursor prin_cursor = RDFJSec_ListAllPrincipals();
@ -1479,7 +1396,6 @@ void nsPrivilegeManager::load(void)
RDFJSec_ReleaseCursor(prin_cursor);
nsCaps_unlock();
#endif /* DEBUG_raman */
}
@ -1502,12 +1418,8 @@ PRBool nsPrivilegeManagerInitialize(void)
theUnknownPrincipalArray->Add(theUnknownPrincipal);
thePrivilegeManager = new nsPrivilegeManager();
#ifdef DEBUG_raman
RDFJSec_InitPrivilegeDB();
return PR_FALSE;
#endif /* DEBUG_raman */
}
PRBool nsPrivilegeManager::theInited = nsPrivilegeManagerInitialize();

Просмотреть файл

@ -28,6 +28,8 @@ extern "C" {
#include "jpermission.h"
static PRBool displayUI=PR_FALSE;
static nsPermState
displayPermissionDialog(char *prinStr, char *targetStr, char *riskStr, PRBool isCert)
{
@ -60,10 +62,12 @@ nsPrivilege * nsUserTarget::enablePrivilege(nsPrincipal *prin, void *data)
PRBool isCert = (prin->isCodebase()) ? PR_FALSE : PR_TRUE;
nsPermState permState = nsPermState_AllowedSession;
nsCaps_lock();
/* comment the above line, uncomment the following line to disable UI */
permState = displayPermissionDialog(prinStr, targetStr, riskStr, isCert);
nsCaps_unlock();
/* set displayUI to TRUE, to enable UI */
if (displayUI) {
nsCaps_lock();
permState = displayPermissionDialog(prinStr, targetStr, riskStr, isCert);
nsCaps_unlock();
}
nsPermissionState permVal;
nsDurationState durationVal;

Просмотреть файл

@ -16,9 +16,15 @@
* Reserved.
*/
#include "prtypes.h"
PR_BEGIN_EXTERN_C
#include "nsZig.h"
#include "zig.h"
PR_END_EXTERN_C
//
// PUBLIC METHODS
//

Просмотреть файл

@ -93,7 +93,8 @@ REQUIRES =\
plds \
nspr20 \
parse \
plug \
plugin \
plugimpl \
hook \
pref \
rdf \
@ -118,7 +119,12 @@ REQUIRES += \
$(NULL)
ifdef MOZ_FULLCIRCLE
REQUIRES += fullsoft
REQUIRES += fullsoft
endif
ifdef OJI
REQUIRES += oji \
ojiimpl
endif
CSRCS = \
@ -185,6 +191,7 @@ GUESS_CONFIG := $(shell $(DEPTH)/config/config.guess | sed 's/i[23456]86/x86/')
CCLD = $(CCC)
LDFLAGS = $(CFLAGS)
NOMD_LDFLAGS = $(NOMD_CFLAGS)
BASIC_DSOS = -L$(DIST)/bin
ifdef MOZILLA_GPROF
CSRCS += gmon.c
@ -219,10 +226,21 @@ DTWIDGETS_LIB = $(DIST)/lib/libDtWidgets.a
XFE_WIDGETS_LIB = $(DIST)/lib/libXfeWidgets.a
XFE_WIDGETS_BM_LIB = $(DIST)/lib/libXfeBm.a
DYNAMIC_SYMBOLS_F = -rdynamic # default
ifeq ($(OS_ARCH),SunOS)
ifdef NS_USE_NATIVE
DYNAMIC_SYMBOLS_F = -Bdynamic
else
DYNAMIC_SYMBOLS_F = # nothing for gcc
endif
endif
ifeq ($(OS_ARCH),AIX)
NSPR_LIB =
else
NSPR_LIB = $(DIST)/lib/libplds21.a $(DIST)/lib/libplc21.a $(DIST)/lib/libmsgc21.a $(DIST)/lib/libnspr21.a
# XXX To a DSO...
#NSPR_LIB = $(DIST)/lib/libplds21.a $(DIST)/lib/libplc21.a $(DIST)/lib/libmsgc21.a $(DIST)/lib/libnspr21.a
BASIC_DSOS += -lplds21 -lplc21 -lmsgc21 -lnspr21
endif
ifdef DBMALLOC
@ -282,7 +300,7 @@ ifdef MOZ_LOC_INDEP
BASIC_LIBS += $(DIST)/lib/libli.a
endif
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
JAVA_JMC = $(DIST)/lib/libjmc.a # XXX To be removed...
endif
@ -302,6 +320,8 @@ BASIC_LIBS += \
BASIC_LIBS_2 = \
$(DIST)/lib/lib$(LITE_PREFIX)xp.a \
$(DIST)/lib/libdbm.a \
$(DIST)/lib/libcaps.a \
$(DIST)/lib/lib$(LITE_PREFIX)rdf.a \
$(NULL)
ifdef MOZ_MAIL_NEWS
@ -379,15 +399,18 @@ ifndef NO_LAYERS
BASIC_LIBS += $(DIST)/lib/liblayer.a
endif
BASIC_LIBS += $(DIST)/lib/libxpcom.a
BASIC_LIBS += $(DIST)/lib/libxpcom.a \
$(DIST)/lib/libcaps.a
ifdef JAVA_OR_OJI
BASIC_LIBS += $(DIST)/lib/libcaps.a
########################################################################
# Java
#
ifdef MOZ_JAVA
#
# Monolithic Java
#
BASIC_LIBS += \
$(DIST)/lib/lib$(LITE_PREFIX)applet.a \
$(DIST)/lib/libjrt.a \
@ -423,35 +446,52 @@ endif
BASIC_LIBS += $(DIST)/lib/libjrt.a
else # MOZ_JAVA
else # !MOZ_JAVA
#
# OJI
#
ifdef MOZ_OJI
BASIC_LIBS += $(DIST)/lib/liboji.a
ifdef NSJVM
ifdef EDITOR
BASIC_LIBS += $(DIST)/lib/libedtplug.a
endif
BASIC_LIBS += $(DIST)/lib/libsoftupdate.a
else # !NSJVM
BASIC_LIBS += \
$(DIST)/lib/libstubsj.a \
$(DIST)/lib/libstubnj.a \
$(NULL)
endif # !NSJVM
BASIC_LIBS += $(DIST)/lib/libsoftupdate.a \
$(DIST)/lib/libprgrss.a \
BASIC_LIBS += $(DIST)/lib/libprgrss.a \
$(NULL)
endif # MOZ_JAVA
else # JAVA_OR_OJI
else # !MOZ_OJI
# No Monolithic Java, no OJI, just stubs.
BASIC_LIBS += \
$(DIST)/lib/libstubsj.a \
$(DIST)/lib/libstubnj.a \
$(NULL)
endif # JAVA_OR_OJI
endif # !MOZ_OJI
endif # !MOZ_JAVA
BASIC_LIBS += $(DIST)/lib/libzlib.a
# XXX To a DSO...
#BASIC_LIBS += $(DIST)/lib/libzlib.a
BASIC_DSOS += -lzlib
ifndef NO_MOCHA
BASIC_LIBS += $(DIST)/lib/libjs.a $(DIST)/lib/libjsj.a $(DIST)/lib/libmocha.a
# XXX To a DSO...
#BASIC_LIBS += $(DIST)/lib/libjs.a $(DIST)/lib/libjsj.a
BASIC_DSOS += -ljs -ljsj
BASIC_LIBS += $(DIST)/lib/libmocha.a
endif
# Post-Java libs
@ -460,11 +500,7 @@ BASIC_LIBS += $(DIST)/lib/libstyle.a
ifdef MOZ_SECURITY
BASIC_LIBS += $(DIST)/lib/libjar.a
else
EXPORT_LIB = $(DIST)/lib/libhtmldlgs.a
endif
ifndef MOZ_SECURITY
EXPORT_LIB += $(DIST)/lib/libsecfree.a
EXPORT_LIB = $(DIST)/lib/libhtmldlgs.a $(DIST)/lib/libsecfree.a
endif
LOCALES = $(LOCALE_MAP) $(MAIL_IM_HACK) $(NEWS_IM_HACK)
@ -573,7 +609,7 @@ MCS_CMD = true
# Only IRIX 5.x uses this.
EXTRA_POST_LINK_CMD = echo
EXPORT_LDFLAGS = $(BASIC_LIBS) $(EXPORT_LIB) $(BASIC_LIBS_2) $(OTHER_LIBS) $(NSPR_LIB)
EXPORT_LDFLAGS = $(BASIC_LIBS) $(EXPORT_LIB) $(BASIC_LIBS_2) $(BASIC_DSOS) $(OTHER_LIBS) $(NSPR_LIB)
EXPORT_DEPLIBS = $(BASIC_LIBS) $(EXPORT_LIB) $(BASIC_LIBS_2) $(NSPR_LIB)
DSO_EX_LIBS = $(EXPORT_LDFLAGS:$(DIST)/lib/lib%.a=-l%)
@ -878,7 +914,7 @@ endif
EXPORT_LDFLAGS = -z defs -L$(MOTIF)/lib -L$(USRLIBDIR) -R$(MOTIF)/lib \
-R$(USRLIBDIR) $(BASIC_LIBS) $(EXPORT_LIB) $(BASIC_LIBS_2) \
$(OTHER_LIBS) $(NSPR_LIB)
$(BASIC_DSOS) $(OTHER_LIBS) $(NSPR_LIB)
endif
endif
@ -1011,7 +1047,7 @@ $(OBJDIR)/$(DSO_PROGNAME)-export.quantify: $(OBJS) $(EXPORT_OBJS) $(EXPORT_DEPLI
$(OBJDIR)/$(XFE_PROGNAME)-export: $(OBJS) $(EXPORT_OBJS) $(EXPORT_DEPLIBS)
@$(MAKE_OBJDIR)
rm -f $@
$(CCLD) -o $@ $(LDFLAGS) $(OBJS) $(EXPORT_OBJS) $(EXPORT_LDFLAGS) $(DNS_LIB)
$(CCLD) -o $@ $(DYNAMIC_SYMBOLS_F) $(LDFLAGS) $(OBJS) $(EXPORT_OBJS) $(EXPORT_LDFLAGS) $(DNS_LIB)
@$(EXTRA_POST_LINK_CMD) $@
$(OBJDIR)/$(XFE_PROGNAME)-export.pure: $(OBJS) $(EXPORT_OBJS) $(EXPORT_DEPLIBS)

Просмотреть файл

@ -126,7 +126,7 @@ ICONLIST = $(OBJDIR)/icon.list
ICONANIMLIST = $(OBJDIR)/iconanim.list
MKICONS_EXE = $(OBJDIR)/mkicons
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
JAVA_JMC = $(DIST)/lib/libjmc.a # XXX To be removed...
else
JAVA_JMC = $(DIST)/lib/libstubsj.a

Просмотреть файл

@ -53,10 +53,17 @@ REQUIRES =\
rdf \
progress \
xpcom \
plugin \
plugimpl \
raptor \
netcnvts \
msg \
progress \
plug
progress
ifdef OJI
REQUIRES += oji \
ojiimpl
endif
CPPSRCS = \
plugin.cpp \

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
@ -924,28 +924,40 @@ FE_LoadPlugin(void *pdesc, NPNetscapeFuncs *funcs, np_handle* handle)
return NULL;
}
NP_CREATEPLUGIN npCreatePlugin =
#ifndef NSPR20
(NP_CREATEPLUGIN)PR_FindSymbol("NP_CreatePlugin", plugin->dlopen_obj);
#else
(NP_CREATEPLUGIN)PR_FindSymbol(plugin->dlopen_obj, "NP_CreatePlugin");
#endif
if (npCreatePlugin != NULL) {
nsFactoryProc nsGetFactory =
(nsFactoryProc)PR_FindSymbol(plugin->dlopen_obj, "NSGetFactory");
if (nsGetFactory != NULL) {
// XXX Figure out where this should go: this seems a
// little late in the game to be creating the plugin
// manager...
if (thePluginManager == NULL) {
static NS_DEFINE_IID(kIPluginManagerIID, NP_IPLUGINMANAGER_IID);
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
if (nsPluginManager::Create(NULL, kIPluginManagerIID, (void**)&thePluginManager) != NS_OK)
return NULL;
}
NPIPlugin* userPlugin = NULL;
NPPluginError err = npCreatePlugin(thePluginManager, &userPlugin);
PR_ASSERT(thePluginManager != NULL);
static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID);
nsIPlugin* userPlugin = NULL;
nsresult err = nsGetFactory(kIPluginIID, (nsIFactory**)&userPlugin);
handle->userPlugin = userPlugin;
plugin->handle = handle;
if (err != NPPluginError_NoError || userPlugin == NULL) {
int err = PR_UnloadLibrary(plugin->dlopen_obj);
PR_ASSERT(err == 0);
if ((err != NS_OK)
|| (userPlugin == NULL)
|| (userPlugin->Initialize((nsIPluginManager*)thePluginManager) != NS_OK)) {
PR_UnloadLibrary(plugin->dlopen_obj);
plugin->dlopen_obj = NULL;
return NULL;
}
#ifdef LATER // XXX coming soon...
// add the plugin directory if successful
JVM_AddToClassPathRecursively(csPluginDir);
#endif
}
else {
#ifndef NSPR20
@ -998,7 +1010,10 @@ FE_UnloadPlugin(void *pdesc, struct _np_handle* handle)
if (plugin->handle) {
if (plugin->handle->userPlugin) {
NPIPlugin* userPlugin = (NPIPlugin*)plugin->handle->userPlugin;
nsIPlugin* userPlugin = (nsIPlugin*)plugin->handle->userPlugin;
// XXX We should be calling userPlugin->Shutdown() here,
// and then we should ping the lib's NSCanUnload()
// function before actually unloading the library.
XP_VERIFY(userPlugin->Release() == 0);
plugin->handle = NULL;
}

Просмотреть файл

@ -104,6 +104,7 @@ PORT_FLAGS += -DNO_INT64_T
PLATFORM_FLAGS += -DLINUX2_0
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
DSO_BIND_REFERENCES = -Wl,-Bsymbolic
ifdef BUILD_OPT
OPTIMIZER = -O2
endif

Просмотреть файл

@ -171,6 +171,7 @@ FC_PLATFORM_DIR = SunOS5_sparc
endif
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_BIND_REFERENCES = -Bsymbolic
DSO_LDOPTS = -G -L$(MOTIF)/lib -L/usr/openwin/lib
DSO_LDFLAGS =

Просмотреть файл

@ -499,6 +499,11 @@ ifdef MOZ_OJI
error You can't define both MOZ_JAVA and MOZ_OJI anymore.
endif
JAVA_OR_OJI = 1
JAVA_OR_NSJVM = 1
endif
ifdef NSJVM
JAVA_OR_NSJVM = 1
endif
ifdef MOZ_OJI
@ -506,7 +511,7 @@ DEFINES += -DOJI
JAVA_OR_OJI = 1
endif
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM # XXX fix -- su can't depend on java
MOZ_SMARTUPDATE = 1
endif

Просмотреть файл

@ -59,6 +59,9 @@
# JRI_GEN -- files to run through javah to generate headers and stubs
# (output goes into the _jri sub-dir)
# j)
# JNI_GEN -- files to run through javah to generate headers and stubs
# (output goes into the _jni sub-dir)
# k)
# JMC_GEN -- files to run through jmc to generate headers and stubs
# (output goes into the _jmc sub-dir)
#
@ -167,7 +170,7 @@ ifndef PACKAGE
PACKAGE = .
endif
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
ALL_TRASH = $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \
$(NOSUCHFILE) $(JDK_HEADER_CFILES) $(JDK_STUB_CFILES) \
$(JRI_HEADER_CFILES) $(JRI_STUB_CFILES) $(JMC_STUBS) \
@ -182,13 +185,13 @@ ALL_TRASH = $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \
_gen _stubs $(wildcard gts_tmp_*)
endif
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
ifdef JDIRS
ALL_TRASH += $(addprefix $(JAVA_DESTPATH)/,$(JDIRS))
endif
endif
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
JMC_SUBDIR = _jmc
else
JMC_SUBDIR = $(LOCAL_JMC_SUBDIR)
@ -198,11 +201,13 @@ ifdef NSBUILDROOT
JDK_GEN_DIR = $(XPDIST)/_gen
JMC_GEN_DIR = $(XPDIST)/$(JMC_SUBDIR)
JRI_GEN_DIR = $(XPDIST)/_jri
JNI_GEN_DIR = $(XPDIST)/_jni
JDK_STUB_DIR = $(XPDIST)/_stubs
else
JDK_GEN_DIR = _gen
JMC_GEN_DIR = $(JMC_SUBDIR)
JRI_GEN_DIR = _jri
JNI_GEN_DIR = _jni
JDK_STUB_DIR = _stubs
endif
@ -483,7 +488,7 @@ $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) $(JMCSRCDIR)::
### JSRCS -- for compiling java files
ifneq ($(JSRCS),)
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
list=`$(PERL) $(DEPTH)/config/outofdate.pl $(PERLARG) \
-d $(JAVA_DESTPATH)/$(PACKAGE) $(JSRCS)`; \
@ -508,7 +513,7 @@ endif
# some builds to run out of memory
#
ifdef JDIRS
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
@for d in $(JDIRS); do \
if test -d $$d; then \
@ -536,7 +541,7 @@ endif
# Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory
#
ifneq ($(JDK_GEN),)
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
ifdef NSBUILDROOT
INCLUDES += -I$(JDK_GEN_DIR) -I$(XPDIST)
else
@ -568,7 +573,7 @@ ifdef MOZ_GENMAC
@echo Generating/Updating JDK stubs for the Mac
$(JAVAH) -mac -stubs -d $(DEPTH)/lib/mac/Java/_stubs $(JDK_PACKAGE_CLASSES)
endif
endif # JAVA_OR_OJI
endif # JAVA_OR_NSJVM
endif
#
@ -577,7 +582,7 @@ endif
# Generate JRI Headers and Stubs into the 'jri' directory
#
ifneq ($(JRI_GEN),)
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
ifdef NSBUILDROOT
INCLUDES += -I$(JRI_GEN_DIR) -I$(XPDIST)
else
@ -609,14 +614,53 @@ ifdef MOZ_GENMAC
@echo Generating/Updating JRI stubs for the Mac
$(JAVAH) -jri -mac -stubs -d $(DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
endif
endif # JAVA_OR_OJI
endif # JAVA_OR_NSJVM
endif
#
# JNI_GEN -- for generating JNI native methods
#
# Generate JNI Headers and Stubs into the 'jni' directory
#
ifneq ($(JNI_GEN),)
ifdef JAVA_OR_NSJVM
ifdef NSBUILDROOT
INCLUDES += -I$(JNI_GEN_DIR) -I$(XPDIST)
else
INCLUDES += -I$(JNI_GEN_DIR)
endif
JNI_PACKAGE_CLASSES = $(JNI_GEN)
JNI_PATH_CLASSES = $(subst .,/,$(JNI_PACKAGE_CLASSES))
JNI_HEADER_CLASSFILES = $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JNI_PATH_CLASSES))
JNI_HEADER_CFILES = $(patsubst %,$(JNI_GEN_DIR)/%.h,$(JNI_GEN))
JNI_STUB_CFILES = $(patsubst %,$(JNI_GEN_DIR)/%.c,$(JNI_GEN))
$(JNI_HEADER_CFILES): $(JNI_HEADER_CLASSFILES)
export::
@echo Generating/Updating JNI headers
$(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_PACKAGE_CLASSES)
ifdef MOZ_GENMAC
@if test ! -d $(DEPTH)/lib/mac/Java/; then \
echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \
echo "!!! This allows us to automatically update generated files for the mac."; \
echo "!!! If you see any modified files there, please check them in."; \
fi
@echo Generating/Updating JNI headers for the Mac
$(JAVAH) -jni -mac -d $(DEPTH)/lib/mac/Java/_jni $(JNI_PACKAGE_CLASSES)
endif
endif # JAVA_OR_NSJVM
endif # JNI_GEN
#
# JMC_EXPORT -- for declaring which java classes are to be exported for jmc
#
ifneq ($(JMC_EXPORT),)
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
JMC_EXPORT_PATHS = $(subst .,/,$(JMC_EXPORT))
JMC_EXPORT_FILES = $(patsubst %,$(JAVA_DESTPATH)/$(PACKAGE)/%.class,$(JMC_EXPORT_PATHS))
@ -627,7 +671,7 @@ JMC_EXPORT_FILES = $(patsubst %,$(JAVA_DESTPATH)/$(PACKAGE)/%.class,$(JMC_EXPORT
#
export:: $(JMC_EXPORT_FILES) $(JMCSRCDIR)
$(NSINSTALL) -t -m 444 $(JMC_EXPORT_FILES) $(JMCSRCDIR)
endif # JAVA_OR_OJI
endif # JAVA_OR_NSJVM
endif
#
@ -637,7 +681,7 @@ endif
#
ifneq ($(JMC_GEN),)
INCLUDES += -I$(JMC_GEN_DIR) -I.
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM
JMC_HEADERS = $(patsubst %,$(JMC_GEN_DIR)/%.h,$(JMC_GEN))
JMC_STUBS = $(patsubst %,$(JMC_GEN_DIR)/%.c,$(JMC_GEN))
JMC_OBJS = $(patsubst %,$(OBJDIR)/%.o,$(JMC_GEN))
@ -657,7 +701,7 @@ else
endif
export:: $(JMC_HEADERS) $(JMC_STUBS)
endif # JAVA_OR_OJI
endif # JAVA_OR_NSJVM
endif
#
@ -791,3 +835,14 @@ endif
#
.PHONY: all all_platforms alltags boot clean clobber clobber_all export install libs realclean $(OBJDIR) $(DIRS)
envirocheck::
@echo -----------------------------------
@echo "Enviro-Check (tm)"
@echo -----------------------------------
@echo "MOZILLA_CLIENT = $(MOZILLA_CLIENT)"
@echo "NO_MDUPDATE = $(NO_MDUPDATE)"
@echo "BUILD_OPT = $(BUILD_OPT)"
@echo "MOZ_LITE = $(MOZ_LITE)"
@echo "MOZ_MEDIUM = $(MOZ_MEDIUM)"
@echo -----------------------------------

Просмотреть файл

@ -53,8 +53,10 @@ m_cvstrm.h
ncompat.h
net.h
np.h
np2.h
npapi.h
npassoc.h
npupp.h
nsldap.h
nslocks.h
ntos.h

Просмотреть файл

@ -213,7 +213,12 @@ typedef void
(PR_CALLBACK *JSLockReleaseFunc)(void * data);
#ifdef OJI
extern JSBool PR_CALLBACK LM_LockJS(char **errp);
#else
extern void PR_CALLBACK LM_LockJS(void);
#endif
extern void PR_CALLBACK LM_UnlockJS(void);
extern JSBool PR_CALLBACK LM_AttemptLockJS(JSLockReleaseFunc fn, void * data);
extern JSBool PR_CALLBACK LM_ClearAttemptLockJS(JSLockReleaseFunc fn, void * data);

Просмотреть файл

@ -983,6 +983,7 @@ struct LO_CommonPluginStruct_struct {
#ifdef MOCHA
struct JSObject *mocha_object;
#endif
int16 sub_type;
};
struct LO_BuiltinStruct_struct {
@ -1001,12 +1002,12 @@ struct LO_BuiltinStruct_struct {
void * FE_Data;
void *session_data;
PA_Block builtin_src;
#ifndef OJI
#if defined(OJI)
struct lo_NVList attributes;
#else
int32 attribute_cnt;
char **attribute_list;
char **value_list;
#else
lo_NVList attributes;
#endif /* OJI */
int32 alignment;
int32 border_width;

Просмотреть файл

@ -658,7 +658,6 @@ typedef struct _mdata {
#define APPLICATION_WWW_FORM_URLENCODED "application/x-www-form-urlencoded"
#define APPLICATION_OLEOBJECT "application/oleobject"
#define APPLICATION_OLEOBJECT2 "application/x-oleobject"
#define APPLICATION_JAVAVM "application/java-vm"
#define APPLICATION_JAVAARCHIVE "application/java-archive"
#define APPLICATION_MARIMBA "application/marimba"
#define APPLICATION_XMARIMBA "application/x-marimba"

Просмотреть файл

@ -18,7 +18,7 @@
/*
* np.h $Revision: 3.3 $
* np.h $Revision: 3.4 $
* Prototypes for functions exported by libplugin and called by the FEs or other XP libs.
* Prototypes for functions exported by the FEs and called by libplugin are in nppg.h.
*/
@ -129,7 +129,17 @@ extern NPError NPL_RegisterAppletType(NPMIMEType type);
#endif /* ANTHRAX */
PR_EXTERN(void) NPL_SetPluginWindow(void *data);
PR_EXTERN(struct NPIPlugin*) NPL_LoadPluginByType(const char* typeAttribute);
PR_EXTERN(struct nsIPlugin*) NPL_LoadPluginByType(const char* typeAttribute);
/*
* This callback is installed by the FE to handle the nsIPluginManager2::ProcessNextEvent
* operation. The result parameter should return PR_TRUE if called on the mozilla thread
* (unlike the old nsn_TickleHookProcPtr which returned false (I think)).
*/
typedef PRBool (PR_CALLBACK* NPL_ProcessNextEventProc)(void* data);
PR_EXTERN(void)
NPL_InstallProcessNextEventProc(NPL_ProcessNextEventProc proc, void* data);
XP_END_PROTOS

Просмотреть файл

@ -18,7 +18,6 @@
/*
* np2.h $Revision: 3.1 $
* Prototypes for functions exported by OJI based libplugin and called by the FEs or other XP libs.
*/
@ -37,7 +36,7 @@ PR_EXTERN(const char *) NPL_GetText(struct nsIPluginInstance *);
PR_EXTERN(jobject) NPL_GetJavaObject(struct nsIPluginInstance *);
PR_EXTERN(void ) NPL_Release(struct nsISupports *);
PR_EXTERN(XP_Bool) NPL_IsJVMAndMochaPrefsEnabled(void);
PR_EXTERN(void)NPL_JSJInit(void);
PR_EXTERN(PRBool)NPL_JSJInit(void);
PR_EXTERN(JNIEnv *)NPL_EnsureJNIExecEnv(PRThread* thread);
#endif /* _NP2_H */

Просмотреть файл

@ -18,7 +18,7 @@
/*
* npapi.h $Revision: 3.2 $
* npapi.h $Revision: 3.3 $
* Netscape client plug-in API spec
*/
@ -133,22 +133,29 @@ RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
#ifndef _UINT16
typedef unsigned short uint16;
#endif
#ifndef _UINT32
#if defined(__alpha)
# ifndef NSPR20
# if defined(__alpha)
typedef unsigned int uint32;
#else /* __alpha */
# else /* __alpha */
typedef unsigned long uint32;
#endif /* __alpha */
# endif /* __alpha */
# endif /* NSPR20 */
#endif
#ifndef _INT16
typedef short int16;
#endif
#ifndef _INT32
#if defined(__alpha)
# ifndef NSPR20
# if defined(__alpha)
typedef int int32;
#else /* __alpha */
# else /* __alpha */
typedef long int32;
#endif /* __alpha */
# endif /* __alpha */
# endif /* NSPR20 */
#endif
#ifndef FALSE
@ -513,11 +520,11 @@ void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
int16 NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
NPReason reason, void* notifyData);
jref NP_LOADDS NPP_GetJavaClass(void);
NPError NP_LOADDS NPP_GetValue(void *instance, NPPVariable variable,
void *value);
NPError NP_LOADDS NPP_SetValue(void *instance, NPNVariable variable,
void *value);
jref NP_LOADDS NPP_GetJavaClass(void);
NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable,
void *value);
NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable,
void *value);
/*
* NPN_* functions are provided by the navigator and called by the plugin.

Просмотреть файл

@ -34,6 +34,13 @@ DEPTH = ..
# See top-level makefile for details
#
DIRS = src jsj tests
ifndef MOZ_OJI
DIRS = src \
jsj \
tests
else
DIRS = src \
tests
endif
include $(DEPTH)/config/rules.mk

Просмотреть файл

@ -23,6 +23,7 @@
!!! HEED THE WARNING.
*/
#if !defined(XP_MAC)
#if defined (JAVA) || defined(OJI)
#define IMPLEMENT_netscape_javascript_JSObject
#define IMPLEMENT_netscape_javascript_JSException
@ -40,3 +41,4 @@
void _java_javascript_init(void) { }
#endif /* defined (JAVA) */
#endif /* !defined(XP_MAC) */

Просмотреть файл

@ -16,7 +16,10 @@
DEPTH=..
DIRS=src \
jsj
!ifdef MOZ_JAVA
jsj \
!endif
$(NULL)
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -2,6 +2,7 @@
#
jsapi.h
jspubtd.h
jsarray.h
jsatom.h
jsbool.h

Просмотреть файл

@ -16,6 +16,8 @@
DEPTH = ../..
DIRS = liveconnect
LIBRARY_NAME = js
ifeq ($(subst /,_,$(shell uname -s)),OS2)
@ -101,8 +103,6 @@ endif
include $(DEPTH)/config/rules.mk
export:: install
ifndef BUILD_OPT
MOCHAFILE = 1
endif

Просмотреть файл

@ -63,6 +63,10 @@ js_DropProperty(JSContext *cx, JSObject *obj, JSProperty *prop);
#define NATIVE_DROP_PROPERTY NULL
#endif
#ifdef XP_MAC
#pragma export on
#endif
JS_FRIEND_DATA(JSObjectOps) js_ObjectOps = {
js_NewObjectMap, js_DestroyObjectMap,
#if defined JS_THREADSAFE && defined DEBUG
@ -79,6 +83,10 @@ JS_FRIEND_DATA(JSObjectOps) js_ObjectOps = {
NULL, js_HasInstance
};
#ifdef XP_MAC
#pragma export off
#endif
JSClass js_ObjectClass = {
js_Object_str,
0,

Просмотреть файл

@ -1915,7 +1915,7 @@ js_DecompileFunction(JSPrinter *jp, JSFunction *fun, JSBool newlines)
}
if (atom == NULL)
break;
js_printf(jp, (i > 0 ? ", %s" : "%s"), ATOM_BYTES(atom));
js_printf(jp, (i > 0 ? ", %s" : "%s"), ATOM_BYTES(atom));
}
}
js_puts(jp, ") {\n");

Просмотреть файл

@ -300,11 +300,11 @@ GetChar(JSTokenStream *ts)
int32 c;
ptrdiff_t len, olen;
jschar *nl;
if (ts->ungetpos != 0) {
c = ts->ungetbuf[--ts->ungetpos];
} else {
if (ts->linebuf.ptr == ts->linebuf.limit) {
if (ts->linebuf.ptr == ts->linebuf.limit) {
len = PTRDIFF(ts->userbuf.limit, ts->userbuf.ptr, jschar);
if (len <= 0) {
#ifdef JSFILE

Просмотреть файл

@ -1,4 +1,26 @@
/*stddef inclusion here to first declare ptrdif as a signed long instead of a signed int*/
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/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 Communicator client 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.
*/
/*
* stddef inclusion here to first declare ptrdif as a signed long instead of a
* signed int.
*/
#ifdef _WINDOWS
# ifndef XP_WIN
@ -33,7 +55,7 @@ typedef long ptrdiff_t;
#define PTRDIFF(p1, p2, type) \
((p1) - (p2))
#endif
#include <stddef.h>

Просмотреть файл

@ -27,12 +27,13 @@ DIRS = classes
endif
endif
ifdef MOZ_OJI
MODULE = java
LIBRARY_NAME = jsj
REQUIRES = java js applet nspr img util layer
ifdef MOZ_OJI
CSRCS = jsj.c \
jsj_JSObject.c \
jsj_JavaArray.c \
@ -46,11 +47,7 @@ CSRCS = jsj.c \
jsj_hash.c \
jsj_method.c \
jsj_utils.c
else
CSRCS = \
jsjava.c \
jsStubs.c \
$(NULL)
endif
ifdef MOZ_OJI
@ -96,8 +93,6 @@ else
$(OBJDIR)/stubs.o:
endif
export:: install
ifndef REGENERATE
export:: jsj10.jar

Просмотреть файл

@ -374,7 +374,7 @@ JSJ_ConnectToJavaVM(JavaVM *java_vm_arg, const char *user_classpath)
return NULL;
}
}
#ifndef OJI
#if !defined(OJI) && !defined(XP_MAC)
else {
/* No Java VM supplied, so create our own */
JDK1_1InitArgs vm_args;

Двоичные данные
js/src/liveconnect/jsj10.jar

Двоичный файл не отображается.

Просмотреть файл

@ -236,7 +236,7 @@ JavaClass_finalize(JSContext *cx, JSObject *obj)
if (!jEnv)
return;
printf("Finalizing %s\n", class_descriptor->name);
/* printf("Finalizing %s\n", class_descriptor->name); */
jsj_ReleaseJavaClassDescriptor(cx, jEnv, class_descriptor);
}

Просмотреть файл

@ -582,7 +582,7 @@ static JSBool
JavaObject_defaultValue(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
{
/* printf("In JavaObject_defaultValue()\n"); */
return JavaObject_convert(cx, obj, JSTYPE_STRING, vp);
return JavaObject_convert(cx, obj, type, vp);
}
static JSBool

Просмотреть файл

@ -21,6 +21,8 @@
#//------------------------------------------------------------------------
DEPTH=..\..
DIRS = liveconnect
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)

Просмотреть файл

@ -21,6 +21,7 @@
* "Fast Allocation and Deallocation of Memory Based on Object Lifetimes"
* David R. Hanson, Software -- Practice and Experience, Vol. 20(1).
*/
#include "jsstddef.h"
#include <stdlib.h>
#include <string.h>
#include "prtypes.h"

Просмотреть файл

@ -1,11 +1,25 @@
/* -*- Mode: C; tab-width: 8 -*-
* Copyright © 1996, 1997, 1998 Netscape Communications Corporation,
* All Rights Reserved.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* Portable double to alphanumeric string and back converters.
*/
#include "jsstddef.h"
#include "prtypes.h"
#include "prdtoa.h"
#include "prprf.h"
@ -2538,7 +2552,7 @@ PR_cnvtf(char *buf,int bufsz, int prcsn,double fval)
if(decpt == 9999){
while((*bufp++ = *nump++) != 0) ;
return;
goto done;
}
if(decpt > (prcsn+1) || decpt < -(prcsn-1) || decpt < -5){

Просмотреть файл

@ -1,6 +1,19 @@
/* -*- Mode: C; tab-width: 8 -*-
* Copyright © 1996, 1997, 1998 Netscape Communications Corporation,
* All Rights Reserved.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef prdtoa_h___

Просмотреть файл

@ -35,7 +35,7 @@ ifdef MOZ_NEO
DIRS += libneo
endif
DIRS += libparse plugin xlate xp
DIRS += libparse xlate xp
ifdef MOZ_MAIL_NEWS
DIRS += libaddr libmime

Просмотреть файл

@ -39,6 +39,20 @@ void lo_FillInBuiltinGeometry(lo_DocState *state, LO_BuiltinStruct *builtin,
void lo_UpdateStateAfterBuiltinLayout (lo_DocState *state, LO_BuiltinStruct *builtin,
int32 line_inc, int32 baseline_inc);
/**
* Some accessor macros, to manage the OJI changes.
*/
#if defined(OJI)
#define BUILTIN_ATTRIBUTE_COUNT(builtin) (builtin)->attributes.n
#define BUILTIN_ATTRIBUTE_NAMES(builtin) (builtin)->attributes.names
#define BUILTIN_ATTRIBUTE_VALUES(builtin) (builtin)->attributes.values
#else
#define BUILTIN_ATTRIBUTE_COUNT(builtin) (builtin)->attribute_cnt
#define BUILTIN_ATTRIBUTE_NAMES(builtin) (builtin)->attribute_list
#define BUILTIN_ATTRIBUTE_VALUES(builtin) (builtin)->value_list
#endif
void
lo_FormatBuiltin (MWContext *context, lo_DocState *state, PA_Tag *tag)
{
@ -74,12 +88,13 @@ lo_FormatBuiltin (MWContext *context, lo_DocState *state, PA_Tag *tag)
builtin->height = 0;
builtin->next = NULL;
builtin->prev = NULL;
builtin->attribute_cnt = 0;
builtin->attribute_list = NULL;
builtin->value_list = NULL;
builtin->attribute_cnt = PA_FetchAllNameValues (tag,
&(builtin->attribute_list), &(builtin->value_list), CS_FE_ASCII);
BUILTIN_ATTRIBUTE_COUNT(builtin) = 0;
BUILTIN_ATTRIBUTE_NAMES(builtin) = NULL;
BUILTIN_ATTRIBUTE_VALUES(builtin) = NULL;
BUILTIN_ATTRIBUTE_COUNT(builtin) = PA_FetchAllNameValues (tag,
&BUILTIN_ATTRIBUTE_NAMES(builtin), &BUILTIN_ATTRIBUTE_VALUES(builtin), CS_FE_ASCII);
lo_FormatBuiltinInternal (context, state, tag, builtin, FALSE, FALSE);
}
@ -87,18 +102,18 @@ lo_FormatBuiltin (MWContext *context, lo_DocState *state, PA_Tag *tag)
void
lo_appendParams (LO_BuiltinStruct *builtin, uint32 param_count,
char **param_names, char **param_values) {
int32 newcount = builtin->attribute_cnt + param_count;
int32 n = builtin->attribute_cnt;
builtin->attribute_list = (char**)XP_REALLOC(builtin->attribute_list,
int32 newcount = BUILTIN_ATTRIBUTE_COUNT(builtin) + param_count;
int32 n = BUILTIN_ATTRIBUTE_COUNT(builtin);
BUILTIN_ATTRIBUTE_NAMES(builtin) = (char**)XP_REALLOC(BUILTIN_ATTRIBUTE_NAMES(builtin),
newcount * sizeof(char*));
builtin->value_list = (char**)XP_REALLOC(builtin->value_list,
BUILTIN_ATTRIBUTE_VALUES(builtin) = (char**)XP_REALLOC(BUILTIN_ATTRIBUTE_VALUES(builtin),
newcount * sizeof(char*));
while (n < newcount) {
*(builtin->attribute_list + n) = XP_STRDUP(*(param_names + n - builtin->attribute_cnt));
*(builtin->value_list + n) = XP_STRDUP(*(param_values + n - builtin->attribute_cnt));
*(BUILTIN_ATTRIBUTE_NAMES(builtin) + n) = XP_STRDUP(*(param_names + n - BUILTIN_ATTRIBUTE_COUNT(builtin)));
*(BUILTIN_ATTRIBUTE_VALUES(builtin) + n) = XP_STRDUP(*(param_values + n - BUILTIN_ATTRIBUTE_COUNT(builtin)));
n++;
}
builtin->attribute_cnt = builtin->attribute_cnt + param_count;
BUILTIN_ATTRIBUTE_COUNT(builtin) = BUILTIN_ATTRIBUTE_COUNT(builtin) + param_count;
}
@ -115,12 +130,12 @@ lo_FormatBuiltinObject (MWContext *context, lo_DocState* state,
printf ("lo_FormatBuiltinObject\n");
#endif
builtin->attribute_cnt = 0;
builtin->attribute_list = NULL;
builtin->value_list = NULL;
BUILTIN_ATTRIBUTE_COUNT(builtin) = 0;
BUILTIN_ATTRIBUTE_NAMES(builtin) = NULL;
BUILTIN_ATTRIBUTE_VALUES(builtin) = NULL;
builtin->attribute_cnt = PA_FetchAllNameValues (tag,
&(builtin->attribute_list), &(builtin->value_list), CS_FE_ASCII);
BUILTIN_ATTRIBUTE_COUNT(builtin) = PA_FetchAllNameValues (tag,
&(BUILTIN_ATTRIBUTE_NAMES(builtin)), &(BUILTIN_ATTRIBUTE_VALUES(builtin)), CS_FE_ASCII);
if (param_count > 0) lo_appendParams(builtin, param_count, param_names, param_values);
lo_FormatBuiltinInternal (context, state, tag, builtin, TRUE, streamStarted);
@ -206,7 +221,7 @@ lo_FormatBuiltinInternal (MWContext *context, lo_DocState *state, PA_Tag *tag,
builtin->ele_attrmask |= LO_ELE_STREAM_STARTED;
/* Convert any js in the values */
lo_ConvertAllValues (context, builtin->value_list, builtin->attribute_cnt,
lo_ConvertAllValues (context, BUILTIN_ATTRIBUTE_VALUES(builtin), BUILTIN_ATTRIBUTE_COUNT(builtin),
tag->newline_count);
/* double-counting builtins? XXX */

Просмотреть файл

@ -23,6 +23,7 @@
#include "layout.h"
#include "laylayer.h"
#include "np.h"
#include "np2.h"
#include "laystyle.h"
#include "layers.h"
@ -290,7 +291,13 @@ lo_FormatEmbedObject(MWContext* context, lo_DocState* state,
#endif
#ifdef OJI
/* XXX */
for (count = 0; count < (uint32)embed->attributes.n; count++)
{
if ( (XP_STRCASECMP(embed->attributes.names[count], PARAM_MAYSCRIPT) == 0)
&&(embed->attributes.values[count] == NULL) ) {
StrAllocCopy(embed->attributes.values[count], "true");
}
}
#else
/*
* Look through the parameters and replace "id"
@ -755,57 +762,70 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag,
}
/*
* Put the embed onto the embed list for later
* possible reflection.
* Put embed onto the embed list and applets into applet list
* for later possible reflection.
*/
doc_lists = lo_GetCurrentDocLists(state);
if (state->in_relayout) {
int32 i, count;
LO_EmbedStruct *prev_embed, *cur_embed;
{
int32 i, count, *pDoclistCount;
LO_EmbedStruct *prev_embed, *cur_embed;
LO_CommonPluginStruct **ppDoclistList;
doc_lists = lo_GetCurrentDocLists(state);
if( embed->objTag.sub_type == LO_JAVA )
{
cur_embed = (LO_EmbedStruct *)doc_lists->applet_list;
pDoclistCount = &doc_lists->applet_list_count;
ppDoclistList = (LO_CommonPluginStruct **)&doc_lists->applet_list;
}
else
{
cur_embed = doc_lists->embed_list;
pDoclistCount = &doc_lists->embed_list_count;
ppDoclistList = (LO_CommonPluginStruct **)&doc_lists->embed_list;
}
if (state->in_relayout) {
/*
* In the interest of changing as little as possible, I'm not
* going to change the embed_list to be in the order of layout
* (it is currently in reverse order). Instead, we do what
* everybody else does - iterate till the end of the list to get
* find an element with the correct index.
* If we're in table relayout, we need to replace the element
* of the same index in this list with the new layout element
* to prevent multiple reflection.
*/
count = 0;
cur_embed = doc_lists->embed_list;
while (cur_embed) {
cur_embed = cur_embed->nextEmbed;
count++;
}
/*
* In the interest of changing as little as possible, I'm not
* going to change the embed_list to be in the order of layout
* (it is currently in reverse order). Instead, we do what
* everybody else does - iterate till the end of the list to get
* find an element with the correct index.
* If we're in table relayout, we need to replace the element
* of the same index in this list with the new layout element
* to prevent multiple reflection.
*/
count = 0;
/* reverse order... */
prev_embed = NULL;
cur_embed = doc_lists->embed_list;
for (i = count-1; i >= 0; i--) {
if (i == doc_lists->embed_list_count) {
/* Copy over the mocha object (it might not exist) */
embed->objTag.mocha_object = cur_embed->objTag.mocha_object;
/* reverse order... */
prev_embed = NULL;
while (cur_embed) {
cur_embed = cur_embed->nextEmbed;
count++;
}
for (i = count-1; i >= 0; i--) {
if (i == *pDoclistCount) {
/* Copy over the mocha object (it might not exist) */
embed->objTag.mocha_object = cur_embed->objTag.mocha_object;
embed->nextEmbed = cur_embed->nextEmbed;
embed->nextEmbed = cur_embed->nextEmbed;
/* Replace the old embed with the new one */
if (prev_embed == NULL)
doc_lists->embed_list = embed;
else
prev_embed->nextEmbed = embed;
doc_lists->embed_list_count++;
break;
}
prev_embed = cur_embed;
cur_embed = cur_embed->nextEmbed;
}
}
else {
embed->nextEmbed = doc_lists->embed_list;
doc_lists->embed_list = embed;
doc_lists->embed_list_count++;
/* Replace the old embed with the new one */
if (prev_embed == NULL)
*ppDoclistList = (LO_CommonPluginStruct *)embed;
else
prev_embed->nextEmbed = embed;
(*pDoclistCount)++;
break;
}
prev_embed = cur_embed;
cur_embed = cur_embed->nextEmbed;
}
}
else {
embed->nextEmbed = (LO_EmbedStruct *)*ppDoclistList;
*ppDoclistList = (LO_CommonPluginStruct *)embed;
(*pDoclistCount)++;
}
}
/*

Просмотреть файл

@ -2885,7 +2885,7 @@ lo_get_form_element_data(MWContext *context,
type = (uint8)form_data->type;
}
break;
#ifdef JAVA
#if defined(JAVA ) || defined(OJI)
case FORM_TYPE_OBJECT:
{
lo_FormElementObjectData *form_data;
@ -2897,7 +2897,27 @@ lo_get_form_element_data(MWContext *context,
char *vstr;
name = lo_dup_block(form_data->name);
#ifdef OJI
{
#include "np.h"
#include "np2.h"
NPEmbeddedApp *embed = (NPEmbeddedApp*) form_data->object->objTag.FE_Data;
if (embed) {
struct nsIPluginInstance *pNPI = NPL_GetOJIPluginInstance(embed);
object_value = NPL_GetText(pNPI);
NPL_Release((struct nsISupports *)pNPI);
}
}
if (object_value != NULL)
{
value = PA_ALLOC(XP_STRLEN(object_value) + 1);
PA_LOCK(vstr, char *, value);
XP_STRCPY(vstr, object_value);
PA_UNLOCK(value);
XP_FREE(object_value);
}
#else
object_value = LJ_Applet_GetText(form_data->object->objTag.session_data);
value = PA_ALLOC(XP_STRLEN(object_value) + 1);
if (value != NULL)
@ -2907,6 +2927,7 @@ lo_get_form_element_data(MWContext *context,
PA_UNLOCK(value);
}
XP_FREE(object_value);
#endif
type = (uint8)form_data->type;
}

Просмотреть файл

@ -26,8 +26,11 @@
#include "laylayer.h"
#include "pa_parse.h"
#include "libevent.h"
#ifdef JAVA
#if defined (JAVA)
#include "jsjava.h"
#elif defined (OJI)
#include "jsjava.h"
#include "np2.h"
#endif
#include "layers.h"
@ -557,7 +560,7 @@ LO_EnumerateLinks(MWContext *context, int32 layer_id)
return count;
}
#ifdef JAVA
#if defined(JAVA) || defined (OJI)
LO_JavaAppStruct *
LO_GetAppletByIndex(MWContext *context, int32 layer_id, uint index)
{
@ -566,9 +569,15 @@ LO_GetAppletByIndex(MWContext *context, int32 layer_id, uint index)
int i, count;
lo_DocLists *doc_lists;
#ifdef OJI
if (!NPL_IsJVMAndMochaPrefsEnabled())
return NULL;
#else
/* XXX */
if (!JSJ_IsEnabled())
return NULL;
#endif
top_state = lo_GetTopState(context);
if (top_state == NULL)
@ -604,9 +613,15 @@ LO_EnumerateApplets(MWContext *context, int32 layer_id)
LO_JavaAppStruct *applet;
lo_DocLists *doc_lists;
#ifdef OJI
if (!NPL_IsJVMAndMochaPrefsEnabled())
return NULL;
#else
/* XXX */
if (!JSJ_IsEnabled())
return 0;
return NULL;
#endif
top_state = lo_GetMochaTopState(context);
if (top_state == NULL)
@ -643,9 +658,15 @@ LO_GetEmbedByIndex(MWContext *context, int32 layer_id, uint index)
int i, count;
lo_DocLists *doc_lists;
#ifdef OJI
if (!NPL_IsJVMAndMochaPrefsEnabled())
return NULL;
#else
/* XXX */
if (!JSJ_IsEnabled())
return NULL;
return 0;
#endif
top_state = lo_GetTopState(context);
if (top_state == NULL)
@ -681,9 +702,14 @@ LO_EnumerateEmbeds(MWContext *context, int32 layer_id)
LO_EmbedStruct *embed;
lo_DocLists *doc_lists;
#ifdef OJI
if (!NPL_IsJVMAndMochaPrefsEnabled())
return NULL;
#else
/* XXX */
if (!JSJ_IsEnabled())
return 0;
return NULL;
#endif
top_state = lo_GetMochaTopState(context);
if (top_state == NULL)

Просмотреть файл

@ -55,6 +55,7 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag)
LO_ObjectStruct* object;
PA_Block buff;
int16 type = LO_NONE;
int16 sub_type = LO_NONE;
char* str;
char* pluginName;
@ -191,7 +192,10 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag)
/* It's a Java class */
#ifdef OJI
if (type == LO_NONE)
type = LO_EMBED;
{
type = LO_EMBED;
sub_type = LO_JAVA;
}
else if (type != LO_EMBED) /* XXX */
#else
if (type == LO_NONE)
@ -229,10 +233,19 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag)
PA_LOCK(str, char *, buff);
if ((pluginName = NPL_FindPluginEnabledForType(str)) != NULL)
{
XP_FREE(pluginName);
XP_FREE(pluginName);
/* It's a plug-in */
if (type == LO_NONE)
{
type = LO_EMBED;
#ifdef OJI
#define JAVA_PLUGIN_MIMETYPE "application/x-java-vm"
if (XP_STRCMP(JAVA_PLUGIN_MIMETYPE, str)==0)
{
sub_type = LO_JAVA;
}
#endif
}
else if (type != LO_EMBED)
type = LO_UNKNOWN;
}
@ -328,6 +341,10 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag)
if (type == LO_EMBED)
{
object->lo_element.lo_plugin.type = LO_EMBED;
if(sub_type == LO_JAVA)
{
object->lo_element.lo_plugin.sub_type = LO_JAVA;
}
}
else if (type == LO_BUILTIN)
{
@ -883,20 +900,20 @@ lo_ProcessObjectTag(MWContext* context, lo_DocState* state, PA_Tag* tag, XP_Bool
if (object->lo_element.lo_plugin.type == LO_EMBED)
{
lo_FormatEmbedObject(context,
state,
top->clone_tag,
(LO_EmbedStruct*) object,
FALSE, /* Stream not started */
state,
top->clone_tag,
(LO_EmbedStruct*) object,
FALSE, /* Stream not started */
#ifdef OJI
top->parameters.n,
top->parameters.names,
top->parameters.values);
top->formatted_object = TRUE;
LO_NVList_Init( &top->parameters );
top->parameters.n,
top->parameters.names,
top->parameters.values);
top->formatted_object = TRUE;
LO_NVList_Init( &top->parameters );
#else
top->param_count,
top->param_names,
top->param_values);
top->param_count,
top->param_names,
top->param_values);
top->formatted_object = TRUE;
top->param_count = 0;
top->param_names = NULL;

Просмотреть файл

@ -6794,7 +6794,6 @@ XP_TRACE(("lo_LayoutTag(%d)\n", tag->type));
if(buff)
{
PA_LOCK(str, char *, buff);
lo_AddParam(tag, "DATA", str);
lo_AddParam(tag, "TYPE", JAVA_PLUGIN_MIMETYPE);
PA_UNLOCK(buff);

Просмотреть файл

@ -23,7 +23,7 @@ MODULE = mocha
LIBRARY_NAME = mocha
REQUIRES = lay parse img js style layer applet dbm nspr security \
htmldlgs util jtools pref java libreg softupdt jsdebug netcache network httpurl
htmldlgs util jtools pref caps java libreg softupdt jsdebug netcache network httpurl plugin plugimpl
ifdef MOZ_SECURITY
REQUIRES += jar
@ -68,14 +68,13 @@ include $(DEPTH)/config/rules.mk
DEFINES += -DDLL_SUFFIX=\"$(DLL_SUFFIX)\"
EMBED_CFLAGS = $(CFLAGS) -I$(DEPTH)/lib/plugin
TAINT_CFLAGS = $(CFLAGS) -I$(DEPTH)/lib/libjar -I$(DEPTH)/sun-java/netscape/security/_jri \
-I$(DEPTH)/dist/public/security
ifneq ($(OS_ARCH),OS2)
$(OBJDIR)/lm_embed.o: lm_embed.c
@$(MAKE_OBJDIR)
$(CC) -o $@ -c $(EMBED_CFLAGS) $<
$(CC) -o $@ -c $(CFLAGS) $<
$(OBJDIR)/lm_taint.o: lm_taint.c
@$(MAKE_OBJDIR)
@ -84,7 +83,7 @@ $(OBJDIR)/lm_taint.o: lm_taint.c
else
$(OBJDIR)/lm_embed.o: lm_embed.c
@$(MAKE_OBJDIR)
$(CC) -Fo$@ -c $(EMBED_CFLAGS) $<
$(CC) -Fo$@ -c $(CFLAGS) $<
$(OBJDIR)/lm_taint.o: lm_taint.c
@$(MAKE_OBJDIR)

Просмотреть файл

@ -751,13 +751,14 @@ et_reflect_handler(Reflect_Event * e)
switch(e->type) {
case LM_APPLETS:
#ifdef JAVA
#if defined(JAVA) || defined(OJI)
LM_ReflectApplet(e->ce.context, (LO_JavaAppStruct *) e->lo_ele,
e->pa_tag, e->layer_id, e->index);
#endif
break;
case LM_EMBEDS:
#ifdef JAVA
#if defined(JAVA) || defined(OJI)
LM_ReflectEmbed(e->ce.context, e->lo_ele, e->pa_tag,
e->layer_id, e->index);
#endif
@ -2193,7 +2194,13 @@ et_FinishMochaHandler(JSEvent * e)
lm_crippled_decoder = 0;
}
#ifdef JAVA
#if defined(OJI)
/*
=-= sudu Ask scott about this.
PR_PUBLIC_API(void)
JSJ_DisconnectFromJavaVM(JSJavaVM *);
*/
#elif defined (JAVA)
JSJ_Finish();
#endif
#ifdef DEBUG
@ -2286,7 +2293,11 @@ et_SubEventLoop(QueueStackElement * qse)
/* can't be interrupted yet */
lm_InterruptCurrentOp = JS_FALSE;
#ifdef OJI
LM_LockJS(NULL);
#else
LM_LockJS();
#endif
/* need to interlock the getting of an event with ET_Interrupt */
PR_EnterMonitor(lm_queue_monitor);
pEvent = PR_GetEvent(qse->queue);

Просмотреть файл

@ -27,6 +27,7 @@
#include "net.h"
#include "structs.h"
#include "prthread.h"
#include "prtypes.h"
#include "prmem.h"
#include "ds.h" /* XXX required by htmldlgs.h */
#include "htmldlgs.h"
@ -2883,7 +2884,7 @@ typedef struct {
char* prin;
char* target;
char* risk;
int isCert;
PRBool isCert;
} MozillaEvent_signedAppletPrivileges;
PR_STATIC_CALLBACK(void)
@ -2904,7 +2905,7 @@ et_DestroyEvent_signedAppletPrivileges(MozillaEvent_signedAppletPrivileges* e)
void
ET_PostSignedAppletPrivileges
(MWContext* context, char* prin, char* target, char* risk, int isCert)
(MWContext* context, char* prin, char* target, char* risk, PRBool isCert)
{
MozillaEvent_signedAppletPrivileges* event =
PR_NEW(MozillaEvent_signedAppletPrivileges);

Просмотреть файл

@ -23,10 +23,11 @@
/* Please leave outside of ifdef for windows precompiled headers */
#include "lm.h"
#ifdef JAVA
#if defined(JAVA) || defined(OJI)
#include "xp.h"
#include "layout.h"
#if defined(JAVA)
#include "java.h"
#include "lj.h" /* for LJ_InvokeMethod */
#define IMPLEMENT_netscape_applet_MozillaAppletContext
@ -38,6 +39,10 @@
#include "netscape_applet_MozillaAppletContext.h"
#include "netscape_applet_EmbeddedObjectNatives.h"
#endif
#elif defined(OJI)
#include "np2.h"
#include "jni.h"
#endif /* OJI */
#include "jsjava.h"
#include "jsobj.h"
#include "prlog.h"
@ -192,6 +197,7 @@ lm_GetAppletArray(MochaDecoder *decoder, JSObject *document)
return obj;
}
static JSObject *
lm_ReallyReflectApplet(MWContext *context, LO_JavaAppStruct *lo_applet,
int32 layer_id, uint32 index)
@ -199,10 +205,17 @@ lm_ReallyReflectApplet(MWContext *context, LO_JavaAppStruct *lo_applet,
JSObject *obj;
MochaDecoder *decoder;
JSContext *cx;
#ifdef JAVA
LJAppletData *ad;
jref japplet;
jref javaobject;
#endif
lo_TopState *top_state;
PRHashTable *map;
#ifdef OJI
NPEmbeddedApp* embed;
LO_CommonPluginStruct *lo_embed = (LO_CommonPluginStruct *)lo_applet;
jobject javaobject;
#endif /* OJI */
PR_LOG(Moja, debug, ("really reflect applet 0x%x\n", lo_applet));
@ -212,7 +225,7 @@ lm_ReallyReflectApplet(MWContext *context, LO_JavaAppStruct *lo_applet,
decoder = LM_GetMochaDecoder(context);
if (!decoder)
return NULL;
return NULL;
cx = decoder->js_context;
top_state = lo_GetMochaTopState(context);
@ -228,6 +241,35 @@ lm_ReallyReflectApplet(MWContext *context, LO_JavaAppStruct *lo_applet,
}
}
#ifdef OJI
{
if (! NPL_IsJVMAndMochaPrefsEnabled()) {
return lo_embed->mocha_object = lm_DummyObject;
}
embed = (NPEmbeddedApp*) lo_embed->FE_Data;
if (embed) {
struct nsIPluginInstance *pNPI = NULL;
JNIEnv *jniEnv = NULL;
jsval val;
pNPI = NPL_GetOJIPluginInstance(embed);
javaobject = NPL_GetJavaObject(pNPI);
NPL_Release((struct nsISupports *)pNPI);
#if 0
jniEnv = NPL_EnsureJNIExecEnv(NULL);
obj = JSJ_WrapJavaObject(decoder->js_context,
jniEnv,
javaobject,
(*jniEnv)->GetObjectClass(jniEnv, javaobject));
#else
if (JSJ_ConvertJavaObjectToJSValue(decoder->js_context, javaobject, &val))
obj = JSVAL_TO_OBJECT(val);
#endif
}
}
#else
/* set the element to something bad if we can't get the java obj */
if (!JSJ_IsEnabled()) {
PR_LOG(Moja, debug, ("reflected applet 0x%x as null\n",
@ -241,44 +283,63 @@ lm_ReallyReflectApplet(MWContext *context, LO_JavaAppStruct *lo_applet,
/* MozillaAppletContext.reflectApplet gets the java applet
* object out of a hash table given the AppletData pointer
* as an integer */
if (ad->selector_type != LO_JAVA_SELECTOR_APPLET)
japplet = LJ_InvokeMethod(classEmbeddedObjectNatives,
methodID_netscape_applet_EmbeddedObjectNatives_reflectObject,
ad->docID, ad);
else
japplet = LJ_InvokeMethod(classMozillaAppletContext,
methodID_netscape_applet_MozillaAppletContext_reflectApplet_1,
ad->docID, ad);
if (ad->selector_type != LO_JAVA_SELECTOR_APPLET)
javaobject = LJ_InvokeMethod(classEmbeddedObjectNatives,
methodID_netscape_applet_EmbeddedObjectNatives_reflectObject,
ad->docID, ad);
else
javaobject = LJ_InvokeMethod(classMozillaAppletContext,
methodID_netscape_applet_MozillaAppletContext_reflectApplet_1,
ad->docID, ad);
obj = js_ReflectJObjectToJSObject(decoder->js_context,
(HObject *)javaobject);
}
#endif /* !OJI */
obj = js_ReflectJObjectToJSObject(decoder->js_context,
(HObject *)japplet);
map = lm_GetIdToObjectMap(decoder);
if (map)
PR_HashTableAdd(map,
LM_GET_MAPPING_KEY(LM_APPLETS, layer_id, index),
obj);
/*
lj_mozilla_ee->js_context = saved_context;
*/
PR_LOG(Moja, debug, ("reflected applet 0x%x (java 0x%x) to 0x%x ok\n",
lo_applet, japplet, obj));
if (obj)
lm_java_clasp = JS_GetClass(obj);
return lo_applet->objTag.mocha_object = obj;
} else {
if( obj == NULL )
{
PR_LOG(Moja, warn, ("failed to reflect applet 0x%x\n", lo_applet));
return NULL;
}
map = lm_GetIdToObjectMap(decoder);
if (map)
PR_HashTableAdd(map,
LM_GET_MAPPING_KEY(LM_APPLETS, layer_id, index),
obj);
/*
lj_mozilla_ee->js_context = saved_context;
*/
PR_LOG(Moja, debug, ("reflected applet 0x%x (java 0x%x) to 0x%x ok\n",
lo_applet, javaobject, obj));
if (obj)
lm_java_clasp = JS_GetClass(obj);
return lo_applet->objTag.mocha_object = obj;
}
/* XXX what happens if this is called before java starts up?
* or if java is disabled? */
#if defined(OJI)
static char* getValue(struct lo_NVList* nvlist, const char* name)
{
int i;
char** names = nvlist->names;
char** values = nvlist->values;
for (i = nvlist->n - 1; i >= 0; --i)
if (XP_STRCASECMP(names[i], name) == 0)
return values[i];
return NULL;
}
#endif
JSObject *
LM_ReflectApplet(MWContext *context, LO_JavaAppStruct *applet_data,
PA_Tag * tag, int32 layer_id, uint index)
@ -287,6 +348,9 @@ LM_ReflectApplet(MWContext *context, LO_JavaAppStruct *applet_data,
MochaDecoder *decoder;
JSContext *cx;
char *name;
#ifdef OJI
LO_EmbedStruct *embed = (LO_EmbedStruct *)applet_data;
#endif
obj = applet_data->objTag.mocha_object;
if (obj)
@ -297,12 +361,19 @@ LM_ReflectApplet(MWContext *context, LO_JavaAppStruct *applet_data,
return NULL;
cx = decoder->js_context;
#ifdef OJI
/* this is really skanky, but we don't really have a LO_JavaAppStruct, but instead a LO_EmbedStruct. */
name = getValue(&embed->attributes, "NAME");
if (name != NULL)
name = JS_strdup(cx, name);
#else
/* get the name */
if (applet_data->attr_name) {
name = JS_strdup(cx, (char *) applet_data->attr_name);
} else {
name = 0;
}
#endif
/* Get the document object that will hold this applet */
document = lm_GetDocumentFromLayerId(decoder, layer_id);
@ -364,4 +435,4 @@ LM_ReflectNamedApplet(MWContext *context, lo_NameList *name_rec,
void *lm_java_clasp = NULL;
#endif /* JAVA */
#endif /* !JAVA && !OJI */

Просмотреть файл

@ -38,8 +38,11 @@
#include "libstyle.h"
#include "prthread.h"
#include "np.h"
#ifdef JAVA
#if defined (JAVA)
#include "jsjava.h"
#elif defined (OJI)
#include "jsjava.h"
#include "np2.h"
#endif
#ifndef DOM
@ -233,7 +236,7 @@ doc_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
return JS_TRUE;
case DOC_APPLETS:
#ifdef JAVA
#if defined(JAVA) || defined(OJI)
if (LM_MOJA_OK != ET_InitMoja(context)) {
LO_UnlockLayout();
return JS_FALSE;
@ -252,7 +255,7 @@ doc_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
#endif
case DOC_EMBEDS:
#ifdef JAVA
#if defined(JAVA) || defined(OJI)
if (LM_MOJA_OK != ET_InitMoja(context)) {
LO_UnlockLayout();
return JS_FALSE;
@ -623,7 +626,7 @@ doc_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
return doc_getProperty(cx, obj, id, vp);
}
#ifdef JAVA
#if defined(JAVA) || defined(OJI)
static void
lm_reflect_stuff_eagerly(MWContext * context, int32 layer_id)
{
@ -677,13 +680,12 @@ lm_reflect_stuff_eagerly(MWContext * context, int32 layer_id)
LO_UnlockLayout();
}
#endif /* JAVA */
#endif /* JAVA || OJI*/
PR_STATIC_CALLBACK(JSBool)
doc_list_properties(JSContext *cx, JSObject *obj)
{
#ifdef JAVA
#if defined(JAVA) || defined(OJI)
/* reflect applets eagerly, anything else? */
JSDocument *doc;
MWContext *context;
@ -726,11 +728,24 @@ doc_list_properties(JSContext *cx, JSObject *obj)
if(bDoInitMoja) {
if (LM_MOJA_OK != ET_InitMoja(context))
return JS_FALSE;
#ifdef OJI
{
PRBool jvmMochaPrefsEnabled = PR_FALSE;
if (NPL_IsJVMAndMochaPrefsEnabled() == PR_TRUE) {
jvmMochaPrefsEnabled = PR_TRUE;
}
if (jvmMochaPrefsEnabled == PR_FALSE) {
return JS_TRUE;
}
lm_reflect_stuff_eagerly(context, doc->layer_id);
}
#else
if (JSJ_IsEnabled())
lm_reflect_stuff_eagerly(context, doc->layer_id);
#endif /* !OJI */
}
#endif
#endif /* JAVA || OJI */
return JS_TRUE;
}

Просмотреть файл

@ -25,13 +25,18 @@
/* Please leave outside of ifdef for windows precompiled headers */
#include "lm.h"
#ifdef JAVA
#if defined(JAVA) || defined(OJI)
#include "xp.h"
#include "layout.h"
#include "np.h"
#include "nppriv.h"
#ifdef OJI
#include "jni.h"
#include "np2.h"
#else
#include "jri.h"
#endif
#include "jsjava.h"
#include "jsobj.h"
#include "prlog.h"
@ -177,6 +182,8 @@ lm_GetEmbedArray(MochaDecoder *decoder, JSObject *document)
return obj;
}
/* this calls MozillaEmbedContext to reflect the embed by
* calling into mocha... yow! */
static JSObject *
@ -213,13 +220,26 @@ lm_ReallyReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed,
}
}
#ifdef OJI
{
PRBool jvmMochaPrefsEnabled = PR_FALSE;
if (NPL_IsJVMAndMochaPrefsEnabled() == PR_TRUE) {
jvmMochaPrefsEnabled = PR_TRUE;
}
if (jvmMochaPrefsEnabled == PR_FALSE) {
PR_LOG(Moja, debug, ("reflected embed 0x%x as null\n",
lo_embed));
return lo_embed->objTag.mocha_object = lm_DummyObject;
}
}
#else
/* set the element to something bad if we can't get the java obj */
if (!JSJ_IsEnabled()) {
PR_LOG(Moja, debug, ("reflected embed 0x%x as null\n",
lo_embed));
return lo_embed->objTag.mocha_object = lm_DummyObject;
}
#endif /* !OJI */
embed = (NPEmbeddedApp*) lo_embed->objTag.FE_Data;
if (embed) {
np_data *ndata = (np_data*) embed->np_data;
@ -235,11 +255,28 @@ lm_ReallyReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed,
return NULL;
}
instance = ndata->instance;
if (!instance) return NULL;
if (!instance) return NULL;
jembed = npn_getJavaPeer(instance->npp);
#ifdef OJI
{
#if 0
JNIEnv *jniEnv = NULL;
jniEnv = NPL_EnsureJNIExecEnv(NULL);
obj = JSJ_WrapJavaObject(decoder->js_context,
jniEnv,
jembed,
(*jniEnv)->GetObjectClass(jniEnv, jembed));
#else
jsval val;
if (JSJ_ConvertJavaObjectToJSValue(decoder->js_context, jembed, &val))
obj = JSVAL_TO_OBJECT(val);
#endif
}
#else
obj = js_ReflectJObjectToJSObject(decoder->js_context,
(HObject *)jembed);
#endif /* !OJI */
PR_LOG(Moja, debug, ("reflected embed 0x%x (java 0x%x) to 0x%x ok\n",
lo_embed, jembed, obj));
@ -293,7 +330,7 @@ LM_ReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed,
break;
}
}
#endif
#endif /* !OJI */
/* Get the document object that will hold this applet */
document = lm_GetDocumentFromLayerId(decoder, layer_id);
@ -347,4 +384,4 @@ LM_ReflectNamedEmbed(MWContext *context, lo_NameList *name_rec,
return NULL;
}
#endif /* JAVA */
#endif /* JAVA || OJI */

Просмотреть файл

@ -35,11 +35,16 @@
#include "private/pprthred.h"
#endif
#if defined (JAVA)
#include "jri.h"
#include "jriext.h"
#ifdef JAVA
#include "java.h"
#elif defined (OJI)
#include "jni.h"
#include "np2.h"
#include "jsjava.h"
#endif
#include "prefapi.h"
#include "libi18n.h"
#include "intl_csi.h"
@ -123,7 +128,11 @@ MochaDecoder *lm_crippled_decoder;
JSContext *lm_crippled_context; /* exported to jsStubs.c */
PRThread *lm_InterpretThread; /* interpreter now in its own thread */
#ifdef OJI
JNIEnv *lm_JSEnv; /* Java env for lm_InterpretThread */
#elif defined(JAVA)
JRIEnv *lm_JSEnv; /* Java env for lm_InterpretThread */
#endif /* ! (OJI || JAVA) */
PREventQueue *lm_InterpretQueue; /* for "normal" event messages */
PREventQueue *lm_PriorityQueue; /* for stop and death messages */
@ -531,7 +540,7 @@ lm_new_decoder(JSRuntime *rt, JSClass *clasp)
XP_DELETE(decoder);
return NULL;
}
decoder->forw_count = 1;
decoder->js_context = cx;
JS_SetBranchCallback(cx, lm_BranchCallback);
@ -655,10 +664,6 @@ lm_PrefChangedFunc(const char *pref, void *data)
static JSBool mochaInited = JS_FALSE;
/* nix, where is this */
extern void
JSJ_InitContext(JSContext *context, JSObject *obj);
/*
* create the mocha thread, event queues, and stream converters
*/
@ -687,7 +692,19 @@ lm_ReallyInitMocha(void)
lm_crippled_decoder = lm_new_decoder(lm_runtime, &lm_dummy_class);
lm_crippled_context = lm_crippled_decoder->js_context;
#ifdef JAVA
#ifdef OJI
{
PRBool jvmMochaPrefsEnabled = PR_FALSE;
if (NPL_IsJVMAndMochaPrefsEnabled() == PR_TRUE) {
jvmMochaPrefsEnabled = NPL_JSJInit();
}
if (jvmMochaPrefsEnabled == PR_TRUE)
{
JSJ_InitJSContext(lm_crippled_context, JS_GetGlobalObject(lm_crippled_context), NULL);
}
}
#elif defined (JAVA)
LJ_JSJ_Init();
/*
@ -819,8 +836,16 @@ LM_InitMoja()
* called on the moz thread we can do it the easy way */
if (lm_moja_initialized != LM_MOJA_UNINITIALIZED)
return lm_moja_initialized;
#if defined(OJI)
lm_JSEnv = NPL_EnsureJNIExecEnv(lm_InterpretThread);
if (lm_JSEnv == NULL) {
lm_moja_initialized = LM_MOJA_JAVA_FAILED;
return lm_moja_initialized;
}
#ifdef JAVA
lm_moja_initialized = LM_MOJA_OK;
#elif defined(JAVA)
/* initialize the java env associated with the mocha thread */
lm_JSEnv = LJ_EnsureJavaEnv(lm_InterpretThread);
if (lm_JSEnv == NULL) {
@ -908,8 +933,13 @@ LM_WaitForJSLock(void)
/*
* Wait until we get the JSLock
*/
#ifdef OJI
JSBool PR_CALLBACK
LM_LockJS(char **errp)
#else
void PR_CALLBACK
LM_LockJS()
#endif
{
PRThread *t = PR_CurrentThread();
@ -942,6 +972,9 @@ LM_LockJS()
}
lm_owner_count++;
PR_ExitMonitor(lm_owner_mon);
#ifdef OJI
return( PR_TRUE );
#endif
}
/*

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -39,7 +39,10 @@
#include "libimg.h" /* Image Library public API. */
#include "prthread.h"
#ifdef JAVA
#if defined(JAVA)
#include "jsjava.h"
#elif defined (OJI)
#include "np2.h"
#include "jsjava.h"
#endif
@ -3222,7 +3225,20 @@ lm_InitWindowContent(MochaDecoder *decoder)
if (!JS_InitStandardClasses(cx, obj))
return JS_FALSE;
#ifdef JAVA
#if defined(OJI)
{
PRBool jvmMochaPrefsEnabled = PR_FALSE;
if (NPL_IsJVMAndMochaPrefsEnabled() == PR_TRUE) {
jvmMochaPrefsEnabled = NPL_JSJInit();
}
if ( (jvmMochaPrefsEnabled == PR_TRUE)
&&(!JSJ_InitJSContext(cx, obj, NULL))
)
{
return JS_FALSE;
}
}
#elif defined(JAVA)
if (JSJ_IsEnabled() && !JSJ_InitContext(cx, obj))
return JS_FALSE;
#endif

Двоичные данные
lib/libmocha/macbuild/LibMocha.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -1,46 +1 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../..
MODULE = plug
LIBRARY_NAME = plug
CSRCS = npassoc.c
CPPSRCS = nsplugin.cpp
EXPORTS = nppg.h npupp.h nsIPlug.h nsILCPlg.h npglue.h nppriv.h
REQUIRES = lay layer js style applet nspr dbm img util java pref xpcom netcnvts oji
ifeq ($(subst /,_,$(shell uname -s)),OS2)
CPPSRCS = npwplat.cpp
REQUIRES += xp libfont os2font jtools
endif
CPPSRCS += npglue.cpp
include $(DEPTH)/config/rules.mk
ifeq ($(subst /,_,$(shell uname -s)),OS2)
INCLUDES += -I$(DEPTH)/cmd/os2fe/nfc/include -I$(DEPTH)/cmd/os2fe -I$(DEPTH)/cmd/winfe
endif
INCLUDES += -I.
$(LIBRARY): $(OBJS)
Use the version in mozilla/modules/plugin/src now.

Просмотреть файл

@ -1,163 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "npapi.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#if defined(__sun)
# include "sunos4.h"
#endif /* __sun */
#ifdef DEBUG
extern int np_debug;
static void
nptrace (const char* message, ...)
{
int len;
char buf[2048];
va_list stack;
va_start (stack, message);
len = vsprintf (buf, message, stack);
va_end (stack);
len = strlen(buf);
fwrite("\t\tjp: ", 1, 6, stderr);
fwrite(buf, 1, len, stderr);
if (buf[len-1] != '\n')
fwrite("\n", 1, 1, stderr);
}
#define NPTRACE(l,t) { if(np_debug>l){nptrace t;}}
#else
#define NPTRACE(l,t) {}
#endif
#include "npupp.h"
extern NPNetscapeFuncs *np_nfuncs;
static int inum = 1;
static NPError
javap_new(void *j, NPP npp, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
{
if(mode==NP_EMBED) {
NPTRACE(0,("new embed"));
} else {
NPTRACE(0,("new full"));
}
return 0;
}
static NPError
javap_destroy(NPP instance, NPSavedData **save)
{
NPTRACE(0,("destroy"));
return 0;
}
static NPError
javap_setwindow(NPP instance, NPWindow *window)
{
NPTRACE(0,("setwindow x %d y %d w %d h %d", window->x, window->y, window->width, window->height));
return 0;
}
static NPError
javap_newstream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
{
NPTRACE(0,("new stream"));
switch(inum)
{
case 1:
{
NPByteRange a, b;
*stype = NP_SEEK;
a.offset = 0;
a.length = 60;
b.offset = 252525;
b.length = 10;
a.next = &b;
b.next = 0;
np_nfuncs->requestread(stream, &a);
}
break;
case 2:
*stype = NP_ASFILE;
break;
case 3:
{
np_nfuncs->geturl(instance, "about:", "_current");
}
break;
}
inum++;
np_nfuncs->status(instance, "wow");
return 0;
}
static int32
javap_write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer)
{
char buf[64];
NPTRACE(0,("got %d bytes at %d", len, offset));
return 0;
strncpy(buf, (const char *)buffer, 63);
buf[63]=0;
NPTRACE(0,("\"%s\"", (char *)buf));
fwrite(buffer, len, 1, stream->pdata);
return 0;
}
static NPError
javap_closestream(NPP instance, NPStream *stream, NPError reason)
{
NPTRACE(0,("sclose"));
pclose(stream->pdata);
return 0;
}
static void
javap_asfile(NPP instance, NPStream *stream, const char *fname)
{
NPTRACE(0,("fname: \"%s\"", fname));
}
NPPluginFuncs javap_funcs = {
javap_new,
javap_destroy,
javap_setwindow,
javap_newstream,
javap_closestream,
javap_asfile,
NULL,
javap_write,
NULL,
NULL
};
NPPluginFuncs *j_pfncs = &javap_funcs;

Просмотреть файл

@ -20,20 +20,20 @@ DEPTH = ..
include $(DEPTH)/config/config.mk
DIRS = \
DIRS = \
libhook \
libreg \
libreg \
libpref \
libutil \
libimg \
libfont \
libreg \
rdf \
xml \
schedulr \
zlib \
li \
progress \
zlib \
li \
progress \
plugin \
$(NULL)
ifndef MOZ_SECURITY
@ -50,9 +50,9 @@ endif
ifdef EDITOR
ifdef JAVA_OR_OJI
ifdef JAVA_OR_NSJVM # change later to JAVA_OR_OJI
DIRS += edtplug
endif # JAVA_OR_OJI
endif # JAVA_OR_NSJVM
DIRS += spellchk
endif # EDITOR

Просмотреть файл

@ -16,6 +16,9 @@
#
DEPTH = ../../..
ifdef JAVA_OR_NSJVM
DIRS = netscape
else
endif
include $(DEPTH)/config/rules.mk

Просмотреть файл

@ -20,6 +20,16 @@ IGNORE_MANIFEST=1
#
DEPTH=..\..\..
!ifdef NSJVM
DIRS=netscape
!else
export::
!endif
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -19,7 +19,7 @@ DEPTH = ../../..
include $(DEPTH)/config/config.mk
ifndef JAVA_OR_OJI
ifndef JAVA_OR_NSJVM
LOCAL_JMC_SUBDIR = ../jmcgen/include
endif

Просмотреть файл

@ -20,7 +20,7 @@ IGNORE_MANIFEST=1
DEPTH=..\..\..
!include $(DEPTH)\config\config.mak
!ifndef JAVA_OR_OJI
!ifndef JAVA_OR_NSJVM
LOCAL_JMC_SUBDIR = ..\jmcgen\include
!endif
@ -32,7 +32,7 @@ EXPORTS=$(JMC_GEN_DIR)\Mnfdoer.h $(JMC_GEN_DIR)\Mnff.h \
$(JMC_GEN_DIR)\Mnffbu.h $(JMC_GEN_DIR)\Mnffmi.h \
$(JMC_GEN_DIR)\Mnffp.h $(JMC_GEN_DIR)\Mnfrc.h $(JMC_GEN_DIR)\Mnfrf.h \
$(JMC_GEN_DIR)\Mnfstrm.h $(JMC_GEN_DIR)\Mnfdlm.h
!if !defined(JAVA_OR_OJI)
!if !defined(JAVA_OR_NSJVM)
EXPORTS=$(EXPORTS) $(JMC_GEN_DIR)\Mwinfp.h
!endif

Просмотреть файл

@ -19,7 +19,7 @@ DEPTH = ../../..
include $(DEPTH)/config/config.mk
ifndef JAVA_OR_OJI
ifndef JAVA_OR_NSJVM
LOCAL_JMC_SUBDIR = ../jmcgen/include
LOCAL_JMC_SRC_SUBDIR = ../jmcgen/src
endif
@ -64,7 +64,7 @@ SDK_TARGET = producer-sdk
SDK_NAME = FontProducer-sdk-v1.0
SDK_DIR = $(OBJDIR)/$(SDK_TARGET)
ifndef JAVA_OR_OJI
ifndef JAVA_OR_NSJVM
export::
@echo "Copying JMC src files from $(LOCAL_JMC_SRC_SUBDIR)/*.c to cwd"
@for FILE in $(LOCAL_JMC_SRC_SUBDIR)/*.c ;\

Просмотреть файл

@ -65,14 +65,14 @@ LINCS=-I$(XPDIST)\public\libfont -I$(XPDIST)\public\java \
-I$(XPDIST)\public\htmldlgs -I$(XPDIST)\public\security
!endif
!if !defined (JAVA_OR_OJI)
!if !defined (JAVA_OR_NSJVM)
LOCAL_JMC_SUBDIR = ..\jmcgen\include
LOCAL_JMC_SRC_SUBDIR = ..\jmcgen\src
!endif
!include $(DEPTH)\config\rules.mak
!if !defined (JAVA_OR_OJI)
!if !defined (JAVA_OR_NSJVM)
export::
@echo +++ make: Copying JMC src files from $(LOCAL_JMC_SRC_SUBDIR)/*.c to cwd
-for %f in ($(LOCAL_JMC_SRC_SUBDIR)\*.c) do $(MAKE_INSTALL) %f .

Просмотреть файл

@ -80,7 +80,7 @@ extern "C" int
wfWrite(NET_StreamClass *stream, const unsigned char *str, int32 len)
{
struct stream_data *data = (struct stream_data *) stream->data_object;
return ((int)nfstrm_Write((nfstrm *)data->fpStream, (char *)str, (jint)len, NULL));
return ((int)nfstrm_Write((nfstrm *)data->fpStream, (jbyte *)str, (jint)len, NULL));
}
#ifndef XP_OS2

Просмотреть файл

@ -20,7 +20,7 @@ DEPTH=../..
#// DIRS - There are subdirectories to process
#//
#//------------------------------------------------------------------------
DIRS= src
DIRS= public src
#//------------------------------------------------------------------------
#//

Двоичные данные
modules/oji/macbuild/oji.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -20,7 +20,7 @@ DEPTH=..\..
#// DIRS - There are subdirectories to process
#//
#//------------------------------------------------------------------------
DIRS= src
DIRS= public src
#//------------------------------------------------------------------------
#//

Просмотреть файл

@ -25,3 +25,6 @@ nsIJVMManager.h
nsIJVMPlugin.h
nsIJVMPluginInstance.h
nsIJVMPluginTagInfo.h
nsISymantecDebugger.h
nsISymantecDebugManager.h
nsjvm.h

Просмотреть файл

@ -43,8 +43,8 @@ public:
// Find or create a JRIEnv for the current thread.
// Returns NULL if an error occurs.
NS_IMETHOD_(JRIEnv*)
GetJRIEnv(void) = 0;
NS_IMETHOD_(nsrefcnt)
GetJRIEnv(JRIEnv* *result) = 0;
// This method must be called when the caller is done using the JRIEnv.
// This decrements a refcount associated with it may free it.

Просмотреть файл

@ -41,19 +41,19 @@ public:
// QueryInterface on nsIJVMPlugin to get this.
NS_IMETHOD_(void)
NS_IMETHOD
ShowConsole(void) = 0;
NS_IMETHOD_(void)
NS_IMETHOD
HideConsole(void) = 0;
NS_IMETHOD_(PRBool)
IsConsoleVisible(void) = 0;
NS_IMETHOD
IsConsoleVisible(PRBool *result) = 0;
// Prints a message to the Java console. The encodingName specifies the
// encoding of the message, and if NULL, specifies the default platform
// encoding.
NS_IMETHOD_(void)
NS_IMETHOD
Print(const char* msg, const char* encodingName = NULL) = 0;
};

Просмотреть файл

@ -29,20 +29,18 @@
#ifndef nsIJVMManager_h___
#define nsIJVMManager_h___
#include "nsplugin.h"
#include "nsISupports.h"
////////////////////////////////////////////////////////////////////////////////
#define NPJVM_MIME_TYPE "application/x-java-vm" // XXX application/java
enum nsJVMError {
nsJVMError_Ok = nsPluginError_NoError,
nsJVMError_Base = 0x1000,
nsJVMError_InternalError = nsJVMError_Base,
nsJVMError_NoClasses,
nsJVMError_WrongClasses,
nsJVMError_JavaError,
nsJVMError_NoDebugger
enum {
NS_JVM_ERROR_BASE = NS_ERROR_BASE + 0x10000,
NS_JVM_ERROR_NO_CLASSES,
NS_JVM_ERROR_WRONG_CLASSES,
NS_JVM_ERROR_JAVA_ERROR,
NS_JVM_ERROR_NO_DEBUGGER
};
////////////////////////////////////////////////////////////////////////////////
@ -55,12 +53,6 @@ class nsIJVMPlugin;
class nsIJVMManager : public nsISupports {
public:
// This method may be called by the JVM to indicate that an error has
// occurred, e.g. that the JVM has failed or is shutting down spontaneously.
// This allows the browser to clean up any JVM-specific state.
NS_IMETHOD_(void)
NotifyJVMStatusChange(nsJVMError error) = 0;
};
#define NS_IJVMMANAGER_IID \

Просмотреть файл

@ -38,11 +38,17 @@
// to implement in order to implement a Java virtual machine plugin.
struct nsJVMInitArgs {
jint version;
PRUint32 version;
const char* classpathAdditions; // appended to the JVM's classpath
// other fields may be added here for version numbers beyond 0x00010000
};
#define nsJVMInitArgs_Version 0x00010000
/**
* nsJVMInitArgs_Version is the current version number for the nsJVMInitArgs
* struct specified above. The nsVersionOk macro should be used when comparing
* a supplied nsJVMInitArgs struct against this version.
*/
#define nsJVMInitArgs_Version 0x00010000L
class nsIJVMPlugin : public nsIPlugin {
public:
@ -52,43 +58,43 @@ public:
// Note that calling this method is distinctly separate from
// initializing the nsIJVMPlugin object (done by the Initialize
// method).
NS_IMETHOD_(nsJVMError)
NS_IMETHOD
StartupJVM(nsJVMInitArgs* initargs) = 0;
// This method us used to stop the Java virtual machine.
// It tears down any global state necessary to host Java programs.
// The fullShutdown flag specifies whether the browser is quitting
// (PR_TRUE) or simply whether the JVM is being shut down (PR_FALSE).
NS_IMETHOD_(nsJVMError)
ShutdownJVM(PRBool fullShutdown) = 0;
NS_IMETHOD
ShutdownJVM(PRBool fullShutdown = PR_FALSE) = 0;
// Causes the JVM to append a new directory to its classpath.
// If the JVM doesn't support this operation, an error is returned.
NS_IMETHOD_(nsJVMError)
NS_IMETHOD
AddToClassPath(const char* dirPath) = 0;
// Causes the JVM to remove a directory from its classpath.
// If the JVM doesn't support this operation, an error is returned.
NS_IMETHOD_(nsJVMError)
NS_IMETHOD
RemoveFromClassPath(const char* dirPath) = 0;
// Returns the current classpath in use by the JVM.
NS_IMETHOD_(const char*)
GetClassPath(void) = 0;
NS_IMETHOD
GetClassPath(const char* *result) = 0;
NS_IMETHOD_(nsIPluginInstance*)
GetPluginInstance(jobject javaObject) = 0;
NS_IMETHOD
GetPluginInstance(jobject javaObject, nsIPluginInstance* *result) = 0;
NS_IMETHOD_(nsIPluginInstance*)
GetPluginInstance(JNIEnv* jenv) = 0;
NS_IMETHOD
GetPluginInstance(JNIEnv* jenv, nsIPluginInstance* *result) = 0;
NS_IMETHOD_(JavaVM *)
GetJavaVM(void) = 0;
NS_IMETHOD
GetJavaVM(JavaVM* *result) = 0;
// Find or create a JNIEnv for the current thread.
// Returns NULL if an error occurs.
NS_IMETHOD_(JNIEnv*)
GetJNIEnv(void) = 0;
NS_IMETHOD_(nsrefcnt)
GetJNIEnv(JNIEnv* *result) = 0;
// This method must be called when the caller is done using the JNIEnv.
// This decrements a refcount associated with it may free it.

Просмотреть файл

@ -39,15 +39,11 @@ public:
// This method is called when LiveConnect wants to find the Java object
// associated with this plugin instance, e.g. the Applet or JavaBean object.
NS_IMETHOD_(jobject)
GetJavaObject(void) = 0;
NS_IMETHOD
GetJavaObject(jobject *result) = 0;
/* =-= sudu: Ask Eric Bina, what is GetText used for in layform.c
Check to see if this should be more general api applicaple to
applets/beans and plugins.
*/
NS_IMETHOD_(const char*)
GetText(void) = 0;
NS_IMETHOD
GetText(const char* *result) = 0;
};
#define NS_IJVMPLUGININSTANCE_IID \

Просмотреть файл

@ -39,20 +39,20 @@
class nsIJVMPluginTagInfo : public nsISupports {
public:
NS_IMETHOD_(const char *)
GetCode(void) = 0;
NS_IMETHOD
GetCode(const char* *result) = 0;
NS_IMETHOD_(const char *)
GetCodeBase(void) = 0;
NS_IMETHOD
GetCodeBase(const char* *result) = 0;
NS_IMETHOD_(const char *)
GetArchive(void) = 0;
NS_IMETHOD
GetArchive(const char* *result) = 0;
NS_IMETHOD_(const char *)
GetName(void) = 0;
NS_IMETHOD
GetName(const char* *result) = 0;
NS_IMETHOD_(PRBool)
GetMayScript(void) = 0;
NS_IMETHOD
GetMayScript(PRBool *result) = 0;
};

Просмотреть файл

@ -38,7 +38,7 @@
class nsISymantecDebugManager : public nsISupports {
public:
NS_IMETHOD_(PRBool)
NS_IMETHOD
SetDebugAgentPassword(PRInt32 pwd) = 0;
};

Просмотреть файл

@ -44,7 +44,7 @@ enum nsSymantecDebugPort {
class nsISymantecDebugger : public nsISupports {
public:
NS_IMETHOD_(nsJVMError)
NS_IMETHOD
StartDebugger(nsSymantecDebugPort port) = 0;
};

Просмотреть файл

@ -29,6 +29,7 @@
#ifndef nsjvm_h___
#define nsjvm_h___
#include "nsplugin.h"
#include "nsIJRIPlugin.h"
#include "nsIJVMConsole.h"
#include "nsIJVMManager.h"

Просмотреть файл

@ -3,5 +3,3 @@
#
jvmmgr.h
nsjvm.h
nsscd.h

Просмотреть файл

@ -6,19 +6,18 @@
DEPTH = ../../..
MODULE = oji
MODULE = ojiimpl
ifdef MOZ_OJI
LIBRARY_NAME = oji
CPPSRCS = jvmmgr.cpp \
jvmpeer.cpp \
scd.cpp
REQUIRES = img java js lay layer plug pref style util xpcom
REQUIRES = img java js lay layer plugin plugimpl pref style util xpcom raptor oji
endif # MOZ_OJI
EXPORTS = nsjvm.h jvmmgr.h nsscd.h
EXPORTS = jvmmgr.h
include $(DEPTH)/config/rules.mk

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -19,54 +19,34 @@
#ifndef jvmmgr_h___
#define jvmmgr_h___
#include "xp_core.h" // include first because of Bool problem
#include "nsjvm.h"
#include "nsscd.h"
#include "nsAgg.h"
#include "jsjava.h"
#include "nsVector.h"
class nsIPluginTagInfo2;
class nsSymantecDebugManager;
enum nsJVMStatus {
nsJVMStatus_Enabled, // but not Running
nsJVMStatus_Disabled, // explicitly disabled
nsJVMStatus_Running, // enabled and started
nsJVMStatus_Failed // enabled but failed to start
};
////////////////////////////////////////////////////////////////////////////////
// JVMMgr is the interface to the JVM manager that the browser sees. All
// files that want to include java services should include this header file.
// NPIJVMPluginManager is the more limited interface what the JVM plugin sees.
// nsIJVMManager is the more limited interface what the JVM plugin sees.
class JVMMgr : public NPIJVMPluginManager {
class nsJVMMgr : public nsIJVMManager {
public:
NS_DECL_AGGREGATED
////////////////////////////////////////////////////////////////////////////
// from NPIJVMPluginManager:
// ====> These are usually only called by the plugin, not the browser...
NS_IMETHOD_(void)
BeginWaitCursor(void);
NS_IMETHOD_(void)
EndWaitCursor(void);
NS_IMETHOD_(const char*)
GetProgramPath(void);
NS_IMETHOD_(const char*)
GetTempDirPath(void);
NS_IMETHOD_(nsresult)
GetFileName(const char* fn, FileNameType type,
char* resultBuf, PRUint32 bufLen);
NS_IMETHOD_(nsresult)
NewTempFileName(const char* prefix, char* resultBuf, PRUint32 bufLen);
NS_IMETHOD_(PRBool)
HandOffJSLock(PRThread* oldOwner, PRThread* newOwner);
NS_IMETHOD_(void)
ReportJVMError(JVMEnv* env, JVMError err);
NS_IMETHOD_(PRBool)
SupportsURLProtocol(const char* protocol);
// from nsIJVMManager:
////////////////////////////////////////////////////////////////////////////
// JVMMgr specific methods:
@ -76,277 +56,150 @@ public:
static NS_METHOD
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
NPIJVMPlugin* GetJVM(void);
nsIJVMPlugin* GetJVMPlugin(void);
// Unlike the NPIJVMPlugin::StartupJVM, this version handles putting
// Unlike the nsIJVMPlugin::StartupJVM, this version handles putting
// up any error dialog:
JVMStatus StartupJVM(void);
JVMStatus ShutdownJVM(PRBool fullShutdown = PR_TRUE);
nsJVMStatus StartupJVM(void);
nsJVMStatus ShutdownJVM(PRBool fullShutdown = PR_FALSE);
nsJVMStatus GetJVMStatus(void);
void SetJVMEnabled(PRBool enabled);
PRBool GetJVMEnabled(void);
void SetJVMEnabled(PRBool enable);
JVMStatus GetJVMStatus(void);
nsresult AddToClassPath(const char* dirPath);
PRBool JSJInit();
PRBool IsJVMAndMochaPrefsEnabled(void);
JSJavaVM* GetJSJavaVM() { return fJSJavaVM; }
void SetProgramPath(const char* path) { fProgramPath = path; }
protected:
JVMMgr(nsISupports* outer);
virtual ~JVMMgr(void);
nsJVMMgr(nsISupports* outer);
virtual ~nsJVMMgr(void);
void EnsurePrefCallbackRegistered(void);
const char* GetJavaErrorString(JVMEnv* env);
const char* GetJavaErrorString(JRIEnv* env);
NPIJVMPlugin* fJVM;
PRUint16 fWaiting;
void* fOldCursor;
const char* fProgramPath;
nsIJVMPlugin* fJVM;
nsJVMStatus fStatus;
PRBool fRegisteredJavaPrefChanged;
nsISupports* fDebugManager;
JSJavaVM * fJSJavaVM;
nsVector* fClassPathAdditions;
};
////////////////////////////////////////////////////////////////////////////////
// Symantec Debugger Stuff
class nsSymantecDebugManager : public NPISymantecDebugManager {
class nsSymantecDebugManager : public nsISymantecDebugManager {
public:
NS_DECL_AGGREGATED
NS_IMETHOD_(PRBool)
NS_IMETHOD
SetDebugAgentPassword(PRInt32 pwd);
static NS_METHOD
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr,
JVMMgr* jvmMgr);
nsJVMMgr* jvmMgr);
protected:
nsSymantecDebugManager(nsISupports* outer, JVMMgr* jvmMgr);
nsSymantecDebugManager(nsISupports* outer, nsJVMMgr* jvmMgr);
virtual ~nsSymantecDebugManager(void);
JVMMgr* fJVMMgr;
nsJVMMgr* fJVMMgr;
};
////////////////////////////////////////////////////////////////////////////////
// JVMInstancePeer: The browser makes one of these when it sees an APPLET or
// nsJVMPluginTagInfo: The browser makes one of these when it sees an APPLET or
// appropriate OBJECT tag.
class JVMInstancePeer : public NPIJVMPluginInstancePeer {
class nsJVMPluginTagInfo : public nsIJVMPluginTagInfo {
public:
NS_DECL_AGGREGATED
////////////////////////////////////////////////////////////////////////////
// Methods specific to NPIPluginInstancePeer:
// from nsIJVMPluginTagInfo:
// ====> These are usually only called by the plugin, not the browser...
NS_IMETHOD_(NPIPlugin*)
GetClass(void);
NS_IMETHOD
GetCode(const char* *result);
// (Corresponds to NPP_New's MIMEType argument.)
NS_IMETHOD_(nsMIMEType)
GetMIMEType(void);
NS_IMETHOD
GetCodeBase(const char* *result);
// (Corresponds to NPP_New's mode argument.)
NS_IMETHOD_(NPPluginType)
GetMode(void);
NS_IMETHOD
GetArchive(const char* *result);
// Get a ptr to the paired list of attribute names and values,
// returns the length of the array.
//
// Each name or value is a null-terminated string.
NS_IMETHOD_(NPPluginError)
GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values);
NS_IMETHOD
GetName(const char* *result);
// Get the value for the named attribute. Returns null
// if the attribute was not set.
NS_IMETHOD_(const char*)
GetAttribute(const char* name);
// Get a ptr to the paired list of parameter names and values,
// returns the length of the array.
//
// Each name or value is a null-terminated string.
NS_IMETHOD_(NPPluginError)
GetParameters(PRUint16& n, const char*const*& names, const char*const*& values);
// Get the value for the named parameter. Returns null
// if the parameter was not set.
NS_IMETHOD_(const char*)
GetParameter(const char* name);
// Get the complete text of the HTML tag that was
// used to instantiate this plugin
NS_IMETHOD_(const char*)
GetTagText(void);
// Get the type of the HTML tag that was used ot instantiate this
// plugin. Currently supported tags are EMBED, OBJECT and APPLET.
//
NS_IMETHOD_(NPTagType)
GetTagType(void);
NS_IMETHOD_(NPIPluginManager*)
GetPluginManager(void);
// (Corresponds to NPN_GetURL and NPN_GetURLNotify.)
// notifyData: When present, URLNotify is called passing the notifyData back
// to the client. When NULL, this call behaves like NPN_GetURL.
// New arguments:
// altHost: An IP-address string that will be used instead of the host
// specified in the URL. This is used to prevent DNS-spoofing attacks.
// Can be defaulted to NULL meaning use the host in the URL.
// referrer:
// forceJSEnabled: Forces JavaScript to be enabled for 'javascript:' URLs,
// even if the user currently has JavaScript disabled.
NS_IMETHOD_(NPPluginError)
GetURL(const char* url, const char* target, void* notifyData = NULL,
const char* altHost = NULL, const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE);
// (Corresponds to NPN_PostURL and NPN_PostURLNotify.)
// notifyData: When present, URLNotify is called passing the notifyData back
// to the client. When NULL, this call behaves like NPN_GetURL.
// New arguments:
// altHost: An IP-address string that will be used instead of the host
// specified in the URL. This is used to prevent DNS-spoofing attacks.
// Can be defaulted to NULL meaning use the host in the URL.
// referrer:
// forceJSEnabled: Forces JavaScript to be enabled for 'javascript:' URLs,
// even if the user currently has JavaScript disabled.
// postHeaders: A string containing post headers.
// postHeadersLength: The length of the post headers string.
NS_IMETHOD_(NPPluginError)
PostURL(const char* url, const char* target, PRUint32 bufLen,
const char* buf, PRBool file, void* notifyData = NULL,
const char* altHost = NULL, const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 postHeadersLength = 0, const char* postHeaders = NULL);
// (Corresponds to NPN_NewStream.)
NS_IMETHOD_(NPPluginError)
NewStream(nsMIMEType type, const char* target,
NPIPluginManagerStream* *result);
// (Corresponds to NPN_Status.)
NS_IMETHOD_(void)
ShowStatus(const char* message);
// (Corresponds to NPN_UserAgent.)
NS_IMETHOD_(const char*)
UserAgent(void);
// (Corresponds to NPN_GetValue.)
NS_IMETHOD_(NPPluginError)
GetValue(NPPluginManagerVariable variable, void *value);
// (Corresponds to NPN_SetValue.)
NS_IMETHOD_(NPPluginError)
SetValue(NPPluginVariable variable, void *value);
// (Corresponds to NPN_InvalidateRect.)
NS_IMETHOD_(void)
InvalidateRect(nsRect *invalidRect);
// (Corresponds to NPN_InvalidateRegion.)
NS_IMETHOD_(void)
InvalidateRegion(nsRegion invalidRegion);
// (Corresponds to NPN_ForceRedraw.)
NS_IMETHOD_(void)
ForceRedraw(void);
// New top-level window handling calls for Mac:
NS_IMETHOD_(void)
RegisterWindow(void* window);
NS_IMETHOD_(void)
UnregisterWindow(void* window);
// Menu ID allocation calls for Mac:
NS_IMETHOD_(PRInt16)
AllocateMenuID(PRBool isSubmenu);
NS_IMETHOD
GetMayScript(PRBool *result);
////////////////////////////////////////////////////////////////////////////
// Methods specific to NPIJVMPluginInstancePeer:
NS_IMETHOD_(const char *)
GetCode(void);
NS_IMETHOD_(const char *)
GetCodeBase(void);
NS_IMETHOD_(const char *)
GetArchive(void);
NS_IMETHOD_(PRBool)
GetMayScript(void);
NS_IMETHOD_(const char *)
GetID(void);
// XXX reload method?
// Returns a unique id for the current document on which the
// plugin is displayed.
NS_IMETHOD_(PRUint32)
GetDocumentID(void);
NS_IMETHOD_(const char*)
GetDocumentBase(void);
NS_IMETHOD_(INTL_CharSetInfo)
GetDocumentCharSetInfo(void);
NS_IMETHOD_(const char*)
GetAlignment(void);
NS_IMETHOD_(PRUint32)
GetWidth(void);
NS_IMETHOD_(PRUint32)
GetHeight(void);
NS_IMETHOD_(PRUint32)
GetBorderVertSpace(void);
NS_IMETHOD_(PRUint32)
GetBorderHorizSpace(void);
NS_IMETHOD_(PRBool)
Tickle(void);
////////////////////////////////////////////////////////////////////////////
// Methods specific to JVMPluginInstancePeer:
// Methods specific to nsJVMPluginInstancePeer:
// ====> From here on are things only called by the browser, not the plugin...
static NS_METHOD
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr,
MWContext* cx, LO_CommonPluginStruct* lo);
nsIPluginTagInfo2* info);
protected:
JVMInstancePeer(nsISupports* outer, MWContext* cx, LO_CommonPluginStruct* lo);
virtual ~JVMInstancePeer(void);
nsJVMPluginTagInfo(nsISupports* outer, nsIPluginTagInfo2* info);
virtual ~nsJVMPluginTagInfo(void);
// Instance Variables:
NPIPluginInstancePeer* fPluginInstancePeer;
MWContext* fContext;
LO_CommonPluginStruct* fLayoutElement;
PRUint32 fUniqueID;
char* fSimulatedCodebase;
nsIPluginTagInfo2* fPluginTagInfo;
char* fSimulatedCodebase;
char* fSimulatedCode;
};
////////////////////////////////////////////////////////////////////////////////
// Convenience Routines
PR_BEGIN_EXTERN_C
// Returns the JVM manager. You must do a Release on the
// pointer returned when you're done with it.
extern "C" PR_EXTERN(JVMMgr*)
PR_EXTERN(nsJVMMgr*)
JVM_GetJVMMgr(void);
// Returns true if java is enabled, and has not failed to load.
PR_EXTERN(PRBool)
JVM_IsJVMAvailable(void);
PR_EXTERN(nsresult)
JVM_AddToClassPath(const char* dirPath);
PR_EXTERN(void)
JVM_ShowConsole(void);
PR_EXTERN(void)
JVM_HideConsole(void);
PR_EXTERN(PRBool)
JVM_IsConsoleVisible(void);
PR_EXTERN(void)
JVM_ToggleConsole(void);
PR_EXTERN(void)
JVM_PrintToConsole(const char* msg);
PR_EXTERN(void)
JVM_StartDebugger(void);
PR_EXTERN(JavaVM*)
JVM_GetJavaVM(void);
PR_EXTERN(JNIEnv*)
JVM_GetJNIEnv(void);
PR_END_EXTERN_C
////////////////////////////////////////////////////////////////////////////////
#endif /* jvmmgr_h___ */

Просмотреть файл

@ -35,7 +35,6 @@ PDBFILE=$(LIBNAME).pdb
#//------------------------------------------------------------------------
OBJS = .\$(OBJDIR)\jvmmgr.obj \
.\$(OBJDIR)\jvmpeer.obj \
.\$(OBJDIR)\scd.obj
#//------------------------------------------------------------------------
@ -54,7 +53,7 @@ LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
#//
#//------------------------------------------------------------------------
LINCS= $(LINCS) -I_jri -I$(DEPTH)/lib/plugin \
LINCS= $(LINCS) -I_jri \
#
# For Win16 the following include directories are copied into
# ns/dist/public/win16
@ -68,22 +67,24 @@ LINCS= $(LINCS) -I_jri -I$(DEPTH)/lib/plugin \
-I$(PUBLIC)/security \
-I$(PUBLIC)/pref \
-I$(PUBLIC)/xpcom \
-I$(PUBLIC)/raptor \
-I$(PUBLIC)/plugin \
-I$(PUBLIC)/oji \
-I$(PUBLIC)/plugimpl \
!endif
-I$(DEPTH)/lib/layout \
-I$(DEPTH)/lib/libstyle \
-I$(DEPTH)/lib/libjar \
-I$(DEPTH)/lib/plugin \
$(NULL)
CSRCS = jvmmgr.cpp \
jvmpeer.cpp \
scd.cpp
!endif # MOZ_OJI
MODULE = oji
MODULE = ojiimpl
EXPORTS = nsjvm.h jvmmgr.h nsscd.h
EXPORTS = jvmmgr.h
#//------------------------------------------------------------------------
#//
@ -96,14 +97,12 @@ LCFLAGS=$(LCFLAGS) ^
$(JAVA_DEFINES)
!if "$(MOZ_BITS)" == "32"
PUBLIC_HEADER_DIR=$(PUBLIC)\oji
PUBLIC_HEADER_DIR=$(PUBLIC)\ojiimpl
!else
PUBLIC_HEADER_DIR=$(PUBLIC)\win16
!endif
export::
$(MAKE_INSTALL) nsjvm.h $(PUBLIC_HEADER_DIR)
$(MAKE_INSTALL) nsscd.h $(PUBLIC_HEADER_DIR)
$(MAKE_INSTALL) jvmmgr.h $(PUBLIC_HEADER_DIR)
!ifdef MOZ_OJI

Просмотреть файл

@ -1,274 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
////////////////////////////////////////////////////////////////////////////////
// NETSCAPE JAVA VM PLUGIN EXTENSIONS
//
// This interface allows a Java virtual machine to be plugged into
// Communicator to implement the APPLET tag and host applets.
//
// Note that this is the C++ interface that the plugin sees. The browser
// uses a specific implementation of this, nsJVMPlugin, found in navjvm.h.
////////////////////////////////////////////////////////////////////////////////
#ifndef nsjvm_h___
#define nsjvm_h___
#include "nsIPlug.h"
#include "jri.h" // XXX for now
#include "jni.h"
#include "prthread.h"
#include "libi18n.h" // XXX way too much browser dependence
#include "intl_csi.h"
////////////////////////////////////////////////////////////////////////////////
#define NPJVM_MIME_TYPE "application/x-java-vm"
enum JVMError {
JVMError_Ok = NPPluginError_NoError,
JVMError_Base = 0x1000,
JVMError_InternalError = JVMError_Base,
JVMError_NoClasses,
JVMError_WrongClasses,
JVMError_JavaError,
JVMError_NoDebugger
};
#ifdef XP_MAC
typedef JNIEnv JVMEnv;
#else
typedef JRIEnv JVMEnv;
#endif
////////////////////////////////////////////////////////////////////////////////
// Java VM Plugin Manager
// This interface defines additional entry points that are available
// to JVM plugins for browsers that support JVM plugins.
class NPIJVMPlugin;
class NPIJVMPluginManager : public nsISupports {
public:
NS_IMETHOD_(void)
BeginWaitCursor(void) = 0;
NS_IMETHOD_(void)
EndWaitCursor(void) = 0;
NS_IMETHOD_(const char*)
GetProgramPath(void) = 0;
NS_IMETHOD_(const char*)
GetTempDirPath(void) = 0;
enum FileNameType { SIGNED_APPLET_DBNAME, TEMP_FILENAME };
NS_IMETHOD_(nsresult)
GetFileName(const char* fn, FileNameType type,
char* resultBuf, PRUint32 bufLen) = 0;
NS_IMETHOD_(nsresult)
NewTempFileName(const char* prefix, char* resultBuf, PRUint32 bufLen) = 0;
NS_IMETHOD_(PRBool)
HandOffJSLock(PRThread* oldOwner, PRThread* newOwner) = 0;
NS_IMETHOD_(void)
ReportJVMError(JVMEnv* env, JVMError err) = 0; // XXX JNIEnv*
NS_IMETHOD_(PRBool)
SupportsURLProtocol(const char* protocol) = 0;
};
#define NP_IJVMPLUGINMANAGER_IID \
{ /* a1e5ed50-aa4a-11d1-85b2-00805f0e4dfe */ \
0xa1e5ed50, \
0xaa4a, \
0x11d1, \
{0x85, 0xb2, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
}
////////////////////////////////////////////////////////////////////////////////
enum JVMStatus {
JVMStatus_Enabled, // but not Running
JVMStatus_Disabled, // explicitly disabled
JVMStatus_Running, // enabled and started
JVMStatus_Failed // enabled but failed to start
};
////////////////////////////////////////////////////////////////////////////////
// Java VM Plugin Interface
// This interface defines additional entry points that a plugin developer needs
// to implement in order to implement a Java virtual machine plugin.
class NPIJVMPlugin : public NPIPlugin {
public:
// QueryInterface may be used to obtain a JRIEnv or JNIEnv
// from an NPIPluginManager.
// (Corresponds to NPN_GetJavaEnv.)
NS_IMETHOD_(JVMStatus)
StartupJVM(void) = 0;
NS_IMETHOD_(JVMStatus)
ShutdownJVM(PRBool fullShutdown = PR_TRUE) = 0;
NS_IMETHOD_(PRBool)
GetJVMEnabled(void) = 0;
NS_IMETHOD_(void)
SetJVMEnabled(PRBool enable) = 0;
NS_IMETHOD_(JVMStatus)
GetJVMStatus(void) = 0;
// Find or create a JNIEnv for the specified thread. The thread
// parameter may be NULL indicating the current thread.
// XXX JNIEnv*
NS_IMETHOD_(JVMEnv*)
EnsureExecEnv(PRThread* thread = NULL) = 0;
NS_IMETHOD_(void)
AddToClassPath(const char* dirPath) = 0;
NS_IMETHOD_(void)
ShowConsole(void) = 0;
NS_IMETHOD_(void)
HideConsole(void) = 0;
NS_IMETHOD_(PRBool)
IsConsoleVisible(void) = 0;
NS_IMETHOD_(void)
PrintToConsole(const char* msg) = 0;
NS_IMETHOD_(const char*)
GetClassPath(void) = 0;
NS_IMETHOD_(const char*)
GetSystemJARPath(void) = 0;
};
#define NP_IJVMPLUGIN_IID \
{ /* da6f3bc0-a1bc-11d1-85b1-00805f0e4dfe */ \
0xda6f3bc0, \
0xa1bc, \
0x11d1, \
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
}
////////////////////////////////////////////////////////////////////////////////
// Java VM Plugin Instance Interface
class NPIJVMPluginInstance : public NPIPluginInstance {
public:
// This method is called when LiveConnect wants to find the Java object
// associated with this plugin instance, e.g. the Applet or JavaBean object.
NS_IMETHOD_(jobject)
GetJavaObject(void) = 0;
};
////////////////////////////////////////////////////////////////////////////////
// Java VM Plugin Instance Peer Interface
// This interface provides additional hooks into the plugin manager that allow
// a plugin to implement the plugin manager's Java virtual machine.
enum NPTagAttributeName {
NPTagAttributeName_Width,
NPTagAttributeName_Height,
NPTagAttributeName_Classid,
NPTagAttributeName_Code,
NPTagAttributeName_Codebase,
NPTagAttributeName_Docbase,
NPTagAttributeName_Archive,
NPTagAttributeName_Name,
NPTagAttributeName_MayScript
};
class NPIJVMPluginInstancePeer : public NPIPluginInstancePeer {
public:
// XXX reload method?
// Returns a unique id for the current document on which the
// plugin is displayed.
NS_IMETHOD_(PRUint32)
GetDocumentID(void) = 0;
NS_IMETHOD_(const char *)
GetCode(void) = 0;
NS_IMETHOD_(const char *)
GetCodeBase(void) = 0;
NS_IMETHOD_(const char *)
GetArchive(void) = 0;
NS_IMETHOD_(const char *)
GetID(void) = 0;
NS_IMETHOD_(PRBool)
GetMayScript(void) = 0;
NS_IMETHOD_(const char*)
GetDocumentBase(void) = 0;
NS_IMETHOD_(INTL_CharSetInfo)
GetDocumentCharSetInfo(void) = 0;
NS_IMETHOD_(const char*)
GetAlignment(void) = 0;
NS_IMETHOD_(PRUint32)
GetWidth(void) = 0;
NS_IMETHOD_(PRUint32)
GetHeight(void) = 0;
NS_IMETHOD_(PRUint32)
GetBorderVertSpace(void) = 0;
NS_IMETHOD_(PRUint32)
GetBorderHorizSpace(void) = 0;
NS_IMETHOD_(PRBool)
Tickle(void) = 0;
};
#define NP_IJVMPLUGININSTANCEPEER_IID \
{ /* 27b42df0-a1bd-11d1-85b1-00805f0e4dfe */ \
0x27b42df0, \
0xa1bd, \
0x11d1, \
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
}
////////////////////////////////////////////////////////////////////////////////
#endif /* nsjvm_h___ */

Просмотреть файл

@ -23,11 +23,11 @@
#include "jvmmgr.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kISymantecDebugManagerIID, NP_ISYMANTECDEBUGMANAGER_IID);
static NS_DEFINE_IID(kISymantecDebugManagerIID, NS_ISYMANTECDEBUGMANAGER_IID);
NS_IMPL_AGGREGATED(nsSymantecDebugManager);
nsSymantecDebugManager::nsSymantecDebugManager(nsISupports* outer, JVMMgr* jvmMgr)
nsSymantecDebugManager::nsSymantecDebugManager(nsISupports* outer, nsJVMMgr* jvmMgr)
: fJVMMgr(jvmMgr)
{
NS_INIT_AGGREGATED(outer);
@ -50,7 +50,7 @@ nsSymantecDebugManager::AggregatedQueryInterface(const nsIID& aIID, void** aInst
NS_METHOD
nsSymantecDebugManager::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr,
JVMMgr* jvmMgr)
nsJVMMgr* jvmMgr)
{
if (outer && !aIID.Equals(kISupportsIID))
return NS_NOINTERFACE; // XXX right error?
@ -66,7 +66,7 @@ nsSymantecDebugManager::Create(nsISupports* outer, const nsIID& aIID, void* *aIn
extern "C" HWND FindNavigatorHiddenWindow(void);
#endif
NS_METHOD_(PRBool)
NS_METHOD
nsSymantecDebugManager::SetDebugAgentPassword(PRInt32 pwd)
{
#if defined(XP_PC) && defined(_WIN32)
@ -86,9 +86,9 @@ nsSymantecDebugManager::SetDebugAgentPassword(PRInt32 pwd)
ReleaseSemaphore(sem, 1, NULL);
CloseHandle(sem);
}
return PR_TRUE;
return NS_OK;
#else
return PR_FALSE;
return NS_ERROR_FAILURE;
#endif
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше