Closed Bug 151777 Opened 22 years ago Closed 11 years ago

Java has dependency on PRFilePrivate layout

Categories

(Core Graveyard :: Java: OJI, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: colin, Assigned: margaret.chan)

Details

Wan-Teh made a change to the layout of NSPR's PRFileDesc structure, and suddenly
java applets wouldn't work any more in Mozilla. I tracked it down to some OJI
code in Java which has a dependancy on the layout of PRFileDesc. In Sun's Java
1.3-1 the code in question is:

ext/plugin/oji-plugin/src/motif/navig5/util5.cpp

/* Return the internal actual FD for a PR file descriptor. This
   depends on the structure of PRFileDesc which is a dependancy on the
   internals of mozilla */
int
PRFileDesc_To_FD(PRFileDesc* pr) {
    return (pr)->secret->md.osfd;
}

Java is usually built and shipped independant of Mozilla. With this OJI code, a
rebuild and new release of OJI is required on every platform each time the
offset of md changes inside the PRFileDesc structure. Clearly this is not
desireable.

Instead Wan-Teh says: If the OJI code *really* needs to grab the fd from a
PRFileDesc, it should call PR_FileDesc2NativeHandle() to do that.  That
semi-private function is declared in the header file "private/pprio.h".
Bug 97475 is the NSPR change which exposed this problem.
Correction: it's the layout of NSPR's *PRFilePrivate* structure
that Java has dependency on.  PRFilePrivate is an opaque
structure defined in the private header file "primpl.h".
NSPR clients should not include "primpl.h" or depend on the
layout of any structures defined in it.

NSPR's PRFileDesc structure is public.
Summary: Java has dependancy on PRFileDesc layout → Java has dependancy on PRFilePrivate layout
You can fix this bug by deleting PRFileDesc_To_FD and calling
PR_FileDesc2NativeHandle instead.

You should also remove all instances of
#include "primpl.h"
from the source tree.
Re-assign to Margaret.
Assignee: joe.chou → margaret.chan
QA Contact: pmac → petersen
Summary: Java has dependancy on PRFilePrivate layout → Java has dependency on PRFilePrivate layout
Product: Core → Core Graveyard
Mass-closing bugs in the "OJI" component: OJI plugin integration was replaced with npruntime long ago, and these bugs appear to be irrelevant now. If there is in fact a real bug that remains, please file it new in the "Core" product, component "Plug-ins".
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.