diff --git a/mozilla/build/mac/NSCrossProductDefines.h b/mozilla/build/mac/NSCrossProductDefines.h index ee02b7d867b..db73d299d32 100644 --- a/mozilla/build/mac/NSCrossProductDefines.h +++ b/mozilla/build/mac/NSCrossProductDefines.h @@ -29,6 +29,9 @@ #define NETSCAPE 1 #define OTUNIXERRORS 1 /* We want OpenTransport error codes */ +#define OJI 1 +#define MOCHA 1 + /* This compiles in heap dumping utilities and other good stuff for developers -- maybe we only want it in for a special SDK diff --git a/mozilla/cmd/macfe/applevnt/mplugin.cp b/mozilla/cmd/macfe/applevnt/mplugin.cp index d8a068dbbdc..517904755fa 100644 --- a/mozilla/cmd/macfe/applevnt/mplugin.cp +++ b/mozilla/cmd/macfe/applevnt/mplugin.cp @@ -1406,10 +1406,10 @@ void CPluginView::EmbedSize(LO_EmbedStruct* embed_struct, SDimension16 hyperSize // If the plug-in is hidden, set the width and height to zero and // set a flag indicating that we are hidden. // - if (embed_struct->ele_attrmask & LO_ELE_HIDDEN) + if (embed_struct->objTag.ele_attrmask & LO_ELE_HIDDEN) { - embed_struct->width = 0; - embed_struct->height = 0; + embed_struct->objTag.width = 0; + embed_struct->objTag.height = 0; fHidden = true; Hide(); StartIdling(); // Visible plug-ins start idling in EmbedDisplay @@ -1438,8 +1438,8 @@ void CPluginView::EmbedSize(LO_EmbedStruct* embed_struct, SDimension16 hyperSize SBooleanRect binding = {true, true, true, true}; SetFrameBinding(binding); - embed_struct->width = hyperSize.width; - embed_struct->height = hyperSize.height; + embed_struct->objTag.width = hyperSize.width; + embed_struct->objTag.height = hyperSize.height; // // Remember an offset for the view to @@ -1456,8 +1456,8 @@ void CPluginView::EmbedSize(LO_EmbedStruct* embed_struct, SDimension16 hyperSize fVerticalOffset = 0; } - ResizeImageTo(embed_struct->width, embed_struct->height, false); - ResizeFrameTo(embed_struct->width, embed_struct->height, false); + ResizeImageTo(embed_struct->objTag.width, embed_struct->objTag.height, false); + ResizeFrameTo(embed_struct->objTag.width, embed_struct->objTag.height, false); // // NOTE: The position set here is not really valid because the x and y in @@ -1466,8 +1466,8 @@ void CPluginView::EmbedSize(LO_EmbedStruct* embed_struct, SDimension16 hyperSize // We go ahead and position ourselves anyway just so we have a superview // and location initially. // - Int32 x = embed_struct->x + embed_struct->x_offset + fHorizontalOffset; - Int32 y = embed_struct->y + embed_struct->y_offset + fVerticalOffset; + Int32 x = embed_struct->objTag.x + embed_struct->objTag.x_offset + fHorizontalOffset; + Int32 y = embed_struct->objTag.y + embed_struct->objTag.y_offset + fVerticalOffset; PlaceInSuperImageAt(x, y, false); // @@ -1490,8 +1490,8 @@ void CPluginView::EmbedDisplay(LO_EmbedStruct* embed_struct, Boolean isPrinting) // if (fPositioned == false) { - Int32 x = embed_struct->x + embed_struct->x_offset + fHorizontalOffset; - Int32 y = embed_struct->y + embed_struct->y_offset + fVerticalOffset; + Int32 x = embed_struct->objTag.x + embed_struct->objTag.x_offset + fHorizontalOffset; + Int32 y = embed_struct->objTag.y + embed_struct->objTag.y_offset + fVerticalOffset; PlaceInSuperImageAt(x, y, false); if (fWindowed) Show(); @@ -1517,19 +1517,19 @@ void CPluginView::EmbedDisplay(LO_EmbedStruct* embed_struct, Boolean isPrinting) SPoint32 imagePoint; Int32 x, y; - if (IsVisible() && (embed_struct->ele_attrmask & LO_ELE_INVISIBLE)) + if (IsVisible() && (embed_struct->objTag.ele_attrmask & LO_ELE_INVISIBLE)) Hide(); CalcPortFrameRect(frameRect); GetSuperView()->PortToLocalPoint(topLeft(frameRect)); GetSuperView()->LocalToImagePoint(topLeft(frameRect), imagePoint); - x = embed_struct->x + embed_struct->x_offset + fHorizontalOffset; - y = embed_struct->y + embed_struct->y_offset + fVerticalOffset; + x = embed_struct->objTag.x + embed_struct->objTag.x_offset + fHorizontalOffset; + y = embed_struct->objTag.y + embed_struct->objTag.y_offset + fVerticalOffset; if ((imagePoint.h != x) || (imagePoint.v != y)) PlaceInSuperImageAt(x, y, true); - if (!IsVisible() && !(embed_struct->ele_attrmask & LO_ELE_INVISIBLE)) + if (!IsVisible() && !(embed_struct->objTag.ele_attrmask & LO_ELE_INVISIBLE)) Show(); } // For a windowless plug-in, this is where the plug-in actually draws. @@ -1551,7 +1551,7 @@ void CPluginView::EmbedDisplay(LO_EmbedStruct* embed_struct, Boolean isPrinting) void CPluginView::EmbedCreate(MWContext* context, LO_EmbedStruct* embed_struct) { fEmbedStruct = embed_struct; - fApp = (NPEmbeddedApp*) embed_struct->FE_Data; + fApp = (NPEmbeddedApp*) embed_struct->objTag.FE_Data; Boolean printing = (context->type == MWContextPrint); // @@ -1569,7 +1569,7 @@ void CPluginView::EmbedCreate(MWContext* context, LO_EmbedStruct* embed_struct) if (printing) fOriginalView = (CPluginView*) fApp->fe_data; fApp->fe_data = this; - embed_struct->FE_Data = fApp; + embed_struct->objTag.FE_Data = fApp; if (!printing) fApp->wdata = GetNPWindow(); NPError err = NPL_EmbedStart(context, embed_struct, fApp); @@ -1585,7 +1585,7 @@ void CPluginView::EmbedCreate(MWContext* context, LO_EmbedStruct* embed_struct) if (fApp == NULL) { delete this; - embed_struct->FE_Data = NULL; + embed_struct->objTag.FE_Data = NULL; } } @@ -1934,8 +1934,8 @@ void CPluginView::ResetDrawRect() parentView->CalcElementPosition((LO_Element *)fEmbedStruct, frame); // Convert it into image coordinates - localPoint.h = frame.left - (fEmbedStruct->x + fEmbedStruct->x_offset); - localPoint.v = frame.top - (fEmbedStruct->y + fEmbedStruct->y_offset); + localPoint.h = frame.left - (fEmbedStruct->objTag.x + fEmbedStruct->objTag.x_offset); + localPoint.v = frame.top - (fEmbedStruct->objTag.y + fEmbedStruct->objTag.y_offset); portPoint = localPoint; localPoint.h -= portOrigin.h; localPoint.v -= portOrigin.v; diff --git a/mozilla/cmd/macfe/central/mprint.cp b/mozilla/cmd/macfe/central/mprint.cp index 16164e8c17f..350d5534c8c 100644 --- a/mozilla/cmd/macfe/central/mprint.cp +++ b/mozilla/cmd/macfe/central/mprint.cp @@ -590,7 +590,7 @@ void CPrintHTMLView::DisplayEmbed( case epmDisplay: if (FocusDraw() && BelongsOnPage (inEmbedStruct)) { - NPEmbeddedApp* app = (NPEmbeddedApp*) inEmbedStruct->FE_Data; + NPEmbeddedApp* app = (NPEmbeddedApp*) inEmbedStruct->objTag.FE_Data; CPluginView* view = (CPluginView*) app->fe_data; view->EmbedDisplay(inEmbedStruct, true); } diff --git a/mozilla/cmd/macfe/gui/CHTMLView.cp b/mozilla/cmd/macfe/gui/CHTMLView.cp index a0c6c720831..306f3173e22 100644 --- a/mozilla/cmd/macfe/gui/CHTMLView.cp +++ b/mozilla/cmd/macfe/gui/CHTMLView.cp @@ -1806,7 +1806,7 @@ PRBool CHTMLView::HandleEmbedEvent( LO_EmbedStruct* inEmbed, CL_Event* inEvent) { - NPEmbeddedApp* app = (NPEmbeddedApp*) inEmbed->FE_Data; + NPEmbeddedApp* app = (NPEmbeddedApp*) inEmbed->objTag.FE_Data; if (app && app->fe_data) { CPluginView* view = (CPluginView*) app->fe_data; @@ -5548,7 +5548,7 @@ void CHTMLView::GetEmbedSize( LO_EmbedStruct* inEmbedStruct, NET_ReloadMethod /* inReloadMethod */) { - if (inEmbedStruct->FE_Data == NULL) // Creating plugin from scratch + if (inEmbedStruct->objTag.FE_Data == NULL) // Creating plugin from scratch { Try_ { @@ -5562,19 +5562,19 @@ void CHTMLView::GetEmbedSize( } Catch_(inErr) { - inEmbedStruct->FE_Data = NULL; + inEmbedStruct->objTag.FE_Data = NULL; } EndCatch_ } else - NPL_EmbedSize((NPEmbeddedApp*) inEmbedStruct->FE_Data); + NPL_EmbedSize((NPEmbeddedApp*) inEmbedStruct->objTag.FE_Data); } void CHTMLView::FreeEmbedElement( LO_EmbedStruct* inEmbedStruct) { NPL_EmbedDelete(*mContext, inEmbedStruct); - inEmbedStruct->FE_Data = NULL; + inEmbedStruct->objTag.FE_Data = NULL; } void CHTMLView::CreateEmbedWindow( @@ -5665,9 +5665,9 @@ void CHTMLView::RestoreEmbedWindow( if (XP_OK_ASSERT(inEmbeddedApp->np_data)) { LO_EmbedStruct* embed_struct = ((np_data*) inEmbeddedApp->np_data)->lo_struct; if (XP_OK_ASSERT(embed_struct)) { - xp = embed_struct->x + embed_struct->x_offset + xp = embed_struct->objTag.x + embed_struct->objTag.x_offset /* - CONTEXT_DATA(*mContext)->document_x */; - yp = embed_struct->y + embed_struct->y_offset + yp = embed_struct->objTag.y + embed_struct->objTag.y_offset /* - CONTEXT_DATA(*mContext)->document_y */; } } @@ -5702,7 +5702,7 @@ void CHTMLView::DisplayEmbed( int /* inLocation */, LO_EmbedStruct* inEmbedStruct) { - NPEmbeddedApp* app = (NPEmbeddedApp*) inEmbedStruct->FE_Data; + NPEmbeddedApp* app = (NPEmbeddedApp*) inEmbedStruct->objTag.FE_Data; if (app && app->fe_data) { if ( !FocusDraw() ) diff --git a/mozilla/cmd/winfe/mkfiles32/mozilla.mak b/mozilla/cmd/winfe/mkfiles32/mozilla.mak index c87f9e168cc..08fbf14dd64 100644 --- a/mozilla/cmd/winfe/mkfiles32/mozilla.mak +++ b/mozilla/cmd/winfe/mkfiles32/mozilla.mak @@ -337,7 +337,8 @@ LINK_LIBS= \ $(DIST)\lib\libplc21.lib \ $(DIST)\lib\libmsgc21.lib \ !endif -!ifdef MOZ_JAVA +!if defined(MOZ_OJI) +!elseif defined(MOZ_JAVA) $(DIST)\lib\jrt32$(VERSION_NUMBER).lib \ !else $(DIST)\lib\libsjs32.lib \ @@ -355,10 +356,13 @@ LINK_LIBS= \ $(DIST)\lib\libreg32.lib \ !ifdef MOZ_JAVA $(DIST)\lib\libapplet32.lib \ +!endif +!ifdef MOZ_OJI + $(DIST)\lib\oji32.lib \ !endif $(DIST)\lib\hook.lib \ #!if defined(EDITOR) -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI $(DIST)\lib\edtplug.lib \ !endif #!endif @@ -386,7 +390,7 @@ LINK_LIBS= \ $(DIST)\lib\libnsc32.lib \ !endif $(DIST)\lib\img32.lib \ -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI # XXX remove later $(DIST)\lib\jmc.lib \ !endif $(DIST)\lib\font.lib \ @@ -414,7 +418,7 @@ LINK_LIBS= \ !endif !endif $(DIST)\lib\unicvt32.lib \ -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI $(DIST)\lib\softup32.lib \ !ifndef NO_SECURITY $(DIST)\lib\jsl32.lib \ @@ -560,7 +564,10 @@ CDISTINCLUDES1= \ /I$(DIST)\include \ /I$(XPDIST)\public\dbm \ /I$(XPDIST)\public\java \ -!ifdef MOZ_JAVA +!if defined(MOZ_OJI) + /I$(XPDIST)\public\oji \ + /I$(XPDIST)\public\npj \ +!elseif defined(MOZ_JAVA) /I$(XPDIST)\public\applet \ /I$(XPDIST)\public\softupdt \ !endif @@ -594,7 +601,7 @@ CDISTINCLUDES3= \ /I$(XPDIST)\public\schedulr \ /I$(XPDIST)\public\xpcom \ #!ifdef EDITOR -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI /I$(XPDIST)\public\edtplug \ !endif /I$(XPDIST)\public\spellchk \ @@ -607,6 +614,7 @@ CDISTINCLUDES3= \ /I$(DIST)\include \ /I$(XPDIST)\public\img \ /I$(XPDIST)\public\jtools \ +!else !endif /I$(XPDIST)\public \ /I$(XPDIST)\public\coreincl \ @@ -640,7 +648,9 @@ CDEFINES=/DXP_PC /Dx386 /D_WINDOWS /D_X86_ \ /DNSPR20 \ !endif !endif -!if defined(MOZ_JAVA) +!if defined(MOZ_OJI) + /DOJI \ +!elseif defined(MOZ_JAVA) /DJAVA \ !endif /DMOZILLA_CLIENT @@ -653,7 +663,9 @@ CDEFINES=$(CDEFINES) $(MOZ_LITENESS_FLAGS) # or the RC command line will be too long RCDEFINES=/DRESOURCE_STR /D_WINDOWS \ -!if defined(MOZ_JAVA) +!if defined(MOZ_OJI) + /DOJI \ +!elseif defined(MOZ_JAVA) /DJAVA \ !endif !if "$(MOZ_BITS)" == "32" @@ -1068,7 +1080,7 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\modules\libimg\src\xbm.c $(DEPTH)\modules\libimg\src\ipng.c $(DEPTH)\modules\libimg\src\png_png.c -!if defined(MOZ_JAVA) +!if defined(JAVA_OR_OJI) # XXX remove later $(DEPTH)\sun-java\jtools\src\jmc.c !endif !endif @@ -1553,6 +1565,16 @@ $(GENDIR)\config.rc: $(DEPTH)\modules\libpref\src\init\config.js $(GENDIR)\config.rc !endif +!if defined(MOZ_OJI) +JAVAPARENT_DIR = $(OUTDIR)\plugins +JAVABIN_DIR = $(OUTDIR)\plugins\nsjvm +JAVACLS_DIR = $(OUTDIR)\plugins\nsjvm +!elseif defined(MOZ_JAVA) +JAVAPARENT_DIR = $(OUTDIR)\java +JAVABIN_DIR = $(OUTDIR)\java\bin +JAVACLS_DIR = $(OUTDIR)\java\classes +!endif + # # Installation of the executable directory, support dlls and java # @@ -1634,41 +1656,46 @@ install: \ !IF EXIST($(DIST)\bin\xpcom32.dll) $(OUTDIR)\xpcom32.dll \ !ENDIF -!IF EXIST($(DIST)\bin\jrt32$(VERSION_NUMBER).dll) - $(OUTDIR)\jrt32$(VERSION_NUMBER).dll \ -!ENDIF !IF EXIST($(DIST)\bin\uni3200.dll) $(OUTDIR)\uni3200.dll \ !ENDIF -!IF EXIST($(DIST)\bin\awt32$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\awt32$(VERSION_NUMBER).dll \ -!ENDIF !if defined(MOZ_TRACKGDI) !IF EXIST($(DIST)\bin\trackgdi.dll) $(OUTDIR)\trackgdi.dll \ !ENDIF !endif +!if defined(JAVA_OR_OJI) +!IF EXIST($(DIST)\bin\npj32$(VERSION_NUMBER).dll) + $(JAVABIN_DIR)\npj32$(VERSION_NUMBER).dll \ +!ENDIF +!IF EXIST($(DIST)\bin\jrt32$(VERSION_NUMBER).dll) + $(JAVABIN_DIR)\jrt32$(VERSION_NUMBER).dll \ +!ENDIF +!IF EXIST($(DIST)\bin\awt32$(VERSION_NUMBER).dll) + $(JAVABIN_DIR)\awt32$(VERSION_NUMBER).dll \ +!ENDIF !IF EXIST($(DIST)\bin\jbn32$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\jbn32$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\jbn32$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\jdb32$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\jdb32$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\jdb32$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\mm32$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\mm32$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\mm32$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\jit32$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\jit32$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\jit32$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\jpw32$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\jpw32$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\jpw32$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\con32$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\con32$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\con32$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\zpw32$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\zpw32$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\zpw32$(VERSION_NUMBER).dll \ !ENDIF +!endif # JAVA_OR_OJI !IF EXIST($(DEPTH)\cmd\winfe\nstdfp32.dll) $(OUTDIR)\dynfonts\nstdfp32.dll \ !ENDIF @@ -1686,29 +1713,32 @@ install: \ !ENDIF !endif !ELSE -!IFDEF MOZ_JAVA +!IFDEF JAVA_OR_OJI +!IF EXIST($(DIST)\bin\npj16$(VERSION_NUMBER).dll) + $(JAVABIN_DIR)\npj16$(VERSION_NUMBER).dll \ +!ENDIF !IF EXIST($(DIST)\bin\jrt16$(VERSION_NUMBER).dll) - $(OUTDIR)\jrt16$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\jrt16$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\awt16$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\awt16$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\awt16$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\jpw16$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\jpw16$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\jpw16$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\con16$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\con16$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\con16$(VERSION_NUMBER).dll \ !ENDIF !IF EXIST($(DIST)\bin\zpw16$(VERSION_NUMBER).dll) - $(OUTDIR)\java\bin\zpw16$(VERSION_NUMBER).dll \ + $(JAVABIN_DIR)\zpw16$(VERSION_NUMBER).dll \ !ENDIF #!IF EXIST($(DIST)\bin\jbn16$(VERSION_NUMBER).dll) -# $(OUTDIR)\java\bin\jbn16$(VERSION_NUMBER).dll \ +# $(JAVABIN_DIR)\jbn16$(VERSION_NUMBER).dll \ #!ENDIF #!IF EXIST($(DIST)\bin\jdb16$(VERSION_NUMBER).dll) -# $(OUTDIR)\java\bin\jdb16$(VERSION_NUMBER).dll \ +# $(JAVABIN_DIR)\jdb16$(VERSION_NUMBER).dll \ #!ENDIF -!ENDIF +!ENDIF # JAVA_OR_OJI !ifndef NSPR20 !IF EXIST($(DIST)\bin\pr16$(VERSION_NUMBER).dll) $(OUTDIR)\pr16$(VERSION_NUMBER).dll \ @@ -1760,8 +1790,8 @@ install: \ !ENDIF !endif !ENDIF -!if defined(MOZ_JAVA) - $(OUTDIR)\java\classes\$(JAR_NAME) \ +!if defined(JAVA_OR_OJI) + $(JAVACLS_DIR)\$(JAR_NAME) \ !endif $(OUTDIR)\netscape.cfg \ !if defined(DEATH_TO_POLICY_FILES) @@ -1830,7 +1860,7 @@ REBASE=rebase.exe !if exist(rebase.yes) !if [for %i in ($(OUTDIR)\*.dll) do $(QUIET)echo %i >> rebase.lst] !endif -!if [for %i in ($(OUTDIR)\java\bin\*.dll) do $(QUIET)echo %i >> rebase.lst] +!if [for %i in ($(JAVABIN_DIR)\*.dll) do $(QUIET)echo %i >> rebase.lst] !endif !if [for %i in ($(OUTDIR)\spellchk\*.dll) do $(QUIET)echo %i >> rebase.lst] !endif @@ -1850,20 +1880,20 @@ rebase: !endif -$(OUTDIR)\java\bin\jpw32$(VERSION_NUMBER).dll: $(DIST)\bin\jpw32$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\jpw32$(VERSION_NUMBER).dll copy $(DIST)\bin\jpw32$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\jpw32$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\jpw32$(VERSION_NUMBER).dll: $(DIST)\bin\jpw32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\jpw32$(VERSION_NUMBER).dll copy $(DIST)\bin\jpw32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\jpw32$(VERSION_NUMBER).dll -$(OUTDIR)\java\bin\con32$(VERSION_NUMBER).dll: $(DIST)\bin\con32$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\con32$(VERSION_NUMBER).dll copy $(DIST)\bin\con32$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\con32$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\con32$(VERSION_NUMBER).dll: $(DIST)\bin\con32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\con32$(VERSION_NUMBER).dll copy $(DIST)\bin\con32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\con32$(VERSION_NUMBER).dll -$(OUTDIR)\java\bin\zpw32$(VERSION_NUMBER).dll: $(DIST)\bin\zpw32$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\zpw32$(VERSION_NUMBER).dll copy $(DIST)\bin\zpw32$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\zpw32$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\zpw32$(VERSION_NUMBER).dll: $(DIST)\bin\zpw32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\zpw32$(VERSION_NUMBER).dll copy $(DIST)\bin\zpw32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\zpw32$(VERSION_NUMBER).dll !IF "$(MOZ_BITS)"=="32" @@ -1905,8 +1935,15 @@ $(OUTDIR)\xpcom32.dll: $(DIST)\bin\xpcom32.dll $(OUTDIR)\uni3200.dll: $(DIST)\bin\uni3200.dll @IF EXIST $(DIST)\bin\uni3200.dll copy $(DIST)\bin\uni3200.dll $(OUTDIR)\uni3200.dll -$(OUTDIR)\jrt32$(VERSION_NUMBER).dll: $(DIST)\bin\jrt32$(VERSION_NUMBER).dll - @IF EXIST $(DIST)\bin\jrt32$(VERSION_NUMBER).dll copy $(DIST)\bin\jrt32$(VERSION_NUMBER).dll $(OUTDIR)\jrt32$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\npj32$(VERSION_NUMBER).dll: $(DIST)\bin\npj32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\npj32$(VERSION_NUMBER).dll copy $(DIST)\bin\npj32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\npj32$(VERSION_NUMBER).dll + +$(JAVABIN_DIR)\jrt32$(VERSION_NUMBER).dll: $(DIST)\bin\jrt32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\jrt32$(VERSION_NUMBER).dll copy $(DIST)\bin\jrt32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\jrt32$(VERSION_NUMBER).dll $(OUTDIR)\unicvt32.dll: $(DIST)\bin\unicvt32.dll @IF EXIST $(DIST)\bin\unicvt32.dll copy $(DIST)\bin\unicvt32.dll $(OUTDIR)\unicvt32.dll @@ -1920,35 +1957,35 @@ $(OUTDIR)\nsldap32.dll: $(DIST)\bin\nsldap32.dll @IF EXIST $(DIST)\bin\nsldap32.dll copy $(DIST)\bin\nsldap32.dll $(OUTDIR)\nsldap32.dll !endif -$(OUTDIR)\java\bin\awt32$(VERSION_NUMBER).dll: $(DIST)\bin\awt32$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\awt32$(VERSION_NUMBER).dll copy $(DIST)\bin\awt32$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\awt32$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\awt32$(VERSION_NUMBER).dll: $(DIST)\bin\awt32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\awt32$(VERSION_NUMBER).dll copy $(DIST)\bin\awt32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\awt32$(VERSION_NUMBER).dll !if defined(MOZ_TRACKGDI) $(OUTDIR)\trackgdi.dll: $(DIST)\bin\trackgdi.dll @IF EXIST $(DIST)\bin\trackgdi.dll copy $(DIST)\bin\trackgdi.dll $(OUTDIR)\trackgdi.dll !endif -$(OUTDIR)\java\bin\jbn32$(VERSION_NUMBER).dll: $(DIST)\bin\jbn32$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\jbn32$(VERSION_NUMBER).dll copy $(DIST)\bin\jbn32$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\jbn32$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\jbn32$(VERSION_NUMBER).dll: $(DIST)\bin\jbn32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\jbn32$(VERSION_NUMBER).dll copy $(DIST)\bin\jbn32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\jbn32$(VERSION_NUMBER).dll -$(OUTDIR)\java\bin\jdb32$(VERSION_NUMBER).dll: $(DIST)\bin\jdb32$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\jdb32$(VERSION_NUMBER).dll copy $(DIST)\bin\jdb32$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\jdb32$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\jdb32$(VERSION_NUMBER).dll: $(DIST)\bin\jdb32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\jdb32$(VERSION_NUMBER).dll copy $(DIST)\bin\jdb32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\jdb32$(VERSION_NUMBER).dll -$(OUTDIR)\java\bin\mm32$(VERSION_NUMBER).dll: $(DIST)\bin\mm32$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\mm32$(VERSION_NUMBER).dll copy $(DIST)\bin\mm32$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\mm32$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\mm32$(VERSION_NUMBER).dll: $(DIST)\bin\mm32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\mm32$(VERSION_NUMBER).dll copy $(DIST)\bin\mm32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\mm32$(VERSION_NUMBER).dll -$(OUTDIR)\java\bin\jit32$(VERSION_NUMBER).dll: $(DIST)\bin\jit32$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\jit32$(VERSION_NUMBER).dll copy $(DIST)\bin\jit32$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\jit32$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\jit32$(VERSION_NUMBER).dll: $(DIST)\bin\jit32$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\jit32$(VERSION_NUMBER).dll copy $(DIST)\bin\jit32$(VERSION_NUMBER).dll $(JAVABIN_DIR)\jit32$(VERSION_NUMBER).dll !ELSE !ifndef NSPR20 @@ -1995,28 +2032,35 @@ $(OUTDIR)\nsldap.dll: $(DIST)\bin\nsldap.dll @IF EXIST $(DIST)\bin\nsldap.dll copy $(DIST)\bin\nsldap.dll $(OUTDIR)\nsldap.dll !endif -$(OUTDIR)\jrt16$(VERSION_NUMBER).dll: $(DIST)\bin\jrt16$(VERSION_NUMBER).dll - @IF EXIST $(DIST)\bin\jrt16$(VERSION_NUMBER).dll copy $(DIST)\bin\jrt16$(VERSION_NUMBER).dll $(OUTDIR)\jrt16$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\npj16$(VERSION_NUMBER).dll: $(DIST)\bin\npj16$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\npj16$(VERSION_NUMBER).dll copy $(DIST)\bin\npj16$(VERSION_NUMBER).dll $(JAVABIN_DIR)\npj16$(VERSION_NUMBER).dll -$(OUTDIR)\java\bin\awt16$(VERSION_NUMBER).dll: $(DIST)\bin\awt16$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\awt16$(VERSION_NUMBER).dll copy $(DIST)\bin\awt16$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\awt16$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\jrt16$(VERSION_NUMBER).dll: $(DIST)\bin\jrt16$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\jrt16$(VERSION_NUMBER).dll copy $(DIST)\bin\jrt16$(VERSION_NUMBER).dll $(JAVABIN_DIR)\jrt16$(VERSION_NUMBER).dll -$(OUTDIR)\java\bin\jpw16$(VERSION_NUMBER).dll: $(DIST)\bin\jpw16$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\jpw16$(VERSION_NUMBER).dll copy $(DIST)\bin\jpw16$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\jpw16$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\awt16$(VERSION_NUMBER).dll: $(DIST)\bin\awt16$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\awt16$(VERSION_NUMBER).dll copy $(DIST)\bin\awt16$(VERSION_NUMBER).dll $(JAVABIN_DIR)\awt16$(VERSION_NUMBER).dll -$(OUTDIR)\java\bin\con16$(VERSION_NUMBER).dll: $(DIST)\bin\con16$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\con16$(VERSION_NUMBER).dll copy $(DIST)\bin\con16$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\con16$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\jpw16$(VERSION_NUMBER).dll: $(DIST)\bin\jpw16$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\jpw16$(VERSION_NUMBER).dll copy $(DIST)\bin\jpw16$(VERSION_NUMBER).dll $(JAVABIN_DIR)\jpw16$(VERSION_NUMBER).dll -$(OUTDIR)\java\bin\zpw16$(VERSION_NUMBER).dll: $(DIST)\bin\zpw16$(VERSION_NUMBER).dll - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\bin/$(NULL)" mkdir "$(OUTDIR)\java\bin" - @IF EXIST $(DIST)\bin\zpw16$(VERSION_NUMBER).dll copy $(DIST)\bin\zpw16$(VERSION_NUMBER).dll $(OUTDIR)\java\bin\zpw16$(VERSION_NUMBER).dll +$(JAVABIN_DIR)\con16$(VERSION_NUMBER).dll: $(DIST)\bin\con16$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\con16$(VERSION_NUMBER).dll copy $(DIST)\bin\con16$(VERSION_NUMBER).dll $(JAVABIN_DIR)\con16$(VERSION_NUMBER).dll + +$(JAVABIN_DIR)\zpw16$(VERSION_NUMBER).dll: $(DIST)\bin\zpw16$(VERSION_NUMBER).dll + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVABIN_DIR)/$(NULL)" mkdir "$(JAVABIN_DIR)" + @IF EXIST $(DIST)\bin\zpw16$(VERSION_NUMBER).dll copy $(DIST)\bin\zpw16$(VERSION_NUMBER).dll $(JAVABIN_DIR)\zpw16$(VERSION_NUMBER).dll $(OUTDIR)\nsinit.exe: $(DIST)\bin\nsinit.exe @IF EXIST $(DIST)\bin\nsinit.exe copy $(DIST)\bin\nsinit.exe $(OUTDIR)\nsinit.exe @@ -2025,16 +2069,16 @@ $(OUTDIR)\nsinit.exe: $(DIST)\bin\nsinit.exe # XXX this will copy them all, we really only want the ones that changed -$(OUTDIR)\java\classes\$(JAR_NAME): $(JAVA_DESTPATH)\$(JAR_NAME) - @IF NOT EXIST "$(OUTDIR)\java/$(NULL)" mkdir "$(OUTDIR)\java" - @IF NOT EXIST "$(OUTDIR)\java\classes/$(NULL)" mkdir "$(OUTDIR)\java\classes" -!ifdef MOZ_JAVA +$(JAVACLS_DIR)\$(JAR_NAME): $(JAVA_DESTPATH)\$(JAR_NAME) + @IF NOT EXIST "$(JAVAPARENT_DIR)/$(NULL)" mkdir "$(JAVAPARENT_DIR)" + @IF NOT EXIST "$(JAVACLS_DIR)/$(NULL)" mkdir "$(JAVACLS_DIR)" +!if defined(JAVA_OR_OJI) !ifdef MOZ_COPY_ALL_JARS - @copy $(JAVA_DESTPATH)\*.jar "$(OUTDIR)\java\classes\" + @copy $(JAVA_DESTPATH)\*.jar "$(JAVACLS_DIR)\" !else - @copy $(JAVA_DESTPATH)\java*.jar "$(OUTDIR)\java\classes\" - @copy $(JAVA_DESTPATH)\ifc*.jar "$(OUTDIR)\java\classes\" - @copy $(JAVA_DESTPATH)\jsj*.jar "$(OUTDIR)\java\classes\" + @copy $(JAVA_DESTPATH)\java*.jar "$(JAVACLS_DIR)\" + @copy $(JAVA_DESTPATH)\ifc*.jar "$(JAVACLS_DIR)\" + @copy $(JAVA_DESTPATH)\jsj*.jar "$(JAVACLS_DIR)\" !endif !endif @@ -2238,7 +2282,7 @@ BUILD_SOURCE: $(OBJ_FILES) $(DIST)\lib\li16.lib + $(DIST)\lib\prgrss16.lib + !ifdef EDITOR -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI $(DIST)\lib\edtplug.lib + !endif !endif @@ -2249,7 +2293,7 @@ BUILD_SOURCE: $(OBJ_FILES) $(DIST)\lib\libsjs16.lib + $(DIST)\lib\libnjs16.lib + !endif -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI !ifndef NO_SECURITY $(DIST)\lib\jsl16.lib + !endif @@ -2606,7 +2650,7 @@ exports: -xcopy $(XPDIST)\public\ldap\*.h $(EXPORTINC) $(XCF) !endif !ifdef EDITOR -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI -xcopy $(DEPTH)\modules\edtplug\include\*.h $(EXPORTINC) $(XCF) !endif !endif @@ -2634,16 +2678,19 @@ exports: !if defined(MOZ_JAVA) -xcopy $(XPDIST)\public\applet\*.h $(EXPORTINC) $(XCF) -xcopy $(XPDIST)\public\libreg\*.h $(EXPORTINC) $(XCF) +!endif +!if defined(MOZ_OJI) + -xcopy $(XPDIST)\public\oji\*.h $(EXPORTINC) $(XCF) !endif -xcopy $(XPDIST)\public\hook\*.h $(EXPORTINC) $(XCF) -xcopy $(XPDIST)\public\pref\*.h $(EXPORTINC) $(XCF) -!if defined(MOZ_JAVA) +!if defined(JAVA_OR_OJI) -xcopy $(XPDIST)\public\edtplug\*.h $(EXPORTINC) $(XCF) !endif -xcopy $(XPDIST)\public\htmldlgs\*.h $(EXPORTINC) $(XCF) -xcopy $(XPDIST)\public\softupdt\*.h $(EXPORTINC) $(XCF) -xcopy $(XPDIST)\public\li\*.h $(EXPORTINC) $(XCF) -!if defined(MOZ_JAVA) +!if defined(JAVA_OR_OJI) -xcopy $(XPDIST)\public\progress\*.h $(EXPORTINC) $(XCF) !endif -xcopy $(XPDIST)\public\schedulr\*.h $(EXPORTINC) $(XCF) @@ -2675,8 +2722,8 @@ symbols: ns.zip: cd $(OUTDIR) zip -9rpu ns.zip \ -!if defined(MOZ_JAVA) mozilla.exe \ +!if defined(JAVA_OR_OJI) java/bin/awt3240.dll \ java/bin/jbn3240.dll \ java/bin/jdb3240.dll \ @@ -2691,6 +2738,7 @@ ns.zip: java/classes/jsd10.jar \ java/classes/ldap10.jar \ java/classes/scd10.jar \ + npj3240.dll \ jrt3240.dll \ jsd3240.dll \ !endif diff --git a/mozilla/cmd/winfe/res/editor.rc2 b/mozilla/cmd/winfe/res/editor.rc2 index a2bee652d76..b2bb4f85368 100644 --- a/mozilla/cmd/winfe/res/editor.rc2 +++ b/mozilla/cmd/winfe/res/editor.rc2 @@ -567,7 +567,7 @@ BEGIN MENUITEM SEPARATOR END MENUITEM "&History\tCtrl+H", ID_GO_HISTORY -#ifdef JAVA +#if defined(JAVA) || defined(OJI) MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE #endif MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY diff --git a/mozilla/cmd/winfe/res/mozilla.rc2 b/mozilla/cmd/winfe/res/mozilla.rc2 index 735c0b3b83e..a6b17efc551 100644 --- a/mozilla/cmd/winfe/res/mozilla.rc2 +++ b/mozilla/cmd/winfe/res/mozilla.rc2 @@ -663,7 +663,7 @@ BEGIN MENUITEM SEPARATOR END MENUITEM "&History\tCtrl+H", ID_GO_HISTORY -#ifdef JAVA +#if defined(JAVA) || defined(OJI) MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE #endif MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY @@ -982,7 +982,7 @@ BEGIN END END MENUITEM "&History", ID_GO_HISTORY -#ifdef JAVA +#if defined(JAVA) || defined(OJI) MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE #endif #ifdef MOZ_TASKBAR @@ -1315,7 +1315,7 @@ symlogo RCDATA #include "_gen\symlogo.rc" tdlogo RCDATA #include "_gen\tdlogo.rc" -#ifdef JAVA +#if defined(JAVA) || defined(OJI) javalogo RCDATA #include "_gen\javalogo.rc" #endif diff --git a/mozilla/cmd/xfe/Makefile b/mozilla/cmd/xfe/Makefile index 7404dd11dd3..2cd4f812c09 100644 --- a/mozilla/cmd/xfe/Makefile +++ b/mozilla/cmd/xfe/Makefile @@ -259,8 +259,8 @@ ifdef MOZ_LOC_INDEP BASIC_LIBS += $(DIST)/lib/libli.a endif -ifdef MOZ_JAVA -JAVA_JMC = $(DIST)/lib/libjmc.a +ifdef JAVA_OR_OJI +JAVA_JMC = $(DIST)/lib/libjmc.a # XXX To be removed... endif BASIC_LIBS += \ @@ -323,8 +323,11 @@ endif BASIC_LIBS += $(DIST)/lib/libxpcom.a +ifdef JAVA_OR_OJI + ifdef MOZ_JAVA +# Monolithic Java BASIC_LIBS += \ $(DIST)/lib/libcaps.a \ $(DIST)/lib/lib$(LITE_PREFIX)applet.a \ @@ -362,12 +365,26 @@ BASIC_LIBS += $(DIST)/lib/libjrt.a else # MOZ_JAVA +# OJI +BASIC_LIBS += $(DIST)/lib/liboji.a + +ifdef EDITOR +BASIC_LIBS += $(DIST)/lib/libedtplug.a +endif + +BASIC_LIBS += $(DIST)/lib/libsoftupdate.a + +endif # MOZ_JAVA + +else # JAVA_OR_OJI + +# No Monolithic Java, no OJI, just stubs. BASIC_LIBS += \ $(DIST)/lib/libstubsj.a \ $(DIST)/lib/libstubnj.a \ $(NULL) -endif # MOZ_JAVA +endif # JAVA_OR_OJI BASIC_LIBS += $(DIST)/lib/libzlib.a diff --git a/mozilla/cmd/xfe/icons/Makefile b/mozilla/cmd/xfe/icons/Makefile index bd4ee853e56..9153e9de8f9 100644 --- a/mozilla/cmd/xfe/icons/Makefile +++ b/mozilla/cmd/xfe/icons/Makefile @@ -126,8 +126,8 @@ ICONLIST = $(OBJDIR)/icon.list ICONANIMLIST = $(OBJDIR)/iconanim.list MKICONS_EXE = $(OBJDIR)/mkicons -ifdef MOZ_JAVA -JAVA_JMC = $(DIST)/lib/libjmc.a +ifdef JAVA_OR_OJI +JAVA_JMC = $(DIST)/lib/libjmc.a # XXX To be removed... else JAVA_JMC = $(DIST)/lib/libstubsj.a endif diff --git a/mozilla/cmd/xfe/lay.c b/mozilla/cmd/xfe/lay.c index 1042b0993cc..99ee300a3e0 100644 --- a/mozilla/cmd/xfe/lay.c +++ b/mozilla/cmd/xfe/lay.c @@ -2389,10 +2389,10 @@ XFE_CreateEmbedWindow(MWContext *context, NPEmbeddedApp *app) if (XP_FAIL_ASSERT(lo_struct != NULL)) return; - xp = lo_struct->x; - yp = lo_struct->y; - xs = lo_struct->width; - ys = lo_struct->height; + xp = lo_struct->objTag.x; + yp = lo_struct->objTag.y; + xs = lo_struct->objTag.width; + ys = lo_struct->objTag.height; if (CONTEXT_DATA(context)->is_fullpage_plugin) { /* This is a full page plugin */ @@ -2576,9 +2576,9 @@ XFE_RestoreEmbedWindow(MWContext *context, NPEmbeddedApp *app) = ((np_data*) app->np_data)->lo_struct; if (embed_struct) { - xp = embed_struct->x + embed_struct->x_offset - + xp = embed_struct->objTag.x + embed_struct->objTag.x_offset - CONTEXT_DATA(context)->document_x; - yp = embed_struct->y + embed_struct->y_offset - + yp = embed_struct->objTag.y + embed_struct->objTag.y_offset - CONTEXT_DATA(context)->document_y; } } @@ -2651,20 +2651,20 @@ XFE_DisplayEmbed (MWContext *context, int32 xs, ys; if (!embed_struct) return; - eApp = (NPEmbeddedApp *)embed_struct->FE_Data; + eApp = (NPEmbeddedApp *)embed_struct->objTag.FE_Data; if (!eApp) return; /* Shouldn't be here if HIDDEN */ - if (embed_struct->ele_attrmask & LO_ELE_HIDDEN) + if (embed_struct->objTag.ele_attrmask & LO_ELE_HIDDEN) return; /* Layout might have changed the location of the embed since we * created the embed in XFE_GetEmbedSize() */ - xs = embed_struct->x + embed_struct->x_offset - + xs = embed_struct->objTag.x + embed_struct->objTag.x_offset - CONTEXT_DATA (context)->document_x; - ys = embed_struct->y + embed_struct->y_offset - + ys = embed_struct->objTag.y + embed_struct->objTag.y_offset - CONTEXT_DATA (context)->document_y; /* If this is a full page plugin, then plugin needs to be notified of @@ -2705,7 +2705,7 @@ XFE_DisplayEmbed (MWContext *context, an enclosing layer, in which case we should unmap the plugin's window */ XtSetMappedWhenManaged((Widget)eApp->fe_data, - !(embed_struct->ele_attrmask &LO_ELE_INVISIBLE)); + !(embed_struct->objTag.ele_attrmask &LO_ELE_INVISIBLE)); /* The location of the plugin may have changed since it was * created, either at the behest of Layout or due to movement @@ -2729,7 +2729,7 @@ void XFE_GetEmbedSize (MWContext *context, LO_EmbedStruct *embed_struct, NET_ReloadMethod force_reload) { - NPEmbeddedApp *eApp = (NPEmbeddedApp *)embed_struct->FE_Data; + NPEmbeddedApp *eApp = (NPEmbeddedApp *)embed_struct->objTag.FE_Data; int32 doc_id; lo_TopState *top_state; @@ -2742,11 +2742,17 @@ XFE_GetEmbedSize (MWContext *context, LO_EmbedStruct *embed_struct, /* Determine if this is a fullpage plugin. Do this _now_ so that it'll be available when NPL_EmbedCreate() calls back to XFE_CreateEmbedWindow() */ - if((embed_struct->width == 1) && - (embed_struct->height == 1) && + if((embed_struct->objTag.width == 1) && + (embed_struct->objTag.height == 1) && +#ifdef OJI + (embed_struct->attributes.n > 0) && + (!strcmp(embed_struct->attributes.names[0], "src")) && + (!strcmp(embed_struct->attributes.values[0], "internal-external-plugin"))) { +#else (embed_struct->attribute_cnt > 0) && (!strcmp(embed_struct->attribute_list[0], "src")) && (!strcmp(embed_struct->value_list[0], "internal-external-plugin"))) { +#endif /* OJI */ CONTEXT_DATA(context)->is_fullpage_plugin = 1; } @@ -2758,18 +2764,18 @@ XFE_GetEmbedSize (MWContext *context, LO_EmbedStruct *embed_struct, #endif { /* hmm, that failed which is unusual */ - embed_struct->width = embed_struct->height=1; + embed_struct->objTag.width = embed_struct->objTag.height = 1; return; } eApp->type = NP_Plugin; - if (embed_struct->ele_attrmask & LO_ELE_HIDDEN) { + if (embed_struct->objTag.ele_attrmask & LO_ELE_HIDDEN) { /* Hidden plugin. Dont create window for it. */ eApp->fe_data = 0; eApp->wdata = 0; - embed_struct->width = embed_struct->height=0; + embed_struct->objTag.width = embed_struct->objTag.height=0; /* --- begin fix for bug# 35087 --- */ - embed_struct->FE_Data = (void *)eApp; + embed_struct->objTag.FE_Data = (void *)eApp; if (NPL_EmbedStart(context, embed_struct, eApp) != NPERR_NO_ERROR) { /* Spoil sport! */ @@ -2781,7 +2787,7 @@ XFE_GetEmbedSize (MWContext *context, LO_EmbedStruct *embed_struct, to zero! XFE_DestroyEmbedWindow(context, eApp) */ - embed_struct->FE_Data = NULL; + embed_struct->objTag.FE_Data = NULL; return; } /* --- end fix for bug# 35087 --- */ @@ -2796,7 +2802,7 @@ XFE_GetEmbedSize (MWContext *context, LO_EmbedStruct *embed_struct, if (NPL_EmbedStart(context, embed_struct, eApp) != NPERR_NO_ERROR) { /* Spoil sport! */ XFE_DestroyEmbedWindow(context, eApp); - embed_struct->FE_Data = NULL; + embed_struct->objTag.FE_Data = NULL; return; } } @@ -2902,7 +2908,7 @@ static void* PR_CALLBACK FE_CreateJavaWindow(MWContext *context, LO_JavaAppStruct *java_struct, int32 xp, int32 yp, int32 xs, int32 ys) { - LJAppletData* ad = (LJAppletData*)java_struct->session_data; + LJAppletData* ad = (LJAppletData*)java_struct->objTag.session_data; Widget parent; Arg av[20]; int ac = 0; @@ -3042,8 +3048,8 @@ XFE_GetJavaAppSize (MWContext *context, LO_JavaAppStruct *java_struct, LJ_GetJavaAppSize(context, java_struct, reloadMethod); #else FE_DisplayNoJavaIcon(context, java_struct); - java_struct->width = 1; - java_struct->height = 1; + java_struct->objTag.width = 1; + java_struct->objTag.height = 1; #endif } diff --git a/mozilla/cmd/xfe/mozilla.c b/mozilla/cmd/xfe/mozilla.c index f656edc82b1..abfbca3d29f 100644 --- a/mozilla/cmd/xfe/mozilla.c +++ b/mozilla/cmd/xfe/mozilla.c @@ -2106,7 +2106,10 @@ main PR_Init("mozilla", 24, 1, 0); #endif /* NSRP20 */ +#ifdef JAVA LJ_SetProgramName(argv[0]); +#endif + PR_XLock(); mozilla_thread = PR_CurrentThread(); fdset_lock = PR_NewNamedMonitor("mozilla-fdset-lock"); @@ -2439,11 +2442,13 @@ main PR_StartEvents(0); #endif /* NSPR20 */ +#ifdef JAVA { extern void AwtRegisterXtAppVars(Display *dpy, XtAppContext ac, char *class); AwtRegisterXtAppVars(fe_display, fe_XtAppContext, (char *)fe_progclass); } +#endif { extern int PR_XGetXtHackFD(void); diff --git a/mozilla/cmd/xfe/mozjava.h b/mozilla/cmd/xfe/mozjava.h index 65e8b67a3d7..d41637f9221 100644 --- a/mozilla/cmd/xfe/mozjava.h +++ b/mozilla/cmd/xfe/mozjava.h @@ -32,8 +32,10 @@ #include "plevent.h" #endif /* NSPR20 */ #include "prlog.h" +#ifdef JAVA #include "java.h" #endif +#endif #ifdef JAVA extern PRMonitor *fdset_lock; diff --git a/mozilla/cmd/xfe/src/Frame.cpp b/mozilla/cmd/xfe/src/Frame.cpp index 9d608a5fea5..17d77f63fa0 100644 --- a/mozilla/cmd/xfe/src/Frame.cpp +++ b/mozilla/cmd/xfe/src/Frame.cpp @@ -26,7 +26,9 @@ #include "layers.h" +#ifdef JAVA #include "mozjava.h" +#endif #include "libmocha.h" #include "libevent.h" diff --git a/mozilla/cmd/xfe/src/Makefile b/mozilla/cmd/xfe/src/Makefile index 3076d15b7a8..f80bd116269 100644 --- a/mozilla/cmd/xfe/src/Makefile +++ b/mozilla/cmd/xfe/src/Makefile @@ -42,6 +42,7 @@ REQUIRES =\ hook \ pref \ java \ + oji \ libfont \ ldap \ lay \ diff --git a/mozilla/cmd/xfe/src/Netcaster.cpp b/mozilla/cmd/xfe/src/Netcaster.cpp index fa93d5d1a95..443465c6909 100644 --- a/mozilla/cmd/xfe/src/Netcaster.cpp +++ b/mozilla/cmd/xfe/src/Netcaster.cpp @@ -22,8 +22,10 @@ - +#ifdef JAVA #include "mozjava.h" +#endif + #include "xfe2_extern.h" #include "VerReg.h" #include "libmocha.h" @@ -379,7 +381,14 @@ fe_showNetcaster(Widget toplevel) if (netcasterURL) { - if (!LM_GetMochaEnabled() || !LJ_GetJavaEnabled()) + if (!LM_GetMochaEnabled() +#ifdef JAVA + || !LJ_GetJavaEnabled() +#else + || TRUE /* If we haven't compiled Java in, then it + sure won't be enabled... */ +#endif + ) { fe_Alert_2(toplevel, XP_GetString(XP_ALERT_NETCASTER_NO_JS)); return; diff --git a/mozilla/cmd/xfe/src/PrefsDialogGeneral.cpp b/mozilla/cmd/xfe/src/PrefsDialogGeneral.cpp index dd15392e198..8ac9fb63d07 100644 --- a/mozilla/cmd/xfe/src/PrefsDialogGeneral.cpp +++ b/mozilla/cmd/xfe/src/PrefsDialogGeneral.cpp @@ -30,7 +30,9 @@ #include "prprf.h" #include "net.h" #include "libmocha.h" +#ifdef JAVA #include "java.h" +#endif #include "PrefsDialogAppl.h" #include "PrefsProxiesView.h" #include "PrefsApplEdit.h" diff --git a/mozilla/cmd/xfe/src/plugin.cpp b/mozilla/cmd/xfe/src/plugin.cpp index a6bc7c1f376..0bb8ced22b9 100644 --- a/mozilla/cmd/xfe/src/plugin.cpp +++ b/mozilla/cmd/xfe/src/plugin.cpp @@ -43,7 +43,9 @@ #endif /* NSPR20 */ #include "pref_helpers.h" #include "edt.h" +#ifdef JAVA #include "java.h" +#endif #include "obsolete/probslet.h" #include "npglue.h" diff --git a/mozilla/cmd/xfe/src/pref.cpp b/mozilla/cmd/xfe/src/pref.cpp index 108037acaa6..9063eddd5a0 100644 --- a/mozilla/cmd/xfe/src/pref.cpp +++ b/mozilla/cmd/xfe/src/pref.cpp @@ -28,7 +28,9 @@ #include "net.h" #include "xfe.h" #include "libmocha.h" +#ifdef JAVA #include "java.h" +#endif #include "PrefsDialog.h" extern "C" diff --git a/mozilla/config/config.mak b/mozilla/config/config.mak index 84acaf8d82d..be7a5340175 100644 --- a/mozilla/config/config.mak +++ b/mozilla/config/config.mak @@ -121,6 +121,15 @@ LCFLAGS=$(LCFLAGS) -DSTAND_ALONE_JAVA !if defined(MOZ_JAVA) MOZ_JAVA_FLAG=-DJAVA +!if defined(MOZ_OJI) +!error You can't define both MOZ_JAVA and MOZ_OJI anymore. +!endif +JAVA_OR_OJI=1 +!endif + +!if defined(MOZ_OJI) +LCFLAGS=$(LCFLAGS) -DOJI +JAVA_OR_OJI=1 !endif # Perhaps we should add MOZ_LITENESS_FLAGS to 16 bit build @@ -298,6 +307,7 @@ MOD_JDB=jdb$(MOZ_BITS)$(VERSION_NUMBER) MOD_ZIP=zip$(MOZ_BITS)$(VERSION_NUMBER) MOD_ZPW=zpw$(MOZ_BITS)$(VERSION_NUMBER) MOD_CON=con$(MOZ_BITS)$(VERSION_NUMBER) +MOD_NPJ=npj$(MOZ_BITS)$(VERSION_NUMBER) JRTDLL=$(MOD_JRT).$(DLL_SUFFIX) MMDLL =$(MOD_MM).$(DLL_SUFFIX) @@ -313,6 +323,7 @@ JDBDLL=$(MOD_JDB).$(DLL_SUFFIX) ZIPDLL=$(MOD_ZIP).$(DLL_SUFFIX) ZPWDLL=$(MOD_ZPW).$(DLL_SUFFIX) CONDLL=$(MOD_CON).$(DLL_SUFFIX) +NPJDLL=$(MOD_NPJ).$(DLL_SUFFIX) ZIPLIB=$(DIST)\lib\$(MOD_ZIP).$(LIB_SUFFIX) AWTLIB=$(DIST)\lib\$(MOD_AWT).$(LIB_SUFFIX) diff --git a/mozilla/config/config.mk b/mozilla/config/config.mk index 8b974e7c13c..7ce72505a1c 100644 --- a/mozilla/config/config.mk +++ b/mozilla/config/config.mk @@ -441,6 +441,15 @@ endif ifdef MOZ_JAVA DEFINES += -DJAVA +ifdef MOZ_OJI +error You can't define both MOZ_JAVA and MOZ_OJI anymore. +endif +JAVA_OR_OJI = 1 +endif + +ifdef MOZ_OJI +DEFINES += -DOJI +JAVA_OR_OJI = 1 endif ifndef NO_MOCHA @@ -572,5 +581,6 @@ ZPWDLL = libzpw.$(DLL_SUFFIX) endif JAVA_DEFINES += -DAWTSDLL=\"$(AWTSDLL)\" -DCONDLL=\"$(CONDLL)\" -DJBNDLL=\"$(JBNDLL)\" -DJDBDLL=\"$(JDBDLL)\" \ - -DJSJDLL=\"$(JSJDLL)\" -DNETDLL=\"$(NETDLL)\" -DNSCDLL=\"$(NSCDLL)\" -DZPWDLL=\"$(ZPWDLL)\" + -DJSJDLL=\"$(JSJDLL)\" -DNETDLL=\"$(NETDLL)\" -DNSCDLL=\"$(NSCDLL)\" -DZPWDLL=\"$(ZPWDLL)\" \ + -DJAR_NAME=\"$(JAR_NAME)\" diff --git a/mozilla/config/java.inc b/mozilla/config/java.inc index 0d6a0149b49..58dda8412a9 100644 --- a/mozilla/config/java.inc +++ b/mozilla/config/java.inc @@ -66,7 +66,7 @@ $(MAC_JAVA_HEADERS_DIR): !endif !ifdef JDK_GEN -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI #//------------------------------------------------------------------------ #// #// Rule to generate Java header files using javah. @@ -92,12 +92,12 @@ $(JDK_GEN)::display_java_header_msg_mac $(MAC_JAVA_HEADERS_DIR) display_java_header_msg_mac: echo +++ make: Generating Macintosh JDK header files +++ !endif -!endif # MOZ_JAVA +!endif # JAVA_OR_OJI !endif !ifdef JDK_GEN -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI #//------------------------------------------------------------------------ #// #// Rules to generate Java stub files using javah. @@ -120,11 +120,11 @@ display_java_stub_msg_mac: export:: $(JDK_GEN) -!endif # MOZ_JAVA +!endif # JAVA_OR_OJI !endif !ifdef JAVA_LIBSTUB_FILES -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI #//------------------------------------------------------------------------ #// #// Rules to generate libstubs.c using javah. @@ -138,11 +138,11 @@ stubs$(MOZ_BITS).c::$(JAVA_LIBSTUB_FILES) echo +++ make: Generating stubs$(MOZ_BITS).c... $(JAVAH) -o stubs$(MOZ_BITS).c -stubs $** -!endif # MOZ_JAVA +!endif # JAVA_OR_OJI !endif !ifdef JRI_GEN -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI #//------------------------------------------------------------------------ #// #// Rule to generate JRI header files using javah. @@ -168,11 +168,11 @@ $(JRI_GEN)::display_jri_header_msg_mac $(MAC_JAVA_HEADERS_DIR) display_jri_header_msg_mac: echo +++ make: Generating Macintosh java JRI header files +++ !endif -!endif # MOZ_JAVA +!endif # JAVA_OR_OJI !endif !ifdef JRI_GEN -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI #//------------------------------------------------------------------------ #// #// Rules to generate JRI stub files using javah. @@ -195,7 +195,7 @@ display_jri_stub_msg_mac: export:: $(JRI_GEN) -!endif # MOZ_JAVA +!endif # JAVA_OR_OJI !endif !endif # CONFIG_JAVA_INC diff --git a/mozilla/config/obj.inc b/mozilla/config/obj.inc index 2a3162ab1f0..0785372a32a 100644 --- a/mozilla/config/obj.inc +++ b/mozilla/config/obj.inc @@ -205,5 +205,32 @@ CONFIG_OBJ_INC=1 $(CURDIR)$(*B).c < #// JSRCS .java files to be compiled (.java extension included) #// #//------------------------------------------------------------------------ -!if defined(MOZ_JAVA) +!if defined(JAVA_OR_OJI) !if defined(JSRCS) JSRCS_DEPS = $(JAVA_DESTPATH) $(JAVA_DESTPATH)\$(PACKAGE) $(TMPDIR) @@ -525,7 +525,7 @@ export:: $(JMCSRCDIR) clobber:: -for %f in ($(JMC_EXPORT)) do $(RM) $(JMCSRCDIR:/=\)\%f.class !endif # JMC_EXPORT -!endif # MOZ_JAVA +!endif # JAVA_OR_OJI #//------------------------------------------------------------------------ #// @@ -535,7 +535,7 @@ clobber:: #// Generated .h and .c files go to JMC_GEN_DIR #// #//------------------------------------------------------------------------ -!if defined(MOZ_JAVA) +!if defined(JAVA_OR_OJI) !if defined(JMC_GEN) export:: $(JMC_HEADERS) @@ -559,7 +559,7 @@ export:: $(JMC_STUBS) $(OBJDIR) $(JMC_OBJS) !endif # CCJMC !endif # JMC_GEN -!endif # MOZ_JAVA +!endif # JAVA_OR_OJI #//------------------------------------------------------------------------ @@ -580,7 +580,7 @@ clobber:: #//------------------------------------------------------------------------ #// These rules must follow all lines that define the macros they use #//------------------------------------------------------------------------ -!ifdef MOZ_JAVA +!if defined(JAVA_OR_OJI) GARBAGE = $(JMC_GEN_DIR) $(JMC_HEADERS) $(JMC_STUBS) \ $(JDK_STUB_DIR) $(JRI_GEN_DIR) $(JDK_GEN_DIR) !endif diff --git a/mozilla/config/rules.mk b/mozilla/config/rules.mk index 3b7e0b0d7cd..12ee256272d 100644 --- a/mozilla/config/rules.mk +++ b/mozilla/config/rules.mk @@ -155,7 +155,7 @@ ifndef PACKAGE PACKAGE = . endif -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI ALL_TRASH = $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \ $(NOSUCHFILE) $(JDK_HEADER_CFILES) $(JDK_STUB_CFILES) \ $(JRI_HEADER_CFILES) $(JRI_STUB_CFILES) $(JMC_STUBS) \ @@ -170,13 +170,13 @@ ALL_TRASH = $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \ _gen _stubs $(wildcard gts_tmp_*) endif -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI ifdef JDIRS ALL_TRASH += $(addprefix $(JAVA_DESTPATH)/,$(JDIRS)) endif endif -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI JMC_SUBDIR = _jmc else JMC_SUBDIR = $(LOCAL_JMC_SUBDIR) @@ -435,7 +435,7 @@ $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) $(JMCSRCDIR):: ### JSRCS -- for compiling java files ifneq ($(JSRCS),) -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) list=`$(PERL) $(DEPTH)/config/outofdate.pl $(PERLARG) \ -d $(JAVA_DESTPATH)/$(PACKAGE) $(JSRCS)`; \ @@ -460,7 +460,7 @@ endif # some builds to run out of memory # ifdef JDIRS -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) @for d in $(JDIRS); do \ if test -d $$d; then \ @@ -488,7 +488,7 @@ endif # Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory # ifneq ($(JDK_GEN),) -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI ifdef NSBUILDROOT INCLUDES += -I$(JDK_GEN_DIR) -I$(XPDIST) else @@ -520,7 +520,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 # MOZ_JAVA +endif # JAVA_OR_OJI endif # @@ -529,7 +529,7 @@ endif # Generate JRI Headers and Stubs into the 'jri' directory # ifneq ($(JRI_GEN),) -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI ifdef NSBUILDROOT INCLUDES += -I$(JRI_GEN_DIR) -I$(XPDIST) else @@ -561,14 +561,14 @@ 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 # MOZ_JAVA +endif # JAVA_OR_OJI endif # # JMC_EXPORT -- for declaring which java classes are to be exported for jmc # ifneq ($(JMC_EXPORT),) -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI JMC_EXPORT_PATHS = $(subst .,/,$(JMC_EXPORT)) JMC_EXPORT_FILES = $(patsubst %,$(JAVA_DESTPATH)/$(PACKAGE)/%.class,$(JMC_EXPORT_PATHS)) @@ -579,7 +579,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 # MOZ_JAVA +endif # JAVA_OR_OJI endif # @@ -589,7 +589,7 @@ endif # ifneq ($(JMC_GEN),) INCLUDES += -I$(JMC_GEN_DIR) -I. -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI 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)) @@ -609,7 +609,7 @@ else endif export:: $(JMC_HEADERS) $(JMC_STUBS) -endif # MOZ_JAVA +endif # JAVA_OR_OJI endif # diff --git a/mozilla/include/lo_ele.h b/mozilla/include/lo_ele.h index a53c2e79250..bd4cc4d4d83 100644 --- a/mozilla/include/lo_ele.h +++ b/mozilla/include/lo_ele.h @@ -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 @@ -200,25 +200,25 @@ union LO_Element_struct; * name. */ struct LO_AnchorData_struct { - PA_Block anchor; /* really a (char *) */ - PA_Block target; /* really a (char *) */ - PA_Block alt; /* really a (char *) */ + PA_Block anchor; /* really a (char *) */ + PA_Block target; /* really a (char *) */ + PA_Block alt; /* really a (char *) */ #ifdef MOCHA - LO_Element *element; /* Needed for mocha reflection - of layout position. */ - CL_Layer *layer; /* Layer containing anchor */ - struct JSObject *mocha_object; - XP_Bool event_handler_present; /*Indicates whether there's a JS handler */ + LO_Element *element; /* Needed for mocha reflection + of layout position. */ + CL_Layer *layer; /* Layer containing anchor */ + struct JSObject *mocha_object; + XP_Bool event_handler_present; /*Indicates whether there's a JS handler */ #endif - uint8 flags; /* Indicates whether to suppress visual feedback */ - double prevalue; /* */ + uint8 flags; /* Indicates whether to suppress visual feedback */ + double prevalue; /* */ }; /* * Basic RGB triplet */ struct LO_Color_struct { - uint8 red, green, blue; + uint8 red, green, blue; }; /* @@ -232,35 +232,35 @@ struct LO_Color_struct { #define LO_AUTO_EXPAND_CLIP_TOP 0x04 #define LO_AUTO_EXPAND_CLIP_LEFT 0x08 #define LO_AUTO_EXPAND_CLIP (LO_AUTO_EXPAND_CLIP_LEFT | \ - LO_AUTO_EXPAND_CLIP_RIGHT | \ - LO_AUTO_EXPAND_CLIP_TOP | \ - LO_AUTO_EXPAND_CLIP_BOTTOM) + LO_AUTO_EXPAND_CLIP_RIGHT | \ + LO_AUTO_EXPAND_CLIP_TOP | \ + LO_AUTO_EXPAND_CLIP_BOTTOM) typedef struct LO_BlockInitializeStruct_struct { - XP_Bool has_left; - int32 left; - XP_Bool has_top; - int32 top; - XP_Bool has_width; - int32 width; - XP_Bool has_height; - int32 height; - char *name; - char *id; - char *above; - char *below; - XP_Bool has_zindex; - int32 zindex; - char *visibility; - char *bgcolor; - XP_Bool is_style_bgcolor; - char *bgimage; - char *src; - XP_Rect *clip; - int clip_expansion_policy; - char *overflow; - PA_Tag *tag; - PA_Tag *ss_tag; + XP_Bool has_left; + int32 left; + XP_Bool has_top; + int32 top; + XP_Bool has_width; + int32 width; + XP_Bool has_height; + int32 height; + char *name; + char *id; + char *above; + char *below; + XP_Bool has_zindex; + int32 zindex; + char *visibility; + char *bgcolor; + XP_Bool is_style_bgcolor; + char *bgimage; + char *src; + XP_Rect *clip; + int clip_expansion_policy; + char *overflow; + PA_Tag *tag; + PA_Tag *ss_tag; } LO_BlockInitializeStruct; /* @@ -273,17 +273,17 @@ typedef struct LO_BlockInitializeStruct_struct { * should be ignored */ struct LO_TextAttr_struct { - int16 size; - int32 fontmask; /* bold, italic, fixed */ - LO_Color fg, bg; - Bool no_background; /* unused, text on image? */ - int32 attrmask; /* anchor, underline, strikeout, blink(gag) */ - char *font_face; - double point_size; /* 1.0pt through 72.0pt and above */ - uint16 font_weight; /* 100, 200, ... 900 */ - void *FE_Data; /* For the front end to store font IDs */ - struct LO_TextAttr_struct *next; /* to chain in hash table */ - int16 charset; + int16 size; + int32 fontmask; /* bold, italic, fixed */ + LO_Color fg, bg; + Bool no_background; /* unused, text on image? */ + int32 attrmask; /* anchor, underline, strikeout, blink(gag) */ + char *font_face; + double point_size; /* 1.0pt through 72.0pt and above */ + uint16 font_weight; /* 100, 200, ... 900 */ + void *FE_Data; /* For the front end to store font IDs */ + struct LO_TextAttr_struct *next; /* to chain in hash table */ + int16 charset; }; /* @@ -292,9 +292,9 @@ struct LO_TextAttr_struct { * the text segment. */ struct LO_TextInfo_struct { - intn max_width; - int16 ascent, descent; - int16 lbearing, rbearing; + intn max_width; + int16 ascent, descent; + int16 lbearing, rbearing; }; @@ -331,54 +331,54 @@ struct LO_TextInfo_struct { * and all the word breaking information. */ typedef struct LO_TextBlock_struct { - /* the base layout struct */ - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + /* the base layout struct */ + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - /* textblock specific */ - LO_TextAttr * text_attr; - LO_AnchorData * anchor_href; - uint16 ele_attrmask; /* breakable, secure, selected, etc. */ - uint16 format_mode; - - LO_TextStruct * startTextElement; - LO_TextStruct * endTextElement; - - uint8 * text_buffer; - uint32 buffer_length; - uint32 buffer_write_index; - uint32 last_buffer_write_index; - uint32 buffer_read_index; - uint32 last_line_break; - - uint32 * break_table; - uint32 break_length; - uint32 break_write_index; - uint32 break_read_index; - uint32 last_break_offset; - uint32 multibyte_index; - uint32 multibyte_length; + /* textblock specific */ + LO_TextAttr * text_attr; + LO_AnchorData * anchor_href; + uint16 ele_attrmask; /* breakable, secure, selected, etc. */ + uint16 format_mode; + + LO_TextStruct * startTextElement; + LO_TextStruct * endTextElement; + + uint8 * text_buffer; + uint32 buffer_length; + uint32 buffer_write_index; + uint32 last_buffer_write_index; + uint32 buffer_read_index; + uint32 last_line_break; + + uint32 * break_table; + uint32 break_length; + uint32 break_write_index; + uint32 break_read_index; + uint32 last_break_offset; + uint32 multibyte_index; + uint32 multibyte_length; - LO_TextStruct * old_break; - uint32 old_break_pos; - uint32 old_break_width; - - uint32 totalWidth; - uint32 totalChars; - uint8 break_pending; - uint8 last_char_is_whitespace; + LO_TextStruct * old_break; + uint32 old_break_pos; + uint32 old_break_width; + + uint32 totalWidth; + uint32 totalChars; + uint8 break_pending; + uint8 last_char_is_whitespace; - int16 ascent; /* font information for relayout */ - int16 descent; + int16 ascent; /* font information for relayout */ + int16 descent; } LO_TextBlock; @@ -390,36 +390,36 @@ typedef struct LO_TextBlock_struct { * structure will tell the front-end how to render the text. */ struct LO_TextStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - void *FE_Data; + void *FE_Data; #if defined(XP_WIN) - union { - PA_Block text; /* lock to a (char *) */ - char *pText; - }; + union { + PA_Block text; /* lock to a (char *) */ + char *pText; + }; #else - PA_Block text; /* lock to a (char *) */ + PA_Block text; /* lock to a (char *) */ #endif - uint16 block_offset; /* offset to this line in the parent text block */ - uint16 doc_width; /* doc width that this line was layed out into */ - LO_AnchorData *anchor_href; - LO_TextAttr *text_attr; - uint16 ele_attrmask; /* breakable, secure, selected, etc. */ - int16 text_len; - int16 sel_start; - int16 sel_end; - intn bullet_type; /* set to MQUOTE in lo_make_quote_text, and other things in lo_PlaceBulletStr. */ + uint16 block_offset; /* offset to this line in the parent text block */ + uint16 doc_width; /* doc width that this line was layed out into */ + LO_AnchorData *anchor_href; + LO_TextAttr *text_attr; + uint16 ele_attrmask; /* breakable, secure, selected, etc. */ + int16 text_len; + int16 sel_start; + int16 sel_end; + intn bullet_type; /* set to MQUOTE in lo_make_quote_text, and other things in lo_PlaceBulletStr. */ }; @@ -437,14 +437,14 @@ struct LO_TextStruct_struct { * unique to a particular instance of a displayed image. */ struct LO_ImageAttr_struct { - int32 attrmask; /* anchor, delayed, ismap */ - intn alignment; - int32 layer_id; - intn form_id; - char *usemap_name; /* Use named client-side map if here */ - void *usemap_ptr; /* private, used by layout only! */ - intn submit_x; /* for form, last click coord */ - intn submit_y; /* for form, last click coord */ + int32 attrmask; /* anchor, delayed, ismap */ + intn alignment; + int32 layer_id; + intn form_id; + char *usemap_name; /* Use named client-side map if here */ + void *usemap_ptr; /* private, used by layout only! */ + intn submit_x; /* for form, last click coord */ + intn submit_y; /* for form, last click coord */ }; @@ -467,97 +467,97 @@ typedef enum { * be displayed. */ struct LO_ImageStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - int32 layer_id; + int32 layer_id; - int32 percent_width; /* For relayout */ - int32 percent_height; /* For relayout */ - + int32 percent_width; /* For relayout */ + int32 percent_height; /* For relayout */ + #ifdef MOCHA - struct JSObject *mocha_object; + struct JSObject *mocha_object; #endif - CL_Layer *layer; - XP_Rect valid_rect; - IL_ImageReq *image_req; /* Image library representation. */ - IL_ImageReq *lowres_image_req; /* Handle on lowres image while - highres image is coming in. */ - uint8 is_icon; /* Is this an image or an icon? */ - uint16 icon_number; /* If this is an icon, the icon number. */ - PA_Block alt; - LO_AnchorData *anchor_href; - PA_Block image_url; - PA_Block lowres_image_url; - LO_ImageAttr *image_attr; - LO_TextAttr *text_attr; - int32 border_width; - int32 border_vert_space; - int32 border_horiz_space; - uint16 ele_attrmask; /* floating, secure, selected, etc. */ - uint16 image_status; - uint8 is_transparent; - lo_SuppressMode suppress_mode; /* For temp icon, temp border, etc. */ - int16 alt_len; - int16 sel_start; - int16 sel_end; - intn seq_num; - PRPackedBool pending_mocha_event; - LO_ImageStruct *next_image; /* next image in list for this document */ + CL_Layer *layer; + XP_Rect valid_rect; + IL_ImageReq *image_req; /* Image library representation. */ + IL_ImageReq *lowres_image_req; /* Handle on lowres image while + highres image is coming in. */ + uint8 is_icon; /* Is this an image or an icon? */ + uint16 icon_number; /* If this is an icon, the icon number. */ + PA_Block alt; + LO_AnchorData *anchor_href; + PA_Block image_url; + PA_Block lowres_image_url; + LO_ImageAttr *image_attr; + LO_TextAttr *text_attr; + int32 border_width; + int32 border_vert_space; + int32 border_horiz_space; + uint16 ele_attrmask; /* floating, secure, selected, etc. */ + uint16 image_status; + uint8 is_transparent; + lo_SuppressMode suppress_mode; /* For temp icon, temp border, etc. */ + int16 alt_len; + int16 sel_start; + int16 sel_end; + intn seq_num; + PRPackedBool pending_mocha_event; + LO_ImageStruct *next_image; /* next image in list for this document */ }; /* Tiling mode for implementing CSS's background-repeat property */ typedef enum { - /* The code depends on specific values for this enum - don't change them. */ - LO_TILE_BOTH = 0, /* Tile in both X and Y direction */ - LO_TILE_HORIZ = 1, /* Tile horizontally only */ - LO_TILE_VERT = 2, /* Tile vertically only */ - LO_NO_TILE = 3 /* Don't tile */ + /* The code depends on specific values for this enum - don't change them. */ + LO_TILE_BOTH = 0, /* Tile in both X and Y direction */ + LO_TILE_HORIZ = 1, /* Tile horizontally only */ + LO_TILE_VERT = 2, /* Tile vertically only */ + LO_NO_TILE = 3 /* Don't tile */ } lo_TileMode; /* An (optionally) tiled backdrop image, optionally on top of a solid color */ typedef struct { - LO_Color *bg_color; /* Solid color, or NULL, if transparent */ - char *url; /* String URL or NULL, if no backdrop image */ - lo_TileMode tile_mode; /* CSS tiling mode for backdrop image */ + LO_Color *bg_color; /* Solid color, or NULL, if transparent */ + char *url; /* String URL or NULL, if no backdrop image */ + lo_TileMode tile_mode; /* CSS tiling mode for backdrop image */ } lo_Backdrop; struct LO_SubDocStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - void *FE_Data; - void *state; /* Hack-o-rama to opaque the lo_DocState type */ - lo_Backdrop backdrop; /* To carry over into CellStruct */ - LO_AnchorData *anchor_href; - LO_TextAttr *text_attr; - int32 alignment; - int32 vert_alignment; - int32 horiz_alignment; - int32 border_width; - int32 border_vert_space; - int32 border_horiz_space; - uint16 ele_attrmask; /* floating, secure, selected, etc. */ - int16 sel_start; - int16 sel_end; + void *FE_Data; + void *state; /* Hack-o-rama to opaque the lo_DocState type */ + lo_Backdrop backdrop; /* To carry over into CellStruct */ + LO_AnchorData *anchor_href; + LO_TextAttr *text_attr; + int32 alignment; + int32 vert_alignment; + int32 horiz_alignment; + int32 border_width; + int32 border_vert_space; + int32 border_horiz_space; + uint16 ele_attrmask; /* floating, secure, selected, etc. */ + int16 sel_start; + int16 sel_end; }; @@ -615,24 +615,24 @@ union LO_FormElementData_struct; * Sorry, got carried away there. */ struct lo_FormElementOptionData_struct { - PA_Block text_value; - PA_Block value; - Bool def_selected; - Bool selected; + PA_Block text_value; + PA_Block value; + Bool def_selected; + Bool selected; }; struct lo_FormElementSelectData_struct { - int32 type; - void *FE_Data; - PA_Block name; - int32 size; - Bool disabled; - Bool multiple; - Bool options_valid; - int32 option_cnt; - PA_Block options; /* really a (lo_FormElementOptionData *) */ - PA_Tag *saved_tag; /* mocha weazels need for threading */ + int32 type; + void *FE_Data; + PA_Block name; + int32 size; + Bool disabled; + Bool multiple; + Bool options_valid; + int32 option_cnt; + PA_Block options; /* really a (lo_FormElementOptionData *) */ + PA_Tag *saved_tag; /* mocha weazels need for threading */ }; /* @@ -678,11 +678,11 @@ struct lo_FormElementTextareaData_struct { * FORM_TYPE_BUTTON, FORM_TYPE_READONLY. */ struct lo_FormElementMinimalData_struct { - int32 type; - void *FE_Data; - PA_Block name; - PA_Block value; - Bool disabled; + int32 type; + void *FE_Data; + PA_Block name; + PA_Block value; + Bool disabled; }; @@ -691,13 +691,13 @@ struct lo_FormElementMinimalData_struct { * element_type = FORM_TYPE_RADIO, FORM_TYPE_CHECKBOX. */ struct lo_FormElementToggleData_struct { - int32 type; - void *FE_Data; - PA_Block name; - PA_Block value; - Bool disabled; - Bool default_toggle; - Bool toggled; + int32 type; + void *FE_Data; + PA_Block name; + PA_Block value; + Bool disabled; + Bool default_toggle; + Bool toggled; }; @@ -706,10 +706,10 @@ struct lo_FormElementToggleData_struct { * element_type = FORM_TYPE_OBJECT. */ struct lo_FormElementObjectData_struct { - int32 type; - void *FE_Data; - PA_Block name; - LO_JavaAppStruct *object; + int32 type; + void *FE_Data; + PA_Block name; + LO_JavaAppStruct *object; }; @@ -718,71 +718,71 @@ struct lo_FormElementObjectData_struct { * element_type = FORM_TYPE_KEYGEN. */ struct lo_FormElementKeygenData_struct { - int32 type; - PA_Block name; - PA_Block challenge; - PA_Block key_type; - PA_Block pqg; /* DSA only */ - char *value_str; - PRBool dialog_done; + int32 type; + PA_Block name; + PA_Block challenge; + PA_Block key_type; + PA_Block pqg; /* DSA only */ + char *value_str; + PRBool dialog_done; }; union LO_FormElementData_struct { - int32 type; - lo_FormElementTextData ele_text; - lo_FormElementTextareaData ele_textarea; - lo_FormElementMinimalData ele_minimal; - lo_FormElementToggleData ele_toggle; - lo_FormElementObjectData ele_object; - lo_FormElementSelectData ele_select; - lo_FormElementKeygenData ele_keygen; + int32 type; + lo_FormElementTextData ele_text; + lo_FormElementTextareaData ele_textarea; + lo_FormElementMinimalData ele_minimal; + lo_FormElementToggleData ele_toggle; + lo_FormElementObjectData ele_object; + lo_FormElementSelectData ele_select; + lo_FormElementKeygenData ele_keygen; }; struct LO_FormSubmitData_struct { - PA_Block action; - PA_Block encoding; - PA_Block window_target; - int32 method; - int32 value_cnt; - PA_Block name_array; - PA_Block value_array; - PA_Block type_array; - PA_Block encoding_array; + PA_Block action; + PA_Block encoding; + PA_Block window_target; + int32 method; + int32 value_cnt; + PA_Block name_array; + PA_Block value_array; + PA_Block type_array; + PA_Block encoding_array; }; struct LO_FormElementStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - int32 layer_id; + int32 layer_id; #ifdef MOCHA - struct JSObject *mocha_object; - XP_Bool event_handler_present; /*Indicates whether there's a JS handler */ + struct JSObject *mocha_object; + XP_Bool event_handler_present; /*Indicates whether there's a JS handler */ #endif - int16 border_vert_space; - int16 border_horiz_space; - int32 element_index; - LO_FormElementData *element_data; - LO_TextAttr *text_attr; - int32 baseline; - uint16 ele_attrmask; /* secure, selected, etc. */ - int16 form_id; - int16 sel_start; - int16 sel_end; - CL_Layer *layer; + int16 border_vert_space; + int16 border_horiz_space; + int32 element_index; + LO_FormElementData *element_data; + LO_TextAttr *text_attr; + int32 baseline; + uint16 ele_attrmask; /* secure, selected, etc. */ + int16 form_id; + int16 sel_start; + int16 sel_end; + CL_Layer *layer; }; @@ -806,182 +806,187 @@ struct LO_FormElementStruct_struct { #define LO_CLEAR_TO_BOTH 4 struct LO_LinefeedStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - void *FE_Data; - LO_AnchorData *anchor_href; - LO_TextAttr *text_attr; - int32 baseline; - uint16 ele_attrmask; /* breaking, secure, selected, etc. */ - int16 sel_start; - int16 sel_end; - uint8 break_type; /* is this an end-of-paragraph or a break? */ - uint8 clear_type; /* the clear="" attribute */ + void *FE_Data; + LO_AnchorData *anchor_href; + LO_TextAttr *text_attr; + int32 baseline; + uint16 ele_attrmask; /* breaking, secure, selected, etc. */ + int16 sel_start; + int16 sel_end; + uint8 break_type; /* is this an end-of-paragraph or a break? */ + uint8 clear_type; /* the clear="" attribute */ }; struct LO_HorizRuleStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - int32 end_x, end_y; - void *FE_Data; - uint16 ele_attrmask; /* shaded, secure, selected, etc. */ - int16 alignment; - int16 thickness; /* 1 - 100 */ - int16 sel_start; - int16 sel_end; + int32 end_x, end_y; + void *FE_Data; + uint16 ele_attrmask; /* shaded, secure, selected, etc. */ + int16 alignment; + int16 thickness; /* 1 - 100 */ + int16 sel_start; + int16 sel_end; - int32 percent_width; /* needed for relayout. */ - int32 width_in_initial_layout; /* needed for relayout. */ + int32 percent_width; /* needed for relayout. */ + int32 width_in_initial_layout; /* needed for relayout. */ }; struct LO_BulletStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - void *FE_Data; - int32 bullet_type; - int32 bullet_size; - LO_TextAttr *text_attr; - uint16 ele_attrmask; /* secure, selected, etc. */ - int16 level; - int16 sel_start; - int16 sel_end; + void *FE_Data; + int32 bullet_type; + int32 bullet_size; + LO_TextAttr *text_attr; + uint16 ele_attrmask; /* secure, selected, etc. */ + int16 level; + int16 sel_start; + int16 sel_end; }; struct LO_TableStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - void *FE_Data; - LO_AnchorData *anchor_href; - int32 expected_y; - int32 alignment; - LO_Color border_color; - int32 border_style; - int32 border_width; - int32 border_top_width; - int32 border_right_width; - int32 border_bottom_width; - int32 border_left_width; - int32 border_vert_space; - int32 border_horiz_space; - uint16 ele_attrmask; /* floating, secure, selected, etc. */ - int16 sel_start; - int16 sel_end; - int32 inter_cell_space; /*cmanske: CELLSPACING value - used when drawing table selection feedback */ - void *table; /* Actually a lo_TableRec *. Added for relayout */ + void *FE_Data; + LO_AnchorData *anchor_href; + int32 expected_y; + int32 alignment; + LO_Color border_color; + int32 border_style; + int32 border_width; + int32 border_top_width; + int32 border_right_width; + int32 border_bottom_width; + int32 border_left_width; + int32 border_vert_space; + int32 border_horiz_space; + uint16 ele_attrmask; /* floating, secure, selected, etc. */ + int16 sel_start; + int16 sel_end; + int32 inter_cell_space; /*cmanske: CELLSPACING value - used when drawing table selection feedback */ + void *table; /* Actually a lo_TableRec *. Added for relayout */ }; struct LO_CellStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; - void *FE_Data; - LO_Element *cell_list; - LO_Element *cell_list_end; - LO_Element *cell_float_list; - lo_Backdrop backdrop; - int32 border_width; - int32 border_vert_space; - int32 border_horiz_space; - uint16 ele_attrmask; /* secure, selected, etc. */ - int16 sel_start; - int16 sel_end; - int32 inter_cell_space; /*cmanske: CELLSPACING value - used when drawing cell selection feedback */ - CL_Layer *cell_inflow_layer; /* Non-NULL if this cell - exists to encapsulate - an in-flow layer (ILAYER) */ - CL_Layer *cell_bg_layer; /* BGCOLOR/BACKGROUND for cell */ - void *table_cell; /* An lo_TableCell *. For use during relayout without reload. */ - void *table_row; /* An lo_TableRow *. Parent row state struct */ - void *table; /* An lo_TableRec *. Parent table state struct */ - Bool isCaption; /* Needed for relayout without reload */ + void *FE_Data; + LO_Element *cell_list; + LO_Element *cell_list_end; + LO_Element *cell_float_list; + lo_Backdrop backdrop; + int32 border_width; + int32 border_vert_space; + int32 border_horiz_space; + uint16 ele_attrmask; /* secure, selected, etc. */ + int16 sel_start; + int16 sel_end; + int32 inter_cell_space; /*cmanske: CELLSPACING value - used when drawing cell selection feedback */ + CL_Layer *cell_inflow_layer; /* Non-NULL if this cell + exists to encapsulate + an in-flow layer (ILAYER) */ + CL_Layer *cell_bg_layer; /* BGCOLOR/BACKGROUND for cell */ + void *table_cell; /* An lo_TableCell *. For use during relayout without reload. */ + void *table_row; /* An lo_TableRow *. Parent row state struct */ + void *table; /* An lo_TableRec *. Parent table state struct */ + Bool isCaption; /* Needed for relayout without reload */ }; +#ifdef OJI +struct lo_NVList { + uint32 n; /* number of name/value pairs */ + char** names; + char** values; +}; -struct LO_EmbedStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; - - void * FE_Data; - void *session_data; - PA_Block embed_src; - int32 attribute_cnt; - char **attribute_list; - char **value_list; - int32 alignment; - int32 border_width; - int32 border_vert_space; - int32 border_horiz_space; - uint16 ele_attrmask; /* floating, secure, selected, etc. */ - int32 embed_index; /* Unique ID within this doc */ - struct LO_EmbedStruct_struct *nextEmbed; -#ifdef MOCHA - struct JSObject *mocha_object; +#define LO_NVList_Init( pList ) (pList)->n=0; (pList)->names=NULL; (pList)->values=NULL #endif - PA_Tag *tag; - CL_Layer *layer; - int32 percent_width; /* needed for relayout. */ - int32 percent_height; /* needed for relayout. */ +struct LO_CommonPluginStruct_struct { + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; + + void * FE_Data; + void *session_data; + int32 alignment; + int32 border_width; + int32 border_vert_space; + int32 border_horiz_space; + uint16 ele_attrmask; /* floating, secure, selected, etc. */ + int32 embed_index; /* Unique ID within this doc */ + PA_Tag *tag; + CL_Layer *layer; + + int32 percent_width; /* needed for relayout. */ + int32 percent_height; /* needed for relayout. */ + PA_Block base_url; +#ifdef MOCHA + struct JSObject *mocha_object; +#endif }; #ifdef SHACK @@ -1001,9 +1006,13 @@ struct LO_BuiltinStruct_struct { void * FE_Data; void *session_data; PA_Block builtin_src; +#ifndef OJI int32 attribute_cnt; char **attribute_list; char **value_list; +#else + lo_NVList attributes; +#endif /* OJI */ int32 alignment; int32 border_width; int32 border_vert_space; @@ -1022,245 +1031,240 @@ struct LO_BuiltinStruct_struct { }; #endif /* SHACK */ +struct LO_EmbedStruct_struct { + struct LO_CommonPluginStruct_struct objTag; /* "superclass" */ + + struct LO_EmbedStruct_struct *nextEmbed; + PA_Block embed_src; +#ifdef OJI + struct lo_NVList attributes; + struct lo_NVList parameters; +#else + int32 attribute_cnt; + char **attribute_list; + char **value_list; +#endif /* OJI */ +}; + #define LO_JAVA_SELECTOR_APPLET 0 #define LO_JAVA_SELECTOR_OBJECT_JAVA 1 #define LO_JAVA_SELECTOR_OBJECT_JAVAPROGRAM 2 #define LO_JAVA_SELECTOR_OBJECT_JAVABEAN 3 struct LO_JavaAppStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + struct LO_CommonPluginStruct_struct objTag; /* "superclass" */ - void * FE_Data; - void *session_data; - PA_Block base_url; - PA_Block attr_code; - PA_Block attr_codebase; - PA_Block attr_archive; - PA_Block attr_name; - int32 param_cnt; - char **param_names; - char **param_values; - int32 alignment; - int32 border_width; - int32 border_vert_space; - int32 border_horiz_space; - uint16 ele_attrmask; /* floating, secure, selected, etc. */ - int32 embed_index; /* Unique ID within this doc */ - Bool may_script; - /* linked list thread for applets in the current document. - * should be "prev" since they're in reverse order but who's - * counting? */ - struct LO_JavaAppStruct_struct *nextApplet; -#ifdef MOCHA - struct JSObject *mocha_object; -#endif - PA_Tag *tag; - CL_Layer *layer; - /* selector_type indicates whether the tag was an - * APPLET tag or OBJECT tag, and if it was an OBJECT tag, - * whether the protocol selector in CLASSID was "java:", - * "javaprogram:", or "javabean:". - */ - int32 selector_type; + /* linked list thread for applets in the current document. + * should be "prev" since they're in reverse order but who's + * counting? */ + struct LO_JavaAppStruct_struct *nextApplet; - int32 percent_width; /* For relayout */ - int32 percent_height; /* For relayout */ + /* selector_type indicates whether the tag was an + * APPLET tag or OBJECT tag, and if it was an OBJECT tag, + * whether the protocol selector in CLASSID was "java:", + * "javaprogram:", or "javabean:". + */ + int32 selector_type; + PA_Block attr_code; + PA_Block attr_codebase; + PA_Block attr_archive; + PA_Block attr_name; + Bool may_script; +#ifdef OJI + struct lo_NVList attributes; + struct lo_NVList parameters; +#else /* OJI */ + int32 param_cnt; + char **param_names; + char **param_values; +#endif /* OJI */ }; struct LO_EdgeStruct_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; - void * FE_Data; - void *lo_edge_info; - LO_Color *bg_color; - int16 size; - Bool visible; - Bool movable; - Bool is_vertical; - int32 left_top_bound; - int32 right_bottom_bound; + void * FE_Data; + void *lo_edge_info; + LO_Color *bg_color; + int16 size; + Bool visible; + Bool movable; + Bool is_vertical; + int32 left_top_bound; + int32 right_bottom_bound; }; struct LO_Any_struct { - int16 type; - int16 x_offset; - int32 ele_id; - int32 x, y; - int32 y_offset; - int32 width, height; - int32 line_height; - LO_Element *next; - LO_Element *prev; - ED_Element *edit_element; - int32 edit_offset; + int16 type; + int16 x_offset; + int32 ele_id; + int32 x, y; + int32 y_offset; + int32 width, height; + int32 line_height; + LO_Element *next; + LO_Element *prev; + ED_Element *edit_element; + int32 edit_offset; }; /* some DocState mutating elements. */ typedef struct LO_CenterStruct_struct { - LO_Any lo_any; + LO_Any lo_any; - /* nothing really to center elements */ - Bool is_end; + /* nothing really to center elements */ + Bool is_end; } LO_CenterStruct; typedef struct LO_MulticolumnStruct_struct { - LO_Any lo_any; + LO_Any lo_any; - Bool is_end; - PA_Tag *tag; - void *multicol; /* Pointer to lo_MultiCol struct */ + Bool is_end; + PA_Tag *tag; + void *multicol; /* Pointer to lo_MultiCol struct */ } LO_MulticolumnStruct; typedef struct LO_SpacerStruct_struct { - LO_Any lo_any; - - int32 size; - int8 type; - int32 alignment; - Bool floating; - Bool is_percent_width; - int32 width; - Bool is_percent_height; - int32 height; - PA_Tag *tag; + LO_Any lo_any; + + int32 size; + int8 type; + int32 alignment; + Bool floating; + Bool is_percent_width; + int32 width; + Bool is_percent_height; + int32 height; + PA_Tag *tag; } LO_SpacerStruct; typedef struct LO_NoBreakStruct_struct { - LO_Any lo_any; + LO_Any lo_any; - /* nothing really to nobreak elements */ - Bool is_end; + /* nothing really to nobreak elements */ + Bool is_end; } LO_NoBreakStruct; typedef struct LO_ParagraphStruct_struct { - LO_Any lo_any; + LO_Any lo_any; - Bool is_end; - intn blank_lines; + Bool is_end; + intn blank_lines; - /* only used in the close element */ - Bool implicit_end; + /* only used in the close element */ + Bool implicit_end; - /* only used in the open element */ - Bool alignment_set; - int32 alignment; - Bool has_top_ss_margin; - Bool has_bottom_ss_margin; + /* only used in the open element */ + Bool alignment_set; + int32 alignment; + Bool has_top_ss_margin; + Bool has_bottom_ss_margin; } LO_ParagraphStruct; typedef struct LO_FloatStruct_struct { - LO_Any lo_any; + LO_Any lo_any; - LO_Element *float_ele; + LO_Element *float_ele; } LO_FloatStruct; typedef struct LO_ListStruct_struct { - LO_Any lo_any; + LO_Any lo_any; - Bool is_end; + Bool is_end; - PA_Tag *tag; - int32 bullet_type; - int32 bullet_start; - int32 quote_type; - Bool compact; + PA_Tag *tag; + int32 bullet_type; + int32 bullet_start; + int32 quote_type; + Bool compact; } LO_ListStruct; typedef struct LO_DescTitle_struct { - LO_Any lo_any; + LO_Any lo_any; } LO_DescTitleStruct; typedef struct LO_DescText_struct { - LO_Any lo_any; + LO_Any lo_any; } LO_DescTextStruct; typedef struct LO_BlockQuote_struct { - LO_Any lo_any; + LO_Any lo_any; - Bool is_end; - int8 quote_type; - PA_Tag *tag; + Bool is_end; + int8 quote_type; + PA_Tag *tag; } LO_BlockQuoteStruct; typedef struct LO_Layer_struct { - LO_Any lo_any; + LO_Any lo_any; - Bool is_end; - LO_BlockInitializeStruct *initParams; + Bool is_end; + LO_BlockInitializeStruct *initParams; } LO_LayerStruct; typedef struct LO_Heading_struct { - LO_Any lo_any; - - Bool is_end; - int32 alignment; + LO_Any lo_any; + + Bool is_end; + int32 alignment; } LO_HeadingStruct; typedef struct LO_Span_struct { - LO_Any lo_any; + LO_Any lo_any; - Bool is_end; + Bool is_end; #ifdef DOM - /* should probably keep some stuff in here... perhaps - the tag, so we can look up the inline style. */ - void *name_rec; /* Points to lo_NameList * on the named span list */ + /* should probably keep some stuff in here... perhaps + the tag, so we can look up the inline style. */ + void *name_rec; /* Points to lo_NameList * on the named span list */ #endif } LO_SpanStruct; typedef struct LO_Div_struct { - LO_Any lo_any; + LO_Any lo_any; - Bool is_end; - /* should probably keep some stuff in here... perhaps - the tag, so we can look up the inline style. */ + Bool is_end; + /* should probably keep some stuff in here... perhaps + the tag, so we can look up the inline style. */ } LO_DivStruct; union LO_Element_struct { - int16 type; - LO_Any lo_any; - LO_TextStruct lo_text; - LO_TextBlock lo_textBlock; - LO_ImageStruct lo_image; - LO_SubDocStruct lo_subdoc; - LO_FormElementStruct lo_form; - LO_LinefeedStruct lo_linefeed; - LO_HorizRuleStruct lo_hrule; - LO_BulletStruct lo_bullet; - LO_TableStruct lo_table; - LO_CellStruct lo_cell; - LO_EmbedStruct lo_embed; - LO_EdgeStruct lo_edge; - LO_JavaAppStruct lo_java; + int16 type; + LO_Any lo_any; + LO_TextStruct lo_text; + LO_TextBlock lo_textBlock; + LO_ImageStruct lo_image; + LO_SubDocStruct lo_subdoc; + LO_FormElementStruct lo_form; + LO_LinefeedStruct lo_linefeed; + LO_HorizRuleStruct lo_hrule; + LO_BulletStruct lo_bullet; + LO_TableStruct lo_table; + LO_CellStruct lo_cell; + LO_CommonPluginStruct lo_plugin; + LO_EmbedStruct lo_embed; + LO_EdgeStruct lo_edge; + LO_JavaAppStruct lo_java; - /* These next elements do nothing but mutate the doc state. */ - LO_CenterStruct lo_center; - LO_FloatStruct lo_float; - LO_ParagraphStruct lo_paragraph; - LO_MulticolumnStruct lo_multicolumn; - LO_NoBreakStruct lo_nobreak; - LO_ListStruct lo_list; + /* These next elements do nothing but mutate the doc state. */ + LO_CenterStruct lo_center; + LO_FloatStruct lo_float; + LO_ParagraphStruct lo_paragraph; + LO_MulticolumnStruct lo_multicolumn; + LO_NoBreakStruct lo_nobreak; + LO_ListStruct lo_list; LO_DescTitleStruct lo_desctitle; LO_DescTextStruct lo_desctext; LO_BlockQuoteStruct lo_blockquote; @@ -1275,16 +1279,16 @@ union LO_Element_struct { }; struct LO_ObjectStruct_struct { - LO_Element lo_element; - void* stream_closure; + LO_Element lo_element; + void* stream_closure; }; /* #ifndef NO_TAB_NAVIGATION */ #define tabFocusListMax 8 struct LO_tabFocus_struct { - LO_Element *pElement; - int32 mapAreaIndex; /* 0 means no focus, start with index 1. */ - LO_AnchorData *pAnchor; + LO_Element *pElement; + int32 mapAreaIndex; /* 0 means no focus, start with index 1. */ + LO_AnchorData *pAnchor; }; /* NO_TAB_NAVIGATION */ diff --git a/mozilla/include/mk_cx_fn.h b/mozilla/include/mk_cx_fn.h index b0436ded531..087e4306ff2 100644 --- a/mozilla/include/mk_cx_fn.h +++ b/mozilla/include/mk_cx_fn.h @@ -144,9 +144,11 @@ FE_DEFINE(GetTextFrame, void, (MWContext *, LO_TextStruct *, int32, int32, XP_Re FE_DEFINE(GetDefaultBackgroundColor, void, (MWContext* context, LO_Color* color)) #endif #endif +#ifdef TRANSPARENT_APPLET /* these functions are to allow dealyed native window applet creation and transparent applet */ FE_DEFINE(HandleClippingView, void, (MWContext *pContext, struct LJAppletData *appletD, int x, int y, int width, int height)) FE_DEFINE(DrawJavaApp, void, (MWContext *pContext, int iLocation, LO_JavaAppStruct *pJava)) +#endif #undef FE_DEFINE #undef MAKE_FE_FUNCS_PREFIX diff --git a/mozilla/include/np.h b/mozilla/include/np.h index 90c34f99475..1d8a2b52008 100644 --- a/mozilla/include/np.h +++ b/mozilla/include/np.h @@ -18,7 +18,7 @@ /* - * np.h $Revision: 3.1 $ + * np.h $Revision: 3.2 $ * 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. */ @@ -103,7 +103,7 @@ extern void NPL_SamePage(MWContext *context); extern void NPL_SameElement(LO_EmbedStruct *embed); extern void NPL_DeleteSessionData(MWContext* context, void* sessionData); extern XP_Bool NPL_HandleURL(MWContext *pContext, FO_Present_Types iFormatOut, URL_Struct *pURL, - Net_GetUrlExitFunc *pExitFunc); + Net_GetUrlExitFunc *pExitFunc); #ifndef XP_MAC extern void NPL_DisplayPluginsAsHTML(FO_Present_Types format_out, URL_Struct *urls, MWContext *cx); #endif @@ -125,6 +125,7 @@ extern NPError NPL_RegisterAppletType(NPMIMEType type); #endif /* ANTHRAX */ PR_EXTERN(void) NPL_SetPluginWindow(void *data); +PR_EXTERN(struct NPIPlugin*) NPL_LoadPluginByType(const char* typeAttribute); XP_END_PROTOS diff --git a/mozilla/include/npapi.h b/mozilla/include/npapi.h index 289346cb167..208b089cd7a 100644 --- a/mozilla/include/npapi.h +++ b/mozilla/include/npapi.h @@ -18,7 +18,7 @@ /* - * npapi.h $Revision: 3.1 $ + * npapi.h $Revision: 3.2 $ * Netscape client plug-in API spec */ @@ -274,7 +274,8 @@ typedef enum { NPPVpluginWindowBool, NPPVpluginTransparentBool, NPPVjavaClass, - NPPVpluginWindowSize + NPPVpluginWindowSize, + NPPVpluginTimerInterval } NPPVariable; /* diff --git a/mozilla/include/ntypes.h b/mozilla/include/ntypes.h index 9f9caa9d2c5..ee105cf8c7f 100644 --- a/mozilla/include/ntypes.h +++ b/mozilla/include/ntypes.h @@ -88,6 +88,7 @@ typedef struct LO_TextStruct_struct LO_TextStruct; typedef struct LO_ImageAttr_struct LO_ImageAttr; typedef struct LO_ImageStruct_struct LO_ImageStruct; typedef struct LO_SubDocStruct_struct LO_SubDocStruct; +typedef struct LO_CommonPluginStruct_struct LO_CommonPluginStruct; typedef struct LO_EmbedStruct_struct LO_EmbedStruct; #ifdef SHACK typedef struct LO_BuiltinStruct_struct LO_BuiltinStruct; diff --git a/mozilla/js/jsd/Makefile b/mozilla/js/jsd/Makefile index 5760de66887..24637e9945c 100644 --- a/mozilla/js/jsd/Makefile +++ b/mozilla/js/jsd/Makefile @@ -24,6 +24,13 @@ LIBRARY_NAME = jsd # Switching on MOZ_JAVA is a short-term hack. This is really for no Java/IFC ifdef MOZ_JAVA +JAVA_OR_OJI = 1 +endif +ifdef MOZ_OJI +JAVA_OR_OJI = 1 +endif + +ifdef JAVA_OR_OJI DIRS = classes endif diff --git a/mozilla/js/jsj/Makefile b/mozilla/js/jsj/Makefile index 1cdc3c5ee2e..35c82cdefc5 100644 --- a/mozilla/js/jsj/Makefile +++ b/mozilla/js/jsj/Makefile @@ -19,7 +19,9 @@ DEPTH = ../.. -ifdef MOZ_JAVA +include $(DEPTH)/config/config.mk + +ifdef JAVA_OR_OJI DIRS = classes endif @@ -36,7 +38,7 @@ CSRCS = \ JRI_GEN = netscape.javascript.JSObject netscape.javascript.JSException -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI CSRCS += jsjsa.c \ stubs.c \ jsj_nodl.c \ @@ -66,7 +68,7 @@ jsj_nodl.c: $(OBJDIR)/stubs.o Makefile $(DEPTH)/config/nodl.pl `nm -Bn $(OBJDIR)/stubs.o | egrep Java_.*_stub | awk '{print $$3;}'` > $@ endif -ifdef MOZ_JAVA +ifdef JAVA_OR_OJI $(OBJDIR)/stubs.o: \ $(JRI_GEN_DIR)/netscape_javascript_JSObject.c \ $(JRI_GEN_DIR)/netscape_javascript_JSException.c \ diff --git a/mozilla/js/jsj/classes/makefile.win b/mozilla/js/jsj/classes/makefile.win index 74511531ba7..b45b49e9a80 100644 --- a/mozilla/js/jsj/classes/makefile.win +++ b/mozilla/js/jsj/classes/makefile.win @@ -52,6 +52,8 @@ JARS=$(JAR_JSJ) include <$(DEPTH)\config\rules.mak> +!ifdef JAVA_OR_OJI + $(JAR_JSJ): cd $(JAVA_DESTPATH) @echo +++ building/updating $@ @@ -63,6 +65,7 @@ jars: $(JARS) install:: jars +!endif javadoc: -mkdir $(XPDIST)\javadoc 2> NUL diff --git a/mozilla/js/jsj/jsjava.h b/mozilla/js/jsj/jsjava.h index 9445e1c63e6..6f6016bfc45 100644 --- a/mozilla/js/jsj/jsjava.h +++ b/mozilla/js/jsj/jsjava.h @@ -70,7 +70,7 @@ typedef struct { PR_EXTERN(JSBool) JSJ_Init(JSJCallbacks *callbacks); -#ifdef JAVA +#if defined(JAVA) || defined(OJI) /* this is called by JSObject.initClass to initialize the default * glue if jsjava has been loaded into java.exe as a DLL. it does * nothing if the client or server has already initialized us */ @@ -165,6 +165,6 @@ js_GetJSPrincipalsFromJavaCaller(JSContext *cx, int callerDepth); PR_EXTERN(void) jsj_ClearSavedErrors(JSContext *cx); -#endif /* defined(JAVA) */ +#endif /* defined(JAVA) || defined(OJI) */ #endif /* _jsjava_h_ */ diff --git a/mozilla/js/jsj/makefile.win b/mozilla/js/jsj/makefile.win index 148cd2bf8bc..7bd5dbd55ed 100644 --- a/mozilla/js/jsj/makefile.win +++ b/mozilla/js/jsj/makefile.win @@ -30,9 +30,11 @@ IGNORE_MANIFEST=1 #//------------------------------------------------------------------------ DEPTH= ..\.. -!ifdef MOZ_JAVA +include <$(DEPTH)/config/config.mak> + +#!ifdef JAVA_OR_OJI DIRS = classes -!endif +#!endif #//------------------------------------------------------------------------ @@ -51,7 +53,7 @@ MAKE_OBJ_TYPE = DLL DEFFILE = $(DLLNAME).def !endif -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI LLIBS=$(LIBNSPR) $(DIST)\lib\jrt$(MOZ_BITS)$(VERSION_NUMBER).lib \ $(DIST)\lib\js$(MOZ_BITS)$(VERSION_NUMBER).lib !else @@ -63,7 +65,7 @@ LLIBS=$(LIBNSPR) $(DIST)\lib\js$(MOZ_BITS)$(VERSION_NUMBER).lib #// Define the files necessary to build the target (ie. OBJS) #// #//------------------------------------------------------------------------ -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI OBJS= \ .\$(OBJDIR)\jsStubs.obj \ .\$(OBJDIR)\jsjava.obj \ @@ -78,7 +80,7 @@ OBJS= \ .\$(OBJDIR)\jsjava.obj \ .\$(OBJDIR)\jsStubs.obj \ $(NULL) -!endif # MOZ_JAVA +!endif # JAVA_OR_OJI # #//------------------------------------------------------------------------ @@ -103,7 +105,7 @@ JRI_GEN= \ $(NULL) MODULE = java -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI EXPORTS = \ $(JRI_GEN_DIR)/netscape_javascript_JSObject.h \ $(JRI_GEN_DIR)/netscape_javascript_JSException.h \ @@ -141,7 +143,7 @@ export:: $(DLL) INSTALL_FILES clobber:: $(RM_R) _jri -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI .\$(OBJDIR)\stubs.obj: \ $(JRI_GEN_DIR)\netscape_javascript_JSObject.c \ $(JRI_GEN_DIR)\netscape_javascript_JSException.c \ diff --git a/mozilla/js/jsj/stubs.c b/mozilla/js/jsj/stubs.c index f9d0ed215ba..17cd3b68652 100644 --- a/mozilla/js/jsj/stubs.c +++ b/mozilla/js/jsj/stubs.c @@ -23,7 +23,7 @@ !!! HEED THE WARNING. */ -#if defined (JAVA) +#if defined (JAVA) || defined(OJI) #define IMPLEMENT_netscape_javascript_JSObject #define IMPLEMENT_netscape_javascript_JSException diff --git a/mozilla/lib/layout/edtbuf.cpp b/mozilla/lib/layout/edtbuf.cpp index 6f5e8944d4a..dd7103e9e35 100644 --- a/mozilla/lib/layout/edtbuf.cpp +++ b/mozilla/lib/layout/edtbuf.cpp @@ -8728,6 +8728,7 @@ void CEditBuffer::PrintTree( CEditElement* pElement ){ if ( bCheckForSelectionAsComment){ CheckAndPrintComment(pElement->Leaf(), printState.m_selection, FALSE); } + pElement->PrintOpen( &printState ); while( pNext ){ diff --git a/mozilla/lib/layout/laycell.c b/mozilla/lib/layout/laycell.c index 063ad4d628c..9f7f8414a3f 100644 --- a/mozilla/lib/layout/laycell.c +++ b/mozilla/lib/layout/laycell.c @@ -329,17 +329,17 @@ static void lo_MoveElementLayers( LO_Element *eptr ) } else if (eptr->type == LO_EMBED) { - CL_MoveLayer(eptr->lo_embed.layer, - eptr->lo_any.x + eptr->lo_any.x_offset + eptr->lo_embed.border_width, - eptr->lo_any.y + eptr->lo_any.y_offset + eptr->lo_embed.border_width); + CL_MoveLayer(eptr->lo_embed.objTag.layer, + eptr->lo_any.x + eptr->lo_any.x_offset + eptr->lo_embed.objTag.border_width, + eptr->lo_any.y + eptr->lo_any.y_offset + eptr->lo_embed.objTag.border_width); } #ifdef JAVA else if (eptr->type == LO_JAVA) { - CL_MoveLayer(eptr->lo_java.layer, - eptr->lo_any.x + eptr->lo_any.x_offset + eptr->lo_java.border_width, - eptr->lo_any.y + eptr->lo_any.y_offset + eptr->lo_java.border_width); + CL_MoveLayer(eptr->lo_java.objTag.layer, + eptr->lo_any.x + eptr->lo_any.x_offset + eptr->lo_java.objTag.border_width, + eptr->lo_any.y + eptr->lo_any.y_offset + eptr->lo_java.objTag.border_width); } #endif diff --git a/mozilla/lib/layout/laydisp.c b/mozilla/lib/layout/laydisp.c index aa55722235f..c561f1d0fd5 100644 --- a/mozilla/lib/layout/laydisp.c +++ b/mozilla/lib/layout/laydisp.c @@ -300,21 +300,21 @@ lo_DisplayEmbed(MWContext *context, LO_EmbedStruct *embed) } /* Don't ever display hidden embeds */ - if (embed->ele_attrmask & LO_ELE_HIDDEN) + if (embed->objTag.ele_attrmask & LO_ELE_HIDDEN) return; - layer = embed->layer; + layer = embed->objTag.layer; XP_ASSERT(layer); if (! layer) /* Paranoia */ return; - if (!(embed->ele_attrmask & LO_ELE_DRAWN)) { + if (!(embed->objTag.ele_attrmask & LO_ELE_DRAWN)) { /* Move layer to new position */ CL_MoveLayer(layer, - embed->x + embed->x_offset, - embed->y + embed->y_offset); + embed->objTag.x + embed->objTag.x_offset, + embed->objTag.y + embed->objTag.y_offset); CL_SetLayerHidden(layer, PR_FALSE); - embed->ele_attrmask |= LO_ELE_DRAWN; + embed->objTag.ele_attrmask |= LO_ELE_DRAWN; } } @@ -358,21 +358,21 @@ lo_DisplayJavaApp(MWContext *context, LO_JavaAppStruct *java_app) return; } - layer = java_app->layer; + layer = java_app->objTag.layer; XP_ASSERT(layer); if (! layer) /* Paranoia */ return; - if (!(java_app->ele_attrmask & LO_ELE_DRAWN)) { + if (!(java_app->objTag.ele_attrmask & LO_ELE_DRAWN)) { /* Move layer to new position */ CL_MoveLayer(layer, - java_app->x + java_app->x_offset, - java_app->y + java_app->y_offset); + java_app->objTag.x + java_app->objTag.x_offset, + java_app->objTag.y + java_app->objTag.y_offset); /* Now that layer is layed out to its final position, we can display it */ CL_SetLayerHidden(layer, PR_FALSE); - java_app->ele_attrmask |= LO_ELE_DRAWN; + java_app->objTag.ele_attrmask |= LO_ELE_DRAWN; } } #endif diff --git a/mozilla/lib/layout/layembed.c b/mozilla/lib/layout/layembed.c index a44a8d9f22e..78f3590c48e 100644 --- a/mozilla/lib/layout/layembed.c +++ b/mozilla/lib/layout/layembed.c @@ -26,7 +26,6 @@ #include "laystyle.h" #include "layers.h" - #ifdef ANTHRAX /* 9.23.97 amusil */ #include "prefapi.h" #endif /* ANTHRAX */ @@ -160,13 +159,13 @@ LO_ClearEmbedBlock(MWContext *context, LO_EmbedStruct *embed) if (top_state->layout_blocking_element == (LO_Element *)embed) { - if (embed->width == 0) + if (embed->objTag.width == 0) { - embed->width = EMBED_DEF_DIM; + embed->objTag.width = EMBED_DEF_DIM; } - if (embed->height == 0) + if (embed->objTag.height == 0) { - embed->height = EMBED_DEF_DIM; + embed->objTag.height = EMBED_DEF_DIM; } main_doc_state = top_state->doc_state; @@ -234,22 +233,30 @@ lo_FormatEmbed(MWContext *context, lo_DocState *state, PA_Tag *tag) return; } - embed->type = LO_EMBED; - embed->ele_id = NEXT_ELEMENT; - embed->x = state->x; - embed->x_offset = 0; - embed->y = state->y; - embed->y_offset = 0; - embed->width = 0; - embed->height = 0; - embed->next = NULL; - embed->prev = NULL; - embed->attribute_cnt = 0; - embed->attribute_list = NULL; - embed->value_list = NULL; + embed->objTag.type = LO_EMBED; + embed->objTag.ele_id = NEXT_ELEMENT; + embed->objTag.x = state->x; + embed->objTag.x_offset = 0; + embed->objTag.y = state->y; + embed->objTag.y_offset = 0; + embed->objTag.width = 0; + embed->objTag.height = 0; + embed->objTag.next = NULL; + embed->objTag.prev = NULL; +#ifdef OJI + LO_NVList_Init( &embed->attributes ); + LO_NVList_Init( &embed->parameters ); - embed->attribute_cnt = PA_FetchAllNameValues(tag, - &(embed->attribute_list), &(embed->value_list), CS_FE_ASCII); + embed->attributes.n = PA_FetchAllNameValues(tag, + &(embed->attributes.names), &(embed->attributes.values), CS_FE_ASCII); +#else + embed->attribute_cnt = 0; + embed->attribute_list = NULL; + embed->value_list = NULL; + + embed->attribute_cnt = PA_FetchAllNameValues(tag, + &(embed->attribute_list), &(embed->value_list), CS_FE_ASCII); +#endif lo_FormatEmbedInternal(context, state, tag, embed, FALSE, FALSE); #ifdef ANTHRAX @@ -268,32 +275,41 @@ lo_FormatEmbedObject(MWContext* context, lo_DocState* state, int32 typeIndex = -1; int32 classidIndex = -1; - embed->attribute_cnt = 0; - embed->attribute_list = NULL; - embed->value_list = NULL; - - embed->attribute_cnt = PA_FetchAllNameValues(tag, - &(embed->attribute_list), &(embed->value_list), CS_FE_ASCII); +#ifdef OJI + LO_NVList_Init(&embed->attributes); + embed->attributes.n = PA_FetchAllNameValues(tag, + &(embed->attributes.names), &(embed->attributes.values), CS_FE_ASCII); +#else + embed->attribute_cnt = 0; + embed->attribute_list = NULL; + embed->value_list = NULL; + + embed->attribute_cnt = PA_FetchAllNameValues(tag, + &(embed->attribute_list), &(embed->value_list), CS_FE_ASCII); +#endif +#ifdef OJI + /* XXX */ +#else /* * Look through the parameters and replace "id" * with "name" and "data" with "src", so that * other code that looks up parameters by name * can believe this is a normal EMBED. */ - for (count = 0; count < (uint32)embed->attribute_cnt; count++) - { - if (XP_STRCASECMP(embed->attribute_list[count], PARAM_ID) == 0) - StrAllocCopy(embed->attribute_list[count], PARAM_NAME); - else if (XP_STRCASECMP(embed->attribute_list[count], PARAM_DATA) == 0) - StrAllocCopy(embed->attribute_list[count], "src"); - else if (XP_STRCASECMP(embed->attribute_list[count], PARAM_TYPE) == 0) - typeIndex = count; - else if (XP_STRCASECMP(embed->attribute_list[count], PARAM_CLASSID) == 0) - classidIndex = count; - } - + for (count = 0; count < (uint32)embed->attribute_cnt; count++) + { + if (XP_STRCASECMP(embed->attribute_list[count], PARAM_ID) == 0) + StrAllocCopy(embed->attribute_list[count], PARAM_NAME); + else if (XP_STRCASECMP(embed->attribute_list[count], PARAM_DATA) == 0) + StrAllocCopy(embed->attribute_list[count], "src"); + else if (XP_STRCASECMP(embed->attribute_list[count], PARAM_TYPE) == 0) + typeIndex = count; + else if (XP_STRCASECMP(embed->attribute_list[count], PARAM_CLASSID) == 0) + classidIndex = count; + } + /* * If we have a CLASSID attribute, add the appropriate * TYPE attribute. @@ -303,8 +319,8 @@ lo_FormatEmbedObject(MWContext* context, lo_DocState* state, if (typeIndex >= 0) { /* Change current value of TYPE to application/oleobject */ - if (XP_STRCASECMP(embed->value_list[typeIndex], APPLICATION_OLEOBJECT) != 0) - StrAllocCopy(embed->value_list[typeIndex], APPLICATION_OLEOBJECT); + if (XP_STRCASECMP(embed->value_list[typeIndex], APPLICATION_OLEOBJECT) != 0) + StrAllocCopy(embed->value_list[typeIndex], APPLICATION_OLEOBJECT); } else { @@ -314,9 +330,9 @@ lo_FormatEmbedObject(MWContext* context, lo_DocState* state, names[0] = XP_STRDUP(PARAM_TYPE); values[0] = XP_STRDUP(APPLICATION_OLEOBJECT); - lo_AppendParamList((uint32*) &(embed->attribute_cnt), - &(embed->attribute_list), - &(embed->value_list), + lo_AppendParamList((uint32*) &(embed->attribute_cnt), + &(embed->attribute_list), + &(embed->value_list), 1, names, values); } @@ -328,33 +344,54 @@ lo_FormatEmbedObject(MWContext* context, lo_DocState* state, (XP_STRLEN(classID) + 1) * sizeof(char)); } } +#endif /* * Merge any parameters passed in with the ones in this tag. * Separate the merged tag attributes from the * tag attributes with an extra "PARAM" attribute. */ +#ifdef OJI + LO_NVList_Init(&embed->parameters); +#endif + if (param_count > 0) { - char* names[1]; - char* values[1]; - names[0] = XP_STRDUP(PT_PARAM); - values[0] = NULL; - - /* Add "PARAM" to the list */ - lo_AppendParamList((uint32*) &(embed->attribute_cnt), - &(embed->attribute_list), - &(embed->value_list), - 1, names, values); +#ifdef OJI + int i; + + /* Add all tag parameters to the parameters list */ + embed->parameters.names = (char**) PA_ALLOC(param_count*sizeof(char*)); + embed->parameters.values = (char**) PA_ALLOC(param_count*sizeof(char*)); + + XP_MEMCPY( embed->parameters.names, + param_names, + param_count*sizeof(char*) ); + XP_MEMCPY( embed->parameters.values, + param_values, + param_count*sizeof(char*) ); + embed->parameters.n = param_count; +#else + char* names[1]; + char* values[1]; + names[0] = XP_STRDUP(PT_PARAM); + values[0] = NULL; + + /* Add "PARAM" to the list */ + lo_AppendParamList((uint32*) &(embed->attribute_cnt), + &(embed->attribute_list), + &(embed->value_list), + 1, names, values); + + /* Add all tag paramters to the list */ + lo_AppendParamList((uint32*) &(embed->attribute_cnt), + &(embed->attribute_list), + &(embed->value_list), + param_count, + param_names, + param_values); +#endif /* OJI */ - /* Add all tag paramters to the list */ - lo_AppendParamList((uint32*) &(embed->attribute_cnt), - &(embed->attribute_list), - &(embed->value_list), - param_count, - param_names, - param_values); - if (param_names != NULL) XP_FREE(param_names); if (param_values != NULL) @@ -379,28 +416,34 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, embed->nextEmbed= NULL; #ifdef MOCHA - embed->mocha_object = NULL; + embed->objTag.mocha_object = NULL; #endif - embed->FE_Data = NULL; - embed->session_data = NULL; - embed->line_height = state->line_height; + embed->objTag.FE_Data = NULL; + embed->objTag.session_data = NULL; + embed->objTag.line_height = state->line_height; embed->embed_src = NULL; - embed->alignment = LO_ALIGN_BASELINE; - embed->border_width = EMBED_DEF_BORDER; - embed->border_vert_space = EMBED_DEF_VERTICAL_SPACE; - embed->border_horiz_space = EMBED_DEF_HORIZONTAL_SPACE; - embed->tag = tag; - embed->ele_attrmask = 0; + embed->objTag.alignment = LO_ALIGN_BASELINE; + embed->objTag.border_width = EMBED_DEF_BORDER; + embed->objTag.border_vert_space = EMBED_DEF_VERTICAL_SPACE; + embed->objTag.border_horiz_space = EMBED_DEF_HORIZONTAL_SPACE; + embed->objTag.tag = tag; + embed->objTag.ele_attrmask = 0; + embed->objTag.base_url = NULL; if (streamStarted) - embed->ele_attrmask |= LO_ELE_STREAM_STARTED; + embed->objTag.ele_attrmask |= LO_ELE_STREAM_STARTED; /* * Convert any javascript in the values */ +#ifdef OJI + lo_ConvertAllValues(context, embed->attributes.values, embed->attributes.n, + tag->newline_count); +#else lo_ConvertAllValues(context, embed->value_list, embed->attribute_cnt, tag->newline_count); +#endif /* don't double-count loading plugins due to table relayout */ if (!state->in_relayout) @@ -412,7 +455,7 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, * Assign a unique index for this object * and increment the master index. */ - embed->embed_index = state->top_state->embed_count++; + embed->objTag.embed_index = state->top_state->embed_count++; /* * Check for the hidden attribute value. @@ -444,7 +487,7 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, if (hidden != FALSE) { - embed->ele_attrmask |= LO_ELE_HIDDEN; + embed->objTag.ele_attrmask |= LO_ELE_HIDDEN; /* marcb says: had to disable the printed hidden audio feature */ if (context->type==MWContextPrint){ return; @@ -454,6 +497,24 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, } } + /* + * Save away the base of the document + */ + buff = PA_ALLOC(XP_STRLEN(state->top_state->base_url) + 1); + if (buff != NULL) + { + char *cp; + PA_LOCK(cp, char*, buff); + XP_STRCPY(cp, state->top_state->base_url); + PA_UNLOCK(buff); + embed->objTag.base_url = buff; + } + else + { + state->top_state->out_of_memory = TRUE; + return; + } + /* * Check for an align parameter */ @@ -464,10 +525,10 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, floating = FALSE; PA_LOCK(str, char *, buff); - embed->alignment = lo_EvalAlignParam(str, &floating); + embed->objTag.alignment = lo_EvalAlignParam(str, &floating); if (floating != FALSE) { - embed->ele_attrmask |= LO_ELE_FLOATING; + embed->objTag.ele_attrmask |= LO_ELE_FLOATING; } PA_UNLOCK(buff); PA_FREE(buff); @@ -549,12 +610,12 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, val = lo_ValueOrPercent(str, &is_percent); if (is_percent != FALSE) { - embed->percent_width = val; + embed->objTag.percent_width = val; } else { - embed->percent_width = 0; - embed->width = val; + embed->objTag.percent_width = 0; + embed->objTag.width = val; val = FEUNITS_X(val, context); } PA_UNLOCK(buff); @@ -564,8 +625,8 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, val = LO_GetWidthFromStyleSheet(context, state); if(val) { - embed->width = val; - embed->percent_width = 0; + embed->objTag.width = val; + embed->objTag.percent_width = 0; widthSpecified = TRUE; } @@ -585,14 +646,14 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, val = lo_ValueOrPercent(str, &is_percent); if (is_percent != FALSE) { - embed->percent_height = val; + embed->objTag.percent_height = val; } else { - embed->percent_height = 0; + embed->objTag.percent_height = 0; val = FEUNITS_Y(val, context); } - embed->height = val; + embed->objTag.height = val; PA_UNLOCK(buff); PA_FREE(buff); heightSpecified = TRUE; @@ -601,8 +662,8 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, val = LO_GetHeightFromStyleSheet(context, state); if(val) { - embed->height = val; - embed->percent_height = 0; + embed->objTag.height = val; + embed->objTag.percent_height = 0; heightSpecified = TRUE; } @@ -612,22 +673,22 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, * Don't do this for Windows, because they want to block * layout for unsized OLE objects. (Eventually all FEs will * want to support this behavior when there's a plug-in API - * to specify the desired size of the object.) + * to specify the desired size of the objTag.) */ if (!widthSpecified) { if (heightSpecified) - embed->width = embed->height; + embed->objTag.width = embed->objTag.height; else - embed->width = EMBED_DEF_DIM; + embed->objTag.width = EMBED_DEF_DIM; } if (!heightSpecified) { if (widthSpecified) - embed->height = embed->width; + embed->objTag.height = embed->objTag.width; else - embed->height = EMBED_DEF_DIM; + embed->objTag.height = EMBED_DEF_DIM; } #endif /* ifndef XP_WIN */ @@ -645,11 +706,11 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, { val = 0; } - embed->border_vert_space = val; + embed->objTag.border_vert_space = val; PA_UNLOCK(buff); PA_FREE(buff); } - embed->border_vert_space = FEUNITS_Y(embed->border_vert_space, context); + embed->objTag.border_vert_space = FEUNITS_Y(embed->objTag.border_vert_space, context); /* * Get the extra horizontal space parameter. @@ -663,11 +724,11 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, { val = 0; } - embed->border_horiz_space = val; + embed->objTag.border_horiz_space = val; PA_UNLOCK(buff); PA_FREE(buff); } - embed->border_horiz_space = FEUNITS_X(embed->border_horiz_space, + embed->objTag.border_horiz_space = FEUNITS_X(embed->objTag.border_horiz_space, context); /* @@ -681,14 +742,14 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, /* * If there is still valid data to restore available. */ - if (embed->embed_index < embed_list->embed_count) + if (embed->objTag.embed_index < embed_list->embed_count) { lo_EmbedDataElement* embed_data_list; PA_LOCK(embed_data_list, lo_EmbedDataElement*, embed_list->embed_data_list); - embed->session_data = - embed_data_list[embed->embed_index].data; + embed->objTag.session_data = + embed_data_list[embed->objTag.embed_index].data; PA_UNLOCK(embed_list->embed_data_list); } } @@ -725,7 +786,7 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, for (i = count-1; i >= 0; i--) { if (i == doc_lists->embed_list_count) { /* Copy over the mocha object (it might not exist) */ - embed->mocha_object = cur_embed->mocha_object; + embed->objTag.mocha_object = cur_embed->objTag.mocha_object; embed->nextEmbed = cur_embed->nextEmbed; @@ -758,7 +819,7 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, /* Create an initially hidden layer for this plugin to inhabit. If the plugin is a windowless plugin, this will later become a "normal" layer. If the plugin is a windowed plugin, the layer will become a cutout layer. */ - embed->layer = + embed->objTag.layer = lo_CreateEmbeddedObjectLayer(context, state, (LO_Element*)embed); /* @@ -770,10 +831,10 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, /* * Hidden embeds always have 0 width and height */ - if (embed->ele_attrmask & LO_ELE_HIDDEN) + if (embed->objTag.ele_attrmask & LO_ELE_HIDDEN) { - embed->width = 0; - embed->height = 0; + embed->objTag.width = 0; + embed->objTag.height = 0; } /* @@ -781,8 +842,8 @@ lo_FormatEmbedInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, * when the front end can give us the width and height. * Never block on hidden embeds. */ - if (((embed->width == 0)||(embed->height == 0))&& - ((embed->ele_attrmask & LO_ELE_HIDDEN) == 0)) + if (((embed->objTag.width == 0)||(embed->objTag.height == 0))&& + ((embed->objTag.ele_attrmask & LO_ELE_HIDDEN) == 0)) { state->top_state->layout_blocking_element = (LO_Element *)embed; } @@ -806,39 +867,39 @@ lo_FinishEmbed(MWContext *context, lo_DocState *state, LO_EmbedStruct *embed) * front end. * Hidden embeds are supposed to have 0 width and height. */ - if ((embed->ele_attrmask & LO_ELE_HIDDEN) == 0) + if ((embed->objTag.ele_attrmask & LO_ELE_HIDDEN) == 0) { - if (embed->width == 0) + if (embed->objTag.width == 0) { - embed->width = EMBED_DEF_DIM; + embed->objTag.width = EMBED_DEF_DIM; } - if (embed->height == 0) + if (embed->objTag.height == 0) { - embed->height = EMBED_DEF_DIM; + embed->objTag.height = EMBED_DEF_DIM; } } - embed_width = embed->width + (2 * embed->border_width) + - (2 * embed->border_horiz_space); - embed_height = embed->height + (2 * embed->border_width) + - (2 * embed->border_vert_space); + embed_width = embed->objTag.width + (2 * embed->objTag.border_width) + + (2 * embed->objTag.border_horiz_space); + embed_height = embed->objTag.height + (2 * embed->objTag.border_width) + + (2 * embed->objTag.border_vert_space); /* * SEVERE FLOW BREAK! This may be a floating embed, * which means at this point we go do something completely * different. */ - if (embed->ele_attrmask & LO_ELE_FLOATING) + if (embed->objTag.ele_attrmask & LO_ELE_FLOATING) { - embed->x_offset += (int16)embed->border_horiz_space; - embed->y_offset += (int32)embed->border_vert_space; + embed->objTag.x_offset += (int16)embed->objTag.border_horiz_space; + embed->objTag.y_offset += (int32)embed->objTag.border_vert_space; /* * Insert this element into the float list. */ - embed->next = state->float_list; + embed->objTag.next = state->float_list; state->float_list = (LO_Element *)embed; lo_AppendFloatInLineList(state, (LO_Element*)embed, NULL); @@ -868,8 +929,8 @@ lo_FinishEmbed(MWContext *context, lo_DocState *state, LO_EmbedStruct *embed) } - embed->x_offset += (int16)embed->border_horiz_space; - embed->y_offset += (int32)embed->border_vert_space; + embed->objTag.x_offset += (int16)embed->objTag.border_horiz_space; + embed->objTag.y_offset += (int32)embed->objTag.border_vert_space; lo_LayoutInflowEmbed(context, state, embed, FALSE, &line_inc, &baseline_inc); @@ -897,22 +958,22 @@ lo_RelayoutEmbed ( MWContext *context, lo_DocState *state, LO_EmbedStruct * embe /* * Fill in the embed structure with default data */ - embed->type = LO_EMBED; - embed->ele_id = NEXT_ELEMENT; - embed->x = state->x; - embed->x_offset = 0; - embed->y = state->y; - embed->y_offset = 0; - embed->next = NULL; - embed->prev = NULL; + embed->objTag.type = LO_EMBED; + embed->objTag.ele_id = NEXT_ELEMENT; + embed->objTag.x = state->x; + embed->objTag.x_offset = 0; + embed->objTag.y = state->y; + embed->objTag.y_offset = 0; + embed->objTag.next = NULL; + embed->objTag.prev = NULL; - embed->line_height = state->line_height; + embed->objTag.line_height = state->line_height; /* * Assign a unique index for this object * and increment the master index. */ - embed->embed_index = state->top_state->embed_count++; + embed->objTag.embed_index = state->top_state->embed_count++; /* * Since we saved the embed_list_count during table relayout, @@ -933,8 +994,8 @@ lo_RelayoutEmbed ( MWContext *context, lo_DocState *state, LO_EmbedStruct * embe * I don't think we need to worry about blocking at all since we're in * relayout, but I'd rather be safe. */ - if (((embed->width == 0)||(embed->height == 0))&& - ((embed->ele_attrmask & LO_ELE_HIDDEN) == 0)) + if (((embed->objTag.width == 0)||(embed->objTag.height == 0))&& + ((embed->objTag.ele_attrmask & LO_ELE_HIDDEN) == 0)) { state->top_state->layout_blocking_element = (LO_Element *)embed; } @@ -1024,7 +1085,7 @@ LO_CopySavedEmbedData(MWContext *context, SHIST_SavedData *saved_data) void LO_AddEmbedData(MWContext *context, LO_EmbedStruct* embed, void *session_data) { - lo_AddEmbedData(context, session_data, NPL_DeleteSessionData, embed->embed_index); + lo_AddEmbedData(context, session_data, NPL_DeleteSessionData, embed->objTag.embed_index); } @@ -1037,10 +1098,10 @@ lo_FillInEmbedGeometry(lo_DocState *state, if (relayout == TRUE) { - embed->ele_id = NEXT_ELEMENT; + embed->objTag.ele_id = NEXT_ELEMENT; } - embed->x = state->x; - embed->y = state->y; + embed->objTag.x = state->x; + embed->objTag.y = state->y; doc_width = state->right_margin - state->left_margin; @@ -1049,27 +1110,27 @@ lo_FillInEmbedGeometry(lo_DocState *state, * If percentage, make it absolute. */ - if (embed->percent_width > 0) { - int32 val = embed->percent_width; + if (embed->objTag.percent_width > 0) { + int32 val = embed->objTag.percent_width; if (state->allow_percent_width == FALSE) { val = 0; } else { val = doc_width * val / 100; } - embed->width = val; + embed->objTag.width = val; } - /* Set embed->height if embed has a % height specified */ - if (embed->percent_height > 0) { - int32 val = embed->percent_height; + /* Set embed->objTag.height if embed has a % height specified */ + if (embed->objTag.percent_height > 0) { + int32 val = embed->objTag.percent_height; if (state->allow_percent_height == FALSE) { val = 0; } else { val = state->win_height * val / 100; } - embed->height = val; + embed->objTag.height = val; } } @@ -1112,10 +1173,10 @@ lo_LayoutInflowEmbed(MWContext *context, FE_GetTextInfo(context, &tmp_text, &text_info); PA_FREE(buff); - embed_width = embed->width + (2 * embed->border_width) + - (2 * embed->border_horiz_space); - embed_height = embed->height + (2 * embed->border_width) + - (2 * embed->border_vert_space); + embed_width = embed->objTag.width + (2 * embed->objTag.border_width) + + (2 * embed->objTag.border_horiz_space); + embed_height = embed->objTag.height + (2 * embed->objTag.border_width) + + (2 * embed->objTag.border_vert_space); /* * Will this embed make the line too wide. @@ -1152,7 +1213,7 @@ lo_LayoutInflowEmbed(MWContext *context, * We need to make the elements sequential, linefeed * before embed. */ - top_state->element_id = embed->ele_id; + top_state->element_id = embed->objTag.ele_id; if (!inRelayout) { @@ -1162,14 +1223,14 @@ lo_LayoutInflowEmbed(MWContext *context, { lo_rl_AddSoftBreakAndFlushLine(context, state); } - embed->x = state->x; - embed->y = state->y; - embed->ele_id = NEXT_ELEMENT; + embed->objTag.x = state->x; + embed->objTag.y = state->y; + embed->objTag.ele_id = NEXT_ELEMENT; } - lo_CalcAlignOffsets(state, &text_info, (intn)embed->alignment, + lo_CalcAlignOffsets(state, &text_info, (intn)embed->objTag.alignment, embed_width, embed_height, - &embed->x_offset, &embed->y_offset, line_inc, baseline_inc); + &embed->objTag.x_offset, &embed->objTag.y_offset, line_inc, baseline_inc); } void @@ -1180,36 +1241,36 @@ lo_LayoutFloatEmbed(MWContext *context, { int32 embed_width; - embed_width = embed->width + (2 * embed->border_width) + - (2 * embed->border_horiz_space); - if (embed->alignment == LO_ALIGN_RIGHT) + embed_width = embed->objTag.width + (2 * embed->objTag.border_width) + + (2 * embed->objTag.border_horiz_space); + if (embed->objTag.alignment == LO_ALIGN_RIGHT) { if (state->right_margin_stack == NULL) { - embed->x = state->right_margin - embed_width; + embed->objTag.x = state->right_margin - embed_width; } else { - embed->x = state->right_margin_stack->margin - + embed->objTag.x = state->right_margin_stack->margin - embed_width; } - if (embed->x < 0) + if (embed->objTag.x < 0) { - embed->x = 0; + embed->objTag.x = 0; } } else { - embed->x = state->left_margin; + embed->objTag.x = state->left_margin; } - embed->y = -1; + embed->objTag.y = -1; - lo_AddMarginStack(state, embed->x, embed->y, - embed->width, embed->height, - embed->border_width, - embed->border_vert_space, embed->border_horiz_space, - (intn)embed->alignment); + lo_AddMarginStack(state, embed->objTag.x, embed->objTag.y, + embed->objTag.width, embed->objTag.height, + embed->objTag.border_width, + embed->objTag.border_vert_space, embed->objTag.border_horiz_space, + (intn)embed->objTag.alignment); if (state->at_begin_line != FALSE) { @@ -1227,8 +1288,8 @@ lo_UpdateStateAfterEmbedLayout(lo_DocState *state, int32 embed_width; int32 x, y; - embed_width = embed->width + (2 * embed->border_width) + - (2 * embed->border_horiz_space); + embed_width = embed->objTag.width + (2 * embed->objTag.border_width) + + (2 * embed->objTag.border_horiz_space); state->baseline += (intn) baseline_inc; state->line_height += (intn) (baseline_inc + line_inc); @@ -1236,25 +1297,25 @@ lo_UpdateStateAfterEmbedLayout(lo_DocState *state, /* * Clean up state */ - state->x = state->x + embed->x_offset + - embed_width - embed->border_horiz_space; + state->x = state->x + embed->objTag.x_offset + + embed_width - embed->objTag.border_horiz_space; state->linefeed_state = 0; state->at_begin_line = FALSE; state->trailing_space = FALSE; state->cur_ele_type = LO_EMBED; /* Determine the new position of the layer. */ - x = embed->x + embed->x_offset + embed->border_width; - y = embed->y + embed->y_offset + embed->border_width; + x = embed->objTag.x + embed->objTag.x_offset + embed->objTag.border_width; + y = embed->objTag.y + embed->objTag.y_offset + embed->objTag.border_width; /* Move layer to new position */ - CL_MoveLayer(embed->layer, x, y); + CL_MoveLayer(embed->objTag.layer, x, y); } void LO_SetEmbedSize( MWContext *context, LO_EmbedStruct *embed, int32 width, int32 height ) { /* For now, just setting the embed's dimensions. Do we need to lock/unlock layout here? */ - embed->width = width; - embed->height = height; + embed->objTag.width = width; + embed->objTag.height = height; } diff --git a/mozilla/lib/layout/layform.c b/mozilla/lib/layout/layform.c index 10fc76e58bc..59668a72058 100644 --- a/mozilla/lib/layout/layform.c +++ b/mozilla/lib/layout/layform.c @@ -22,7 +22,9 @@ #include "shist.h" #include "pa_parse.h" #include "layout.h" +#ifdef JAVA #include "java.h" +#endif #include "laylayer.h" #include "libevent.h" #include "libimg.h" /* Image Library public API. */ @@ -2893,7 +2895,7 @@ lo_get_form_element_data(MWContext *context, name = lo_dup_block(form_data->name); - object_value = LJ_Applet_GetText(form_data->object->session_data); + object_value = LJ_Applet_GetText(form_data->object->objTag.session_data); value = PA_ALLOC(XP_STRLEN(object_value) + 1); if (value != NULL) { diff --git a/mozilla/lib/layout/layfree.c b/mozilla/lib/layout/layfree.c index 1554915a22a..a29185242e0 100644 --- a/mozilla/lib/layout/layfree.c +++ b/mozilla/lib/layout/layfree.c @@ -21,7 +21,9 @@ #ifdef EDITOR #include "edt.h" #endif +#ifdef JAVA #include "java.h" +#endif #include "layers.h" #include "pa_parse.h" @@ -34,6 +36,40 @@ extern void NPL_DeleteSessionData(MWContext*, void*); #pragma profile on #endif +#ifdef OJI +static void +lo_FreeNVListItems(struct lo_NVList* list) +{ + + if (list->names != NULL) + { + uint32 current; + + for (current=0; currentn; current++) + { + PA_FREE(list->names[current]); + list->names[current] = NULL; + } + + PA_FREE(list->names); + list->names = NULL; + } + if (list->values != NULL) + { + int32 current; + + for (current=0; currentn; current++) + { + PA_FREE(list->values[current]); + list->values[current] = NULL; + } + + PA_FREE(list->values); + list->values = NULL; + } + list->n = 0; +} +#endif void lo_FreeFormElementData(LO_FormElementData *element_data) @@ -474,36 +510,40 @@ lo_ScrapeElement(MWContext *context, LO_Element *element) PA_FREE(element->lo_embed.embed_src); } element->lo_embed.embed_src = NULL; +#ifdef OJI + lo_FreeNVListItems( &element->lo_embed.attributes ); + lo_FreeNVListItems( &element->lo_embed.parameters ); +#else + /* Free all the attribute names */ + if (element->lo_embed.attribute_list != NULL) + { + int32 current; + + for (current=0; currentlo_embed.attribute_cnt; current++) + { + PA_FREE(element->lo_embed.attribute_list[current]); + element->lo_embed.attribute_list[current] = NULL; + } + + PA_FREE(element->lo_embed.attribute_list); + element->lo_embed.attribute_list = NULL; + } - /* Free all the attribute names */ - if (element->lo_embed.attribute_list != NULL) - { - int32 current; - - for (current=0; currentlo_embed.attribute_cnt; current++) - { - PA_FREE(element->lo_embed.attribute_list[current]); - element->lo_embed.attribute_list[current] = NULL; - } - - PA_FREE(element->lo_embed.attribute_list); - element->lo_embed.attribute_list = NULL; - } - - /* Free all the attribute values */ - if (element->lo_embed.value_list != NULL) - { - int32 current; - - for (current=0; currentlo_embed.attribute_cnt; current++) - { - PA_FREE(element->lo_embed.value_list[current]); - element->lo_embed.value_list[current] = NULL; - } - - PA_FREE(element->lo_embed.value_list); - element->lo_embed.value_list = NULL; - } + /* Free all the attribute values */ + if (element->lo_embed.value_list != NULL) + { + int32 current; + + for (current=0; currentlo_embed.attribute_cnt; current++) + { + PA_FREE(element->lo_embed.value_list[current]); + element->lo_embed.value_list[current] = NULL; + } + + PA_FREE(element->lo_embed.value_list); + element->lo_embed.value_list = NULL; + } +#endif /* OJI */ /* * If there is session data here after we @@ -513,10 +553,10 @@ lo_ScrapeElement(MWContext *context, LO_Element *element) * Otherwise, save the NULL. */ lo_AddEmbedData(context, - element->lo_embed.session_data, + element->lo_embed.objTag.session_data, NPL_DeleteSessionData, - element->lo_embed.embed_index); - element->lo_embed.session_data = NULL; + element->lo_embed.objTag.embed_index); + element->lo_embed.objTag.session_data = NULL; break; #ifdef SHACK case LO_BUILTIN: @@ -527,7 +567,7 @@ lo_ScrapeElement(MWContext *context, LO_Element *element) #ifdef JAVA case LO_JAVA: - FE_HideJavaAppElement(context, element->lo_java.session_data); + FE_HideJavaAppElement(context, element->lo_java.objTag.session_data); if (element->lo_java.attr_code != NULL) { PA_FREE(element->lo_java.attr_code); @@ -548,37 +588,42 @@ lo_ScrapeElement(MWContext *context, LO_Element *element) PA_FREE(element->lo_java.attr_name); element->lo_java.attr_name = NULL; } - if (element->lo_java.base_url != NULL) - { - PA_FREE(element->lo_java.base_url); - element->lo_java.base_url = NULL; - } - if (element->lo_java.param_names != NULL) - { - int32 current; - - for (current=0; currentlo_java.param_cnt; current++) - { - PA_FREE(element->lo_java.param_names[current]); - element->lo_java.param_names[current] = NULL; - } - - PA_FREE(element->lo_java.param_names); - element->lo_java.param_names = NULL; - } - if (element->lo_java.param_values != NULL) - { - int32 current; - - for (current=0; currentlo_java.param_cnt; current++) - { - PA_FREE(element->lo_java.param_values[current]); - element->lo_java.param_values[current] = NULL; - } - - PA_FREE(element->lo_java.param_values); - element->lo_java.param_values = NULL; - } + if (element->lo_java.objTag.base_url != NULL) + { + PA_FREE(element->lo_java.objTag.base_url); + element->lo_java.objTag.base_url = NULL; + } +#ifdef OJI + lo_FreeNVListItems( &element->lo_java.attributes ); + lo_FreeNVListItems( &element->lo_java.parameters ); +#else + if (element->lo_java.param_names != NULL) + { + int32 current; + + for (current=0; currentlo_java.param_cnt; current++) + { + PA_FREE(element->lo_java.param_names[current]); + element->lo_java.param_names[current] = NULL; + } + + PA_FREE(element->lo_java.param_names); + element->lo_java.param_names = NULL; + } + if (element->lo_java.param_values != NULL) + { + int32 current; + + for (current=0; currentlo_java.param_cnt; current++) + { + PA_FREE(element->lo_java.param_values[current]); + element->lo_java.param_values[current] = NULL; + } + + PA_FREE(element->lo_java.param_values); + element->lo_java.param_values = NULL; + } +#endif /* OJI */ /* * If there is session data here after we @@ -588,10 +633,10 @@ lo_ScrapeElement(MWContext *context, LO_Element *element) * Otherwise, save the NULL. */ lo_AddEmbedData(context, - element->lo_java.session_data, + element->lo_java.objTag.session_data, LJ_DeleteSessionData, - element->lo_java.embed_index); - element->lo_java.session_data = NULL; + element->lo_java.objTag.embed_index); + element->lo_java.objTag.session_data = NULL; break; #endif /* JAVA */ case LO_IMAGE: @@ -1046,3 +1091,4 @@ LO_EmptyRecyclingBin(MWContext *context) #ifdef PROFILE #pragma profile off #endif + diff --git a/mozilla/lib/layout/layjava.c b/mozilla/lib/layout/layjava.c index c410a3ef948..322c3448b37 100644 --- a/mozilla/lib/layout/layjava.c +++ b/mozilla/lib/layout/layjava.c @@ -21,9 +21,12 @@ #include "pa_parse.h" #include "layout.h" #include "laylayer.h" +#ifdef JAVA #include "java.h" +#endif #include "laystyle.h" #include "layers.h" +#include "np.h" #define JAVA_DEF_DIM 50 #define JAVA_DEF_BORDER 0 @@ -36,6 +39,7 @@ static void lo_FormatJavaAppInternal(MWContext *context, PA_Tag *tag, LO_JavaAppStruct *java_app); +#if 0 /* not used */ void LO_ClearJavaAppBlock(MWContext *context, LO_JavaAppStruct *java_app) { @@ -73,7 +77,7 @@ LO_ClearJavaAppBlock(MWContext *context, LO_JavaAppStruct *java_app) lo_FlushBlockage(context, state, main_doc_state); } } - +#endif void lo_FormatJavaObject(MWContext *context, lo_DocState *state, PA_Tag *tag, LO_JavaAppStruct *java_app) @@ -97,12 +101,12 @@ lo_FormatJavaObject(MWContext *context, lo_DocState *state, PA_Tag *tag, LO_Java if (java_app->selector_type == LO_JAVA_SELECTOR_OBJECT_JAVAPROGRAM) { - java_app->ele_attrmask |= LO_ELE_HIDDEN; + java_app->objTag.ele_attrmask |= LO_ELE_HIDDEN; } else { /* Get the HIDDEN parameter */ - java_app->ele_attrmask = 0; + java_app->objTag.ele_attrmask = 0; buff = lo_FetchParamValue(context, tag, PARAM_HIDDEN); if (buff != NULL) { @@ -127,7 +131,7 @@ lo_FormatJavaObject(MWContext *context, lo_DocState *state, PA_Tag *tag, LO_Java if (hidden != FALSE) { - java_app->ele_attrmask |= LO_ELE_HIDDEN; + java_app->objTag.ele_attrmask |= LO_ELE_HIDDEN; } } } @@ -136,6 +140,7 @@ lo_FormatJavaObject(MWContext *context, lo_DocState *state, PA_Tag *tag, LO_Java lo_FormatJavaAppInternal(context, state, tag, java_app); } +#define JAVA_PLUGIN_MIMETYPE "application/x-java-vm" void lo_FormatJavaApp(MWContext *context, lo_DocState *state, PA_Tag *tag) @@ -151,18 +156,18 @@ lo_FormatJavaApp(MWContext *context, lo_DocState *state, PA_Tag *tag) return; } - java_app->type = LO_JAVA; - java_app->ele_id = NEXT_ELEMENT; - java_app->x = state->x; - java_app->x_offset = 0; - java_app->y = state->y; - java_app->y_offset = 0; - java_app->width = 0; - java_app->height = 0; - java_app->next = NULL; - java_app->prev = NULL; + java_app->objTag.type = LO_JAVA; + java_app->objTag.ele_id = NEXT_ELEMENT; + java_app->objTag.x = state->x; + java_app->objTag.x_offset = 0; + java_app->objTag.y = state->y; + java_app->objTag.y_offset = 0; + java_app->objTag.width = 0; + java_app->objTag.height = 0; + java_app->objTag.next = NULL; + java_app->objTag.prev = NULL; - java_app->ele_attrmask = 0; + java_app->objTag.ele_attrmask = 0; java_app->selector_type = LO_JAVA_SELECTOR_APPLET; /* Finish formatting the object */ @@ -183,38 +188,43 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO java_app->nextApplet = NULL; #ifdef MOCHA - java_app->mocha_object = NULL; + java_app->objTag.mocha_object = NULL; #endif - java_app->FE_Data = NULL; - java_app->session_data = NULL; - java_app->line_height = state->line_height; + java_app->objTag.FE_Data = NULL; + java_app->objTag.session_data = NULL; + java_app->objTag.line_height = state->line_height; - java_app->base_url = NULL; + java_app->objTag.base_url = NULL; java_app->attr_code = NULL; java_app->attr_codebase = NULL; java_app->attr_archive = NULL; java_app->attr_name = NULL; - java_app->param_cnt = 0; - java_app->param_names = NULL; - java_app->param_values = NULL; +#ifdef OJI + LO_NVList_Init( &java_app->attributes ); + LO_NVList_Init( &java_app->parameters ); +#else + java_app->param_cnt = 0; + java_app->param_names = NULL; + java_app->param_values = NULL; +#endif java_app->may_script = FALSE; - java_app->alignment = LO_ALIGN_BASELINE; - java_app->border_width = JAVA_DEF_BORDER; - java_app->border_vert_space = JAVA_DEF_VERTICAL_SPACE; - java_app->border_horiz_space = JAVA_DEF_HORIZONTAL_SPACE; + java_app->objTag.alignment = LO_ALIGN_BASELINE; + java_app->objTag.border_width = JAVA_DEF_BORDER; + java_app->objTag.border_vert_space = JAVA_DEF_VERTICAL_SPACE; + java_app->objTag.border_horiz_space = JAVA_DEF_HORIZONTAL_SPACE; - java_app->layer = NULL; - java_app->tag = tag; + java_app->objTag.layer = NULL; + java_app->objTag.tag = tag; /* * Assign a unique index for this object * and increment the master index. */ - java_app->embed_index = state->top_state->embed_count++; + java_app->objTag.embed_index = state->top_state->embed_count++; /* * Save away the base of the document @@ -226,7 +236,7 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO PA_LOCK(cp, char*, buff); XP_STRCPY(cp, state->top_state->base_url); PA_UNLOCK(buff); - java_app->base_url = buff; + java_app->objTag.base_url = buff; } else { @@ -244,10 +254,10 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO floating = FALSE; PA_LOCK(str, char *, buff); - java_app->alignment = lo_EvalAlignParam(str, &floating); + java_app->objTag.alignment = lo_EvalAlignParam(str, &floating); if (floating != FALSE) { - java_app->ele_attrmask |= LO_ELE_FLOATING; + java_app->objTag.ele_attrmask |= LO_ELE_FLOATING; } PA_UNLOCK(buff); PA_FREE(buff); @@ -354,12 +364,12 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO val = lo_ValueOrPercent(str, &is_percent); if (is_percent != FALSE) { - java_app->percent_width = val; + java_app->objTag.percent_width = val; } else { - java_app->percent_width = 0; - java_app->width = val; + java_app->objTag.percent_width = 0; + java_app->objTag.width = val; val = FEUNITS_X(val, context); } PA_UNLOCK(buff); @@ -369,7 +379,7 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO val = LO_GetWidthFromStyleSheet(context, state); if(val) { - java_app->width = val; + java_app->objTag.width = val; widthSpecified = TRUE; } @@ -386,14 +396,14 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO val = lo_ValueOrPercent(str, &is_percent); if (is_percent != FALSE) { - java_app->percent_height = val; + java_app->objTag.percent_height = val; } else { - java_app->percent_height = 0; + java_app->objTag.percent_height = 0; val = FEUNITS_Y(val, context); } - java_app->height = val; + java_app->objTag.height = val; PA_UNLOCK(buff); PA_FREE(buff); heightSpecified = TRUE; @@ -402,7 +412,7 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO val = LO_GetHeightFromStyleSheet(context, state); if(val) { - java_app->height = val; + java_app->objTag.height = val; heightSpecified = TRUE; } @@ -410,7 +420,7 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO if (!widthSpecified) { val = 0; if (heightSpecified) { - val = java_app->height; + val = java_app->objTag.height; } else if (state->allow_percent_width) { val = state->win_width * 90 / 100; @@ -418,14 +428,14 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO if (val < 1) { val = 600; } - java_app->width = val; + java_app->objTag.width = val; } /* If they forgot to specify a height, make one up. */ if (!heightSpecified) { val = 0; if (widthSpecified) { - val = java_app->width; + val = java_app->objTag.width; } else if (state->allow_percent_height) { val = state->win_height / 2; @@ -433,16 +443,16 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO if (val < 1) { val = 400; } - java_app->height = val; + java_app->objTag.height = val; } /* After going through all the trouble, just to make sure * the object tag HIDDEN case is covered as well. */ - if (java_app->ele_attrmask & LO_ELE_HIDDEN) + if (java_app->objTag.ele_attrmask & LO_ELE_HIDDEN) { - java_app->width = 0; - java_app->height = 0; + java_app->objTag.width = 0; + java_app->objTag.height = 0; } /* @@ -457,11 +467,11 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO { val = 0; } - java_app->border_width = val; + java_app->objTag.border_width = val; PA_UNLOCK(buff); PA_FREE(buff); } - java_app->border_width = FEUNITS_X(java_app->border_width, context); + java_app->objTag.border_width = FEUNITS_X(java_app->objTag.border_width, context); /* * Get the extra vertical space parameter. @@ -475,11 +485,11 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO { val = 0; } - java_app->border_vert_space = val; + java_app->objTag.border_vert_space = val; PA_UNLOCK(buff); PA_FREE(buff); } - java_app->border_vert_space = FEUNITS_Y(java_app->border_vert_space, + java_app->objTag.border_vert_space = FEUNITS_Y(java_app->objTag.border_vert_space, context); /* @@ -494,11 +504,11 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO { val = 0; } - java_app->border_horiz_space = val; + java_app->objTag.border_horiz_space = val; PA_UNLOCK(buff); PA_FREE(buff); } - java_app->border_horiz_space = FEUNITS_X(java_app->border_horiz_space, + java_app->objTag.border_horiz_space = FEUNITS_X(java_app->objTag.border_horiz_space, context); lo_FillInJavaAppGeometry(state, java_app, FALSE); @@ -514,14 +524,14 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO /* * If there is still valid data to restore available. */ - if (java_app->embed_index < embed_list->embed_count) + if (java_app->objTag.embed_index < embed_list->embed_count) { lo_EmbedDataElement* embed_data_list; PA_LOCK(embed_data_list, lo_EmbedDataElement*, embed_list->embed_data_list); - java_app->session_data = - embed_data_list[java_app->embed_index].data; + java_app->objTag.session_data = + embed_data_list[java_app->objTag.embed_index].data; PA_UNLOCK(embed_list->embed_data_list); } } @@ -556,7 +566,7 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO for (i = count-1; i >= 0; i--) { if (i == doc_lists->applet_list_count) { /* Copy over the mocha object (it might not exist) */ - java_app->mocha_object = cur_applet->mocha_object; + java_app->objTag.mocha_object = cur_applet->objTag.mocha_object; java_app->nextApplet = cur_applet->nextApplet; @@ -587,7 +597,7 @@ lo_FormatJavaAppInternal(MWContext *context, lo_DocState *state, PA_Tag *tag, LO } } - +#ifdef JAVA void lo_FinishJavaApp(MWContext *context, lo_DocState *state, LO_JavaAppStruct *java_app) @@ -596,9 +606,9 @@ lo_FinishJavaApp(MWContext *context, lo_DocState *state, int32 line_inc; int32 java_app_height, java_app_width; - if ( java_app->layer == NULL ) + if ( java_app->objTag.layer == NULL ) { - java_app->layer = + java_app->objTag.layer = lo_CreateEmbeddedObjectLayer(context, state, (LO_Element*)java_app); } @@ -609,35 +619,35 @@ lo_FinishJavaApp(MWContext *context, lo_DocState *state, * have dims here from either the image tag itself or the * front end. */ - if (java_app->width == 0) + if (java_app->objTag.width == 0) { - java_app->width = JAVA_DEF_DIM; + java_app->objTag.width = JAVA_DEF_DIM; } - if (java_app->height == 0) + if (java_app->objTag.height == 0) { - java_app->height = JAVA_DEF_DIM; + java_app->objTag.height = JAVA_DEF_DIM; } } - java_app_width = java_app->width + (2 * java_app->border_width) + - (2 * java_app->border_horiz_space); - java_app_height = java_app->height + (2 * java_app->border_width) + - (2 * java_app->border_vert_space); + java_app_width = java_app->objTag.width + (2 * java_app->objTag.border_width) + + (2 * java_app->objTag.border_horiz_space); + java_app_height = java_app->objTag.height + (2 * java_app->objTag.border_width) + + (2 * java_app->objTag.border_vert_space); /* * SEVERE FLOW BREAK! This may be a floating java_app, * which means at this point we go do something completely * different. */ - if (java_app->ele_attrmask & LO_ELE_FLOATING) + if (java_app->objTag.ele_attrmask & LO_ELE_FLOATING) { - java_app->x_offset += (int16)java_app->border_horiz_space; - java_app->y_offset += java_app->border_vert_space; + java_app->objTag.x_offset += (int16)java_app->objTag.border_horiz_space; + java_app->objTag.y_offset += java_app->objTag.border_vert_space; /* * Insert this element into the float list. */ - java_app->next = state->float_list; + java_app->objTag.next = state->float_list; state->float_list = (LO_Element *)java_app; lo_AppendFloatInLineList(state, (LO_Element*)java_app, NULL); @@ -649,7 +659,7 @@ lo_FinishJavaApp(MWContext *context, lo_DocState *state, * the java side before we ever try to display * (which the following if might do). */ - if (java_app->session_data == NULL && !EDT_IS_EDITOR( context )) + if (java_app->objTag.session_data == NULL && !EDT_IS_EDITOR( context )) { /* * This creates an applet in the java airspace, @@ -680,8 +690,8 @@ lo_FinishJavaApp(MWContext *context, lo_DocState *state, state->baseline = 0; } - java_app->x_offset += (int16)java_app->border_horiz_space; - java_app->y_offset += java_app->border_vert_space; + java_app->objTag.x_offset += (int16)java_app->objTag.border_horiz_space; + java_app->objTag.y_offset += java_app->objTag.border_vert_space; lo_LayoutInflowJavaApp(context, state, java_app, FALSE, &line_inc, &baseline_inc); @@ -690,7 +700,7 @@ lo_FinishJavaApp(MWContext *context, lo_DocState *state, lo_UpdateStateAfterJavaAppLayout(state, java_app, line_inc, baseline_inc); - if (java_app->session_data == NULL && !EDT_IS_EDITOR( context )) { + if (java_app->objTag.session_data == NULL && !EDT_IS_EDITOR( context )) { /* ** This creates an applet in the java airspace, sends it the init ** message and sets up the session_data of the java_app structure: @@ -708,16 +718,16 @@ lo_CloseJavaApp(MWContext *context, lo_DocState *state, ** Create the applet first (if there wasn't a saved one in the ** history). That way we'll be able to remember reload method. */ - if (java_app->session_data == NULL && !EDT_IS_EDITOR( context )) { + if (java_app->objTag.session_data == NULL && !EDT_IS_EDITOR( context )) { /* ** This creates an applet in the java airspace, sends it the init ** message and sets up the session_data of the java_app structure: */ LJ_CreateApplet(java_app, context, state->top_state->force_reload); - lo_AddEmbedData(context, java_app->session_data, + lo_AddEmbedData(context, java_app->objTag.session_data, LJ_DeleteSessionData, - java_app->embed_index); + java_app->objTag.embed_index); } /* @@ -735,7 +745,7 @@ lo_CloseJavaApp(MWContext *context, lo_DocState *state, * is being commented out. */ /* - if ((java_app->width == 0)||(java_app->height == 0)) + if ((java_app->objTag.width == 0)||(java_app->objTag.height == 0)) { state->top_state->layout_blocking_element = (LO_Element *)java_app; @@ -749,7 +759,7 @@ lo_CloseJavaApp(MWContext *context, lo_DocState *state, state->current_java = NULL; } - +#endif /* JAVA */ void lo_RelayoutJavaApp(MWContext *context, lo_DocState *state, PA_Tag *tag, @@ -763,16 +773,16 @@ lo_RelayoutJavaApp(MWContext *context, lo_DocState *state, PA_Tag *tag, return; } - java_app->x = state->x; - java_app->x_offset = 0; - java_app->y = state->y; - java_app->y_offset = 0; + java_app->objTag.x = state->x; + java_app->objTag.x_offset = 0; + java_app->objTag.y = state->y; + java_app->objTag.y_offset = 0; /* * Assign a unique index for this object * and increment the master index. */ - java_app->embed_index = state->top_state->embed_count++; + java_app->objTag.embed_index = state->top_state->embed_count++; /* * Since we saved the applet_list_count during table relayout, @@ -795,10 +805,10 @@ lo_FillInJavaAppGeometry(lo_DocState *state, if (relayout == TRUE) { - java_app->ele_id = NEXT_ELEMENT; + java_app->objTag.ele_id = NEXT_ELEMENT; } - java_app->x = state->x; - java_app->y = state->y; + java_app->objTag.x = state->x; + java_app->objTag.y = state->y; doc_width = state->right_margin - state->left_margin; @@ -807,27 +817,27 @@ lo_FillInJavaAppGeometry(lo_DocState *state, * If percentage, make it absolute. */ - if (java_app->percent_width > 0) { - int32 val = java_app->percent_width; + if (java_app->objTag.percent_width > 0) { + int32 val = java_app->objTag.percent_width; if (state->allow_percent_width == FALSE) { val = 0; } else { val = doc_width * val / 100; } - java_app->width = val; + java_app->objTag.width = val; } - /* Set java_app->height if java_app has a % height specified */ - if (java_app->percent_height > 0) { - int32 val = java_app->percent_height; + /* Set java_app->objTag.height if java_app has a % height specified */ + if (java_app->objTag.percent_height > 0) { + int32 val = java_app->objTag.percent_height; if (state->allow_percent_height == FALSE) { val = 0; } else { val = state->win_height * val / 100; } - java_app->height = val; + java_app->objTag.height = val; } } @@ -867,10 +877,10 @@ lo_LayoutInflowJavaApp(MWContext *context, FE_GetTextInfo(context, &tmp_text, &text_info); PA_FREE(buff); - java_app_width = java_app->width + (2 * java_app->border_width) + - (2 * java_app->border_horiz_space); - java_app_height = java_app->height + (2 * java_app->border_width) + - (2 * java_app->border_vert_space); + java_app_width = java_app->objTag.width + (2 * java_app->objTag.border_width) + + (2 * java_app->objTag.border_horiz_space); + java_app_height = java_app->objTag.height + (2 * java_app->objTag.border_width) + + (2 * java_app->objTag.border_vert_space); /* * Will this java_app make the line too wide. @@ -907,7 +917,7 @@ lo_LayoutInflowJavaApp(MWContext *context, * We need to make the elements sequential, linefeed * before java app. */ - state->top_state->element_id = java_app->ele_id; + state->top_state->element_id = java_app->objTag.ele_id; if (!inRelayout) { @@ -918,15 +928,15 @@ lo_LayoutInflowJavaApp(MWContext *context, lo_rl_AddSoftBreakAndFlushLine(context, state); } - java_app->x = state->x; - java_app->y = state->y; - java_app->ele_id = NEXT_ELEMENT; + java_app->objTag.x = state->x; + java_app->objTag.y = state->y; + java_app->objTag.ele_id = NEXT_ELEMENT; } - lo_CalcAlignOffsets(state, &text_info, java_app->alignment, + lo_CalcAlignOffsets(state, &text_info, java_app->objTag.alignment, java_app_width, java_app_height, - &java_app->x_offset, &java_app->y_offset, + &java_app->objTag.x_offset, &java_app->objTag.y_offset, line_inc, baseline_inc); } @@ -938,29 +948,29 @@ lo_LayoutFloatJavaApp(MWContext *context, { int32 java_app_width; - java_app_width = (2 * java_app->border_width) + - (2 * java_app->border_horiz_space); + java_app_width = (2 * java_app->objTag.border_width) + + (2 * java_app->objTag.border_horiz_space); - if (java_app->alignment == LO_ALIGN_RIGHT) + if (java_app->objTag.alignment == LO_ALIGN_RIGHT) { - java_app->x = state->right_margin - java_app_width; - if (java_app->x < 0) + java_app->objTag.x = state->right_margin - java_app_width; + if (java_app->objTag.x < 0) { - java_app->x = 0; + java_app->objTag.x = 0; } } else { - java_app->x = state->left_margin; + java_app->objTag.x = state->left_margin; } - java_app->y = -1; - lo_AddMarginStack(state, java_app->x, java_app->y, - java_app->width, java_app->height, - java_app->border_width, - java_app->border_vert_space, - java_app->border_horiz_space, - java_app->alignment); + java_app->objTag.y = -1; + lo_AddMarginStack(state, java_app->objTag.x, java_app->objTag.y, + java_app->objTag.width, java_app->objTag.height, + java_app->objTag.border_width, + java_app->objTag.border_vert_space, + java_app->objTag.border_horiz_space, + java_app->objTag.alignment); if (state->at_begin_line != FALSE) { @@ -978,8 +988,8 @@ lo_UpdateStateAfterJavaAppLayout(lo_DocState *state, int32 java_app_width; int32 x, y; - java_app_width = java_app->width + (2 * java_app->border_width) + - (2 * java_app->border_horiz_space); + java_app_width = java_app->objTag.width + (2 * java_app->objTag.border_width) + + (2 * java_app->objTag.border_horiz_space); state->baseline += (intn) baseline_inc; state->line_height += (intn) (baseline_inc + line_inc); @@ -987,17 +997,18 @@ lo_UpdateStateAfterJavaAppLayout(lo_DocState *state, /* * Clean up state */ - state->x = state->x + java_app->x_offset + - java_app_width - java_app->border_horiz_space; + state->x = state->x + java_app->objTag.x_offset + + java_app_width - java_app->objTag.border_horiz_space; state->linefeed_state = 0; state->at_begin_line = FALSE; state->trailing_space = FALSE; state->cur_ele_type = LO_JAVA; /* Determine the new position of the layer. */ - x = java_app->x + java_app->x_offset + java_app->border_width; - y = java_app->y + java_app->y_offset + java_app->border_width; + x = java_app->objTag.x + java_app->objTag.x_offset + java_app->objTag.border_width; + y = java_app->objTag.y + java_app->objTag.y_offset + java_app->objTag.border_width; /* Move layer to new position */ - CL_MoveLayer(java_app->layer, x, y); + CL_MoveLayer(java_app->objTag.layer, x, y); } + diff --git a/mozilla/lib/layout/laylayer.c b/mozilla/lib/layout/laylayer.c index 43301bc8e2c..93cea955725 100644 --- a/mozilla/lib/layout/laylayer.c +++ b/mozilla/lib/layout/laylayer.c @@ -2157,8 +2157,8 @@ lo_window_layer_visibility_changed(CL_Layer *layer, tptr->lo_form.ele_attrmask |= LO_ELE_INVISIBLE * !visible; break; case LO_EMBED: - tptr->lo_embed.ele_attrmask &= ~LO_ELE_INVISIBLE; - tptr->lo_embed.ele_attrmask |= LO_ELE_INVISIBLE * !visible; + tptr->lo_embed.objTag.ele_attrmask &= ~LO_ELE_INVISIBLE; + tptr->lo_embed.objTag.ele_attrmask |= LO_ELE_INVISIBLE * !visible; break; #ifdef SHACK case LO_BUILTIN: @@ -2168,8 +2168,8 @@ lo_window_layer_visibility_changed(CL_Layer *layer, #endif /* SHACK */ #ifdef JAVA case LO_JAVA: - tptr->lo_java.ele_attrmask &= ~LO_ELE_INVISIBLE; - tptr->lo_java.ele_attrmask |= LO_ELE_INVISIBLE * !visible; + tptr->lo_java.objTag.ele_attrmask &= ~LO_ELE_INVISIBLE; + tptr->lo_java.objTag.ele_attrmask |= LO_ELE_INVISIBLE * !visible; break; #endif default: @@ -2241,11 +2241,11 @@ lo_CreateEmbeddedObjectLayer(MWContext *context, break; case LO_EMBED: name = "_PLUGIN"; - tptr->lo_embed.ele_attrmask |= LO_ELE_INVISIBLE; + tptr->lo_embed.objTag.ele_attrmask |= LO_ELE_INVISIBLE; /* We don't commit to the type of a plugin layer until it's known whether or not the plugin is windowless. */ - vspace = tptr->lo_embed.border_vert_space; - hspace = tptr->lo_embed.border_horiz_space; + vspace = tptr->lo_embed.objTag.border_vert_space; + hspace = tptr->lo_embed.objTag.border_horiz_space; is_window = PR_FALSE; break; #ifdef SHACK @@ -2260,9 +2260,9 @@ lo_CreateEmbeddedObjectLayer(MWContext *context, #ifdef JAVA case LO_JAVA: name = "_JAVA_APPLET"; - tptr->lo_java.ele_attrmask |= LO_ELE_INVISIBLE; - vspace = tptr->lo_java.border_vert_space; - hspace = tptr->lo_java.border_horiz_space; + tptr->lo_java.objTag.ele_attrmask |= LO_ELE_INVISIBLE; + vspace = tptr->lo_java.objTag.border_vert_space; + hspace = tptr->lo_java.objTag.border_horiz_space; is_window = PR_TRUE; break; #endif @@ -2333,6 +2333,8 @@ lo_CreateEmbeddedObjectLayer(MWContext *context, * Java Applet layer code * **********************/ + +#ifdef TRANSPARENT_APPLET #ifdef JAVA #include "java.h" @@ -2401,7 +2403,8 @@ LO_SetJavaAppTransparent(LO_JavaAppStruct *javaData) CL_SetLayerBbox(layer, &bbox); } -#endif +#endif /* JAVA */ +#endif /* TRANSPARENT_APPLET */ /********************** * @@ -2444,7 +2447,7 @@ LO_SetEmbedType(LO_EmbedStruct *embed, PRBool is_windowed) XP_Rect bbox; CL_LayerVTable vtable; lo_EmbeddedObjectClosure *closure; - CL_Layer *layer = embed->layer; + CL_Layer *layer = embed->objTag.layer; XP_ASSERT(layer); if (! layer) return; @@ -2475,8 +2478,8 @@ LO_SetEmbedType(LO_EmbedStruct *embed, PRBool is_windowed) /* At this point, the size of the plugin is known. */ bbox.left = 0; bbox.top = 0; - bbox.right = embed->width; - bbox.bottom = embed->height; + bbox.right = embed->objTag.width; + bbox.bottom = embed->objTag.height; CL_SetLayerBbox(layer, &bbox); if (is_windowed && !CL_GetLayerHidden(layer)) diff --git a/mozilla/lib/layout/laymocha.c b/mozilla/lib/layout/laymocha.c index cddd10a0a39..1a2539e5712 100644 --- a/mozilla/lib/layout/laymocha.c +++ b/mozilla/lib/layout/laymocha.c @@ -627,7 +627,7 @@ LO_EnumerateApplets(MWContext *context, int32 layer_id) /* reflect all applets in reverse order */ applet = doc_lists->applet_list; for (index = count-1; index >= 0; index--) { - if (applet->mocha_object == NULL) + if (applet->objTag.mocha_object == NULL) LM_ReflectApplet(context, (void *) applet, NULL, layer_id, index); applet = applet->nextApplet; } @@ -704,7 +704,7 @@ LO_EnumerateEmbeds(MWContext *context, int32 layer_id) /* reflect all embeds in reverse order */ embed = doc_lists->embed_list; for (index = count-1; index >= 0; index--) { - if (embed->mocha_object == NULL) + if (embed->objTag.mocha_object == NULL) LM_ReflectEmbed(context, (void *) embed, NULL, layer_id, index); embed = embed->nextEmbed; } diff --git a/mozilla/lib/layout/layobj.c b/mozilla/lib/layout/layobj.c index d4e703bf3b3..57723e8704e 100644 --- a/mozilla/lib/layout/layobj.c +++ b/mozilla/lib/layout/layobj.c @@ -56,6 +56,7 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag) PA_Block buff; int16 type = LO_NONE; char* str; + char* pluginName; #ifdef ANTHRAX XP_Bool javaMimetypeHandler = FALSE; @@ -83,16 +84,16 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag) * Set up default fields for this object that are common * to all possible object types. */ - object->lo_element.type = LO_NONE; - object->lo_element.lo_any.ele_id = NEXT_ELEMENT; - object->lo_element.lo_any.x = state->x; - object->lo_element.lo_any.x_offset = 0; - object->lo_element.lo_any.y = state->y; - object->lo_element.lo_any.y_offset = 0; - object->lo_element.lo_any.width = 0; - object->lo_element.lo_any.height = 0; - object->lo_element.lo_any.next = NULL; - object->lo_element.lo_any.prev = NULL; + object->lo_element.lo_plugin.type = LO_NONE; + object->lo_element.lo_plugin.ele_id = NEXT_ELEMENT; + object->lo_element.lo_plugin.x = state->x; + object->lo_element.lo_plugin.x_offset = 0; + object->lo_element.lo_plugin.y = state->y; + object->lo_element.lo_plugin.y_offset = 0; + object->lo_element.lo_plugin.width = 0; + object->lo_element.lo_plugin.height = 0; + object->lo_element.lo_plugin.next = NULL; + object->lo_element.lo_plugin.prev = NULL; /* @@ -174,8 +175,9 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag) * It's a COM class ID, so make sure we have an * appropriate plug-in to handle ActiveX controls. */ - if (NPL_FindPluginEnabledForType(APPLICATION_OLEOBJECT) != NULL) + if ((pluginName = NPL_FindPluginEnabledForType(APPLICATION_OLEOBJECT)) != NULL) { + XP_FREE(pluginName); if (type == LO_NONE) type = LO_EMBED; else if (type != LO_EMBED) @@ -187,9 +189,15 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag) (XP_STRNCASECMP(str, "javabean:", 9) == 0) ) { /* It's a Java class */ +#ifdef OJI + if (type == LO_NONE) + type = LO_EMBED; + else if (type != LO_EMBED) /* XXX */ +#else if (type == LO_NONE) type = LO_JAVA; else if (type != LO_JAVA) +#endif type = LO_UNKNOWN; } else @@ -219,8 +227,9 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag) if (buff != NULL) { PA_LOCK(str, char *, buff); - if (NPL_FindPluginEnabledForType(str) != NULL) + if ((pluginName = NPL_FindPluginEnabledForType(str)) != NULL) { + XP_FREE(pluginName); /* It's a plug-in */ if (type == LO_NONE) type = LO_EMBED; @@ -320,7 +329,7 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag) if (type == LO_EMBED) { - object->lo_element.type = LO_EMBED; + object->lo_element.lo_plugin.type = LO_EMBED; } #ifdef SHACK else if (type == LO_BUILTIN) @@ -340,7 +349,7 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag) if (state->current_java != NULL) lo_CloseJavaApp(context, state, state->current_java); - object->lo_element.type = LO_JAVA; + object->lo_element.lo_plugin.type = LO_JAVA; lo_FormatJavaObject(context, state, tag, (LO_JavaAppStruct*) object); /* @@ -360,7 +369,7 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag) #if 0 else if (type == LO_IMAGE) { - object->type = LO_IMAGE; + object->lo_element.lo_plugin.type = LO_IMAGE; lo_FormatImageObject(context, state, tag, (LO_ImageStruct*) object); } #endif /* if 0 */ @@ -401,7 +410,7 @@ lo_FormatObject(MWContext* context, lo_DocState* state, PA_Tag* tag) /* * Otherwise we just don't know what to do with this! */ - object->lo_element.type = LO_UNKNOWN; + object->lo_element.lo_plugin.type = LO_UNKNOWN; } } } @@ -681,30 +690,57 @@ void lo_DeleteObjectStack(lo_ObjectStack* top) { /* Delete parameters */ - if (top->param_count > 0) +#ifdef OJI + if (top->parameters.n > 0) { uint32 index; - - if (top->param_values != NULL) + + if (top->parameters.values != NULL) { - for (index = 0; index < top->param_count; index++) + for (index = 0; index < top->parameters.n; index++) { - if (top->param_names[index] != NULL) - XP_FREE(top->param_names[index]); + if (top->parameters.names[index] != NULL) + XP_FREE(top->parameters.names[index]); } - XP_FREE(top->param_names); + XP_FREE(top->parameters.names); } - if (top->param_values != NULL) + if (top->parameters.values != NULL) { - for (index = 0; index < top->param_count; index++) + for (index = 0; index < top->parameters.n; index++) { - if (top->param_values[index] != NULL) - XP_FREE(top->param_values[index]); + if (top->parameters.values[index] != NULL) + XP_FREE(top->parameters.values[index]); } - XP_FREE(top->param_values); + XP_FREE(top->parameters.values); } } +#else + if (top->param_count > 0) + { + uint32 index; + + if (top->param_values != NULL) + { + for (index = 0; index < top->param_count; index++) + { + if (top->param_names[index] != NULL) + XP_FREE(top->param_names[index]); + } + XP_FREE(top->param_names); + } + + if (top->param_values != NULL) + { + for (index = 0; index < top->param_count; index++) + { + if (top->param_values[index] != NULL) + XP_FREE(top->param_values[index]); + } + XP_FREE(top->param_values); + } + } +#endif /* OJI */ /* Delete tag copy */ if (top->clone_tag != NULL) @@ -732,13 +768,13 @@ lo_CheckObjectBlockage(MWContext* context, lo_DocState* state, lo_ObjectStack* t */ if (top->data_url != NULL) { - XP_ASSERT(object->lo_element.type == LO_NONE); + XP_ASSERT(object->lo_element.lo_plugin.type == LO_NONE); lo_FetchObjectData(context, state, top); } else { XP_ASSERT(FALSE); - object->lo_element.type = LO_UNKNOWN; + object->lo_element.lo_plugin.type = LO_UNKNOWN; } return TRUE; /* Yes, we're the cause of the blockage */ @@ -792,7 +828,7 @@ lo_ProcessObjectTag(MWContext* context, lo_DocState* state, PA_Tag* tag, XP_Bool */ if (blocked == FALSE) { - if (object == NULL || object->lo_element.type == LO_UNKNOWN) + if (object == NULL || object->lo_element.lo_plugin.type == LO_UNKNOWN) { lo_FormatObject(context, state, tag); @@ -848,40 +884,57 @@ lo_ProcessObjectTag(MWContext* context, lo_DocState* state, PA_Tag* tag, XP_Bool */ if (object != NULL && top->formatted_object == FALSE) { - if (object->lo_element.type == LO_EMBED) + if (object->lo_element.lo_plugin.type == LO_EMBED) { lo_FormatEmbedObject(context, - state, - top->clone_tag, - (LO_EmbedStruct*) object, - FALSE, /* Stream not started */ - top->param_count, - top->param_names, - top->param_values); + 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 ); +#else + top->param_count, + top->param_names, + top->param_values); top->formatted_object = TRUE; top->param_count = 0; top->param_names = NULL; top->param_values = NULL; +#endif /* OJI */ } #ifdef SHACK else if (object->lo_element.type == LO_BUILTIN) { lo_FormatBuiltinObject(context, - state, - top->clone_tag, - (LO_BuiltinStruct*) object, - FALSE, /* Stream not started */ - top->param_count, - top->param_names, - top->param_values); + state, + top->clone_tag, + (LO_BuiltinStruct*) 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 ); +#else + top->param_count, + top->param_names, + top->param_values); top->formatted_object = TRUE; top->param_count = 0; top->param_names = NULL; top->param_values = NULL; +#endif /* OJI */ } -#endif +#endif /* SHACK */ + #ifdef JAVA - else if (object->lo_element.type == LO_JAVA) + else if (object->lo_element.lo_plugin.type == LO_JAVA) { lo_CloseJavaApp(context, state, (LO_JavaAppStruct*) object); } @@ -912,22 +965,38 @@ lo_ProcessParamTag(MWContext* context, lo_DocState* state, PA_Tag* tag, XP_Bool * for ownership of the parameter. */ #ifdef JAVA + if (state->current_java != NULL && blocked == FALSE) { LO_JavaAppStruct* java_app = state->current_java; lo_ObjectParam(context, state, tag, +#ifdef OJI + (uint32*) &(java_app->parameters.n), + &(java_app->parameters.names), + &(java_app->parameters.values)); +#else (uint32*) &(java_app->param_cnt), &(java_app->param_names), &(java_app->param_values)); +#endif /* OJI */ } else -#endif + +#endif /* JAVA */ + if (top != NULL && top->read_params == FALSE) { +#ifdef OJI + lo_ObjectParam(context, state, tag, + &(top->parameters.n), + &(top->parameters.names), + &(top->parameters.values)); +#else lo_ObjectParam(context, state, tag, &(top->param_count), &(top->param_names), &(top->param_values)); +#endif /* OJI */ } } } @@ -990,17 +1059,33 @@ LO_NewObjectStream(FO_Present_Types format_out, void* type, { NET_StreamClass* stream = NULL; lo_ObjectStack* top = (lo_ObjectStack*) urls->fe_data; + char* pluginName; if (top != NULL && top->object != NULL) { - if (NPL_FindPluginEnabledForType(urls->content_type) != NULL) + if ((pluginName = NPL_FindPluginEnabledForType(urls->content_type)) != NULL) { /* bing: Internal reference to libplug! */ extern void NPL_EmbedURLExit(URL_Struct*, int, MWContext*); + XP_FREE(pluginName); + /* Now we know the object type */ - top->object->lo_element.type = LO_EMBED; + top->object->lo_element.lo_plugin.type = LO_EMBED; +#ifdef OJI + lo_FormatEmbedObject(top->context, + top->state, + top->clone_tag, + (LO_EmbedStruct*) top->object, + TRUE, + top->parameters.n, + top->parameters.names, + top->parameters.values); + top->parameters.n = 0; + top->parameters.names = NULL; + top->parameters.values = NULL; +#else lo_FormatEmbedObject(top->context, top->state, top->clone_tag, @@ -1012,10 +1097,11 @@ LO_NewObjectStream(FO_Present_Types format_out, void* type, top->param_count = 0; top->param_names = NULL; top->param_values = NULL; +#endif top->formatted_object = TRUE; /* Set the FE data that libplug expects */ - urls->fe_data = top->object->lo_element.lo_embed.FE_Data; + urls->fe_data = top->object->lo_element.lo_plugin.FE_Data; /* Set the exit routine that libplug expects */ NET_SetNewContext(urls, context, NPL_EmbedURLExit); @@ -1056,7 +1142,7 @@ lo_ObjectURLExit(URL_Struct* urls, int status, MWContext* context) LO_ObjectStruct* object = stack->object; if (object != NULL) { - object->lo_element.type = LO_UNKNOWN; + object->lo_element.lo_plugin.type = LO_UNKNOWN; lo_ClearObjectBlock(context, object); } } @@ -1302,15 +1388,27 @@ static void lo_SetJavaArgs(char* tag, LO_JavaAppStruct* current_java) } /* increment and resize array */ - ++(current_java->param_cnt); - current_java->param_names = XP_REALLOC(current_java->param_names, current_java->param_cnt*sizeof(char*)); +#ifdef OJI + ++(current_java->parameters.n); + current_java->parameters.names = XP_REALLOC(current_java->parameters.names, current_java->parameters.n*sizeof(char*)); + XP_ASSERT(current_java->parameters.names); + current_java->parameters.values = XP_REALLOC(current_java->parameters.values, current_java->parameters.n*sizeof(char*)); + XP_ASSERT(current_java->parameters.values); + + /* point the new array elements to the newly allocated paramName and paramValue */ + current_java->parameters.names[current_java->parameters.n-1] = paramName; + current_java->parameters.values[current_java->parameters.n-1] = paramValue; +#else + ++(current_java->param_count); + current_java->param_names = XP_REALLOC(current_java->param_names, current_java->param_count*sizeof(char*)); XP_ASSERT(current_java->param_names); - current_java->param_values = XP_REALLOC(current_java->param_values, current_java->param_cnt*sizeof(char*)); + current_java->param_values = XP_REALLOC(current_java->param_values, current_java->param_count*sizeof(char*)); XP_ASSERT(current_java->param_values); /* point the new array elements to the newly allocated paramName and paramValue */ - current_java->param_names[current_java->param_cnt-1] = paramName; - current_java->param_values[current_java->param_cnt-1] = paramValue; + current_java->param_names[current_java->param_count-1] = paramName; + current_java->param_values[current_java->param_count-1] = paramValue; +#endif } } #endif diff --git a/mozilla/lib/layout/layout.c b/mozilla/lib/layout/layout.c index 9456d3f3abe..5622b13f7d7 100644 --- a/mozilla/lib/layout/layout.c +++ b/mozilla/lib/layout/layout.c @@ -7585,8 +7585,8 @@ void lo_UpdateStateWhileFlushingLine( MWContext *context, lo_DocState *state ) break; #ifdef JAVA case LO_JAVA: - layer = tptr->lo_java.layer; - border_width = tptr->lo_java.border_width; + layer = tptr->lo_java.objTag.layer; + border_width = tptr->lo_java.objTag.border_width; break; #endif #ifdef SHACK @@ -7596,8 +7596,8 @@ void lo_UpdateStateWhileFlushingLine( MWContext *context, lo_DocState *state ) break; #endif case LO_EMBED: - layer = tptr->lo_embed.layer; - border_width = tptr->lo_embed.border_width; + layer = tptr->lo_embed.objTag.layer; + border_width = tptr->lo_embed.objTag.border_width; break; case LO_FORM_ELE: layer = tptr->lo_form.layer; diff --git a/mozilla/lib/layout/layout.h b/mozilla/lib/layout/layout.h index 0e9e2b32145..dd72ecfdc14 100644 --- a/mozilla/lib/layout/layout.h +++ b/mozilla/lib/layout/layout.h @@ -204,9 +204,13 @@ typedef struct lo_LayerStack lo_LayerStack; typedef struct lo_ObjectStack_struct { LO_ObjectStruct *object; struct lo_ObjectStack_struct *next; - uint32 param_count; - char** param_names; - char** param_values; +#ifdef OJI + struct lo_NVList parameters; +#else + uint32 param_count; + char **param_names; + char **param_values; +#endif char* data_url; MWContext* context; struct lo_DocState_struct* state; diff --git a/mozilla/lib/layout/layrelay.c b/mozilla/lib/layout/layrelay.c index b551181de0a..d17fb9fc03f 100644 --- a/mozilla/lib/layout/layrelay.c +++ b/mozilla/lib/layout/layrelay.c @@ -1195,9 +1195,9 @@ lo_rl_FitJava( lo_RelayoutState *relay_state, LO_Element *lo_ele ) lo_AppendToLineList(relay_state->context, relay_state->doc_state, lo_ele, baseline_inc); lo_UpdateStateAfterJavaAppLayout( relay_state->doc_state, java_app, line_inc, baseline_inc ); - CL_MoveLayer(java_app->layer, - java_app->x + java_app->x_offset + java_app->border_horiz_space, - java_app->y + java_app->y_offset + java_app->border_vert_space); + CL_MoveLayer(java_app->objTag.layer, + java_app->objTag.x + java_app->objTag.x_offset + java_app->objTag.border_horiz_space, + java_app->objTag.y + java_app->objTag.y_offset + java_app->objTag.border_vert_space); #endif return next; @@ -1413,10 +1413,10 @@ lo_rl_FitFloat( lo_RelayoutState *relay_state, LO_Element *lo_ele ) lo_LayoutFloatJavaApp( relay_state->context, relay_state->doc_state, java_app, FALSE ); /* Determine the new position of the layer. */ - x = java_app->x + java_app->x_offset + java_app->border_width; - y = java_app->y + java_app->y_offset + java_app->border_width; + x = java_app->objTag.x + java_app->objTag.x_offset + java_app->objTag.border_width; + y = java_app->objTag.y + java_app->objTag.y_offset + java_app->objTag.border_width; - layer = java_app->layer; + layer = java_app->objTag.layer; } #endif else if (lo_ele->lo_float.float_ele->lo_any.type == LO_EMBED) { @@ -1425,10 +1425,10 @@ lo_rl_FitFloat( lo_RelayoutState *relay_state, LO_Element *lo_ele ) lo_LayoutFloatEmbed( relay_state->context, relay_state->doc_state, embed, FALSE ); /* Determine the new position of the layer. */ - x = embed->x + embed->x_offset + embed->border_width; - y = embed->y + embed->y_offset + embed->border_width; + x = embed->objTag.x + embed->objTag.x_offset + embed->objTag.border_width; + y = embed->objTag.y + embed->objTag.y_offset + embed->objTag.border_width; - layer = embed->layer; + layer = embed->objTag.layer; } #ifdef SHACK else if (lo_ele->lo_float.float_ele->lo_any.type == LO_BUILTIN) { diff --git a/mozilla/lib/layout/layscrip.c b/mozilla/lib/layout/layscrip.c index 617813e7863..ef5799fcd32 100644 --- a/mozilla/lib/layout/layscrip.c +++ b/mozilla/lib/layout/layscrip.c @@ -976,9 +976,10 @@ lo_ProcessScriptTag(MWContext *context, lo_DocState *state, PA_Tag *tag, JSObjec #ifdef DEBUG_ScriptPlugin if (top_state->in_script == SCRIPT_TYPE_UNKNOWN) { + char* pluginName; mimebuf = npl_Script2mimeType(context,tag); if (mimebuf){ - if (NPL_FindPluginEnabledForType(mimebuf)){ + if ((pluginName = NPL_FindPluginEnabledForType(mimebuf)) != NULL){ top_state->in_script = SCRIPT_TYPE_PLUGIN; XP_ASSERT(top_state->mimetype == NULL); StrAllocCopy((char *)top_state->mimetype,mimebuf); diff --git a/mozilla/lib/layout/laytable.c b/mozilla/lib/layout/laytable.c index 98b06060964..8c875456417 100644 --- a/mozilla/lib/layout/laytable.c +++ b/mozilla/lib/layout/laytable.c @@ -8248,11 +8248,11 @@ lo_FindReuseableElement(MWContext *context, lo_DocState *state, LO_Element ** el switch ( eptr->type ) { case LO_EMBED: - tag = eptr->lo_embed.tag; + tag = eptr->lo_embed.objTag.tag; break; #ifdef JAVA case LO_JAVA: - tag = eptr->lo_java.tag; + tag = eptr->lo_java.objTag.tag; break; #endif /* JAVA */ } diff --git a/mozilla/lib/layout/laytags.c b/mozilla/lib/layout/laytags.c index 36c5ef236bb..e6df7fef319 100644 --- a/mozilla/lib/layout/laytags.c +++ b/mozilla/lib/layout/laytags.c @@ -22,13 +22,16 @@ #include "layout.h" #include "laylayer.h" #include "glhist.h" +#ifdef JAVA #include "java.h" +#endif #include "libi18n.h" #include "edt.h" #include "laystyle.h" #include "prefapi.h" #include "xp_ncent.h" #include "prefetch.h" +#include "np.h" /* style sheet tag stack and style struct */ #include "stystack.h" @@ -79,6 +82,11 @@ /* Added to encapsulate code that was previously in six different places in LO_LayoutTag()! */ static void lo_ProcessFontTag( lo_DocState *state, PA_Tag *tag, int32 fontSpecifier, int32 attrSpecifier ); +#ifdef OJI +#define JAVA_PLUGIN_MIMETYPE "application/x-java-vm" +static void lo_AddParam(PA_Tag* tag, char* aName, char* aValue); +#endif + /************************************* * Function: LO_ChangeFontSize * @@ -279,17 +287,23 @@ lo_FilterTag(MWContext *context, lo_DocState *state, PA_Tag *tag) * To determine if we're in a known object, we need to * look up the whole object stack for a known object at * any level. + * + * Also adding P_JAVA_APPLET to the list - support for applet redirect to obj tag */ if (top_state->object_stack != NULL && - tag->type != P_PARAM && tag->type != P_OBJECT) + tag->type != P_PARAM && tag->type != P_OBJECT +#ifdef OJI + && tag->type != P_JAVA_APPLET +#endif + ) { /* Check for a known object anywhere on the stack */ lo_ObjectStack* top = top_state->object_stack; while (top != NULL) { if (top->object != NULL && - top->object->lo_element.type != LO_NONE && - top->object->lo_element.type != LO_UNKNOWN) + top->object->lo_element.lo_plugin.type != LO_NONE && + top->object->lo_element.lo_plugin.type != LO_UNKNOWN) { /* The object was known, so filter out its contents */ return FALSE; @@ -4142,6 +4156,9 @@ lo_LayoutTag(MWContext *context, lo_DocState *state, PA_Tag *tag) { char *tptr; char *tptr2; +#ifdef OJI + char* javaPlugin; +#endif LO_TextAttr tmp_attr; StyleStruct *style_struct=NULL; XP_Bool has_ss_bottom_margin=FALSE; @@ -6686,7 +6703,44 @@ XP_TRACE(("lo_LayoutTag(%d)\n", tag->type)); * This is the NEW HTML-WG approved embedded JAVA * application. */ -#ifdef JAVA +#if defined(OJI) + case P_JAVA_APPLET: + javaPlugin = NPL_FindPluginEnabledForType(JAVA_PLUGIN_MIMETYPE); + + /* If there is a JVM installed as a plugin, redirect to the object tag */ + if(javaPlugin && !state->hide_content) + { + if(tag->is_end == FALSE) + { + PA_Block buff; + char* str; + + buff = lo_FetchParamValue(context, tag, PARAM_CODE); + if(buff) + { + PA_LOCK(str, char *, buff); + lo_AddParam(tag, "DATA", str); + lo_AddParam(tag, "TYPE", JAVA_PLUGIN_MIMETYPE); + + PA_UNLOCK(buff); + XP_FREE(buff); + + tag->type = P_OBJECT; + lo_ProcessObjectTag(context, state, tag, FALSE); + } + } + else + { + tag->type = P_OBJECT; + lo_ProcessObjectTag(context, state, tag, FALSE); + } + + XP_FREE(javaPlugin); + + } + break; + +#elif defined(JAVA) case P_JAVA_APPLET: /* * If the user has disabled Java, act like it we don't @@ -7386,3 +7440,32 @@ void lo_PostLayoutTag(MWContext * context, lo_DocState *state, PA_Tag *tag, XP_B } #endif /* PICS_SUPPORT */ } + +#ifdef OJI +static void lo_AddParam(PA_Tag* tag, char* aName, char* aValue) +{ + uint32 nameLen, valueLen, oldTagLen, newTagLen; + char* tagData; + + nameLen = XP_STRLEN(aName); + valueLen = XP_STRLEN(aValue); + oldTagLen = XP_STRLEN((char*)(tag->data)); + newTagLen = oldTagLen + nameLen + valueLen + 2; + + tag->data = XP_REALLOC(tag->data, newTagLen+1); + + /* Remove the '>' character */ + tagData = (char*)(tag->data); + tagData[oldTagLen-1] = 0; + + /* Add "aName=aValue" */ + XP_STRCAT(tagData, " "); + XP_STRCAT(tagData, aName); + XP_STRCAT(tagData, "="); + XP_STRCAT(tagData, aValue); + XP_STRCAT(tagData, ">"); + + tag->data_len = newTagLen; +} +#endif /* OJI */ + diff --git a/mozilla/lib/layout/laytext.c b/mozilla/lib/layout/laytext.c index 412016b79be..96eee57efbe 100644 --- a/mozilla/lib/layout/laytext.c +++ b/mozilla/lib/layout/laytext.c @@ -1685,7 +1685,7 @@ void lo_UpdateElementPosition ( lo_DocState * state, LO_Element * element ) break; case LO_EMBED: - CL_MoveLayer(element->lo_embed.layer, + CL_MoveLayer(element->lo_embed.objTag.layer, element->lo_any.x, element->lo_any.y); break; } diff --git a/mozilla/lib/layout/layutil.c b/mozilla/lib/layout/layutil.c index d4840668c35..fbd3779b382 100644 --- a/mozilla/lib/layout/layutil.c +++ b/mozilla/lib/layout/layutil.c @@ -99,8 +99,8 @@ lo_GetElementBbox(LO_Element *element, XP_Rect *rect) case LO_EMBED: { LO_EmbedStruct *embed = &element->lo_embed; - rect->right += 2 * (embed->border_width + embed->border_horiz_space); - rect->bottom += 2 * (embed->border_width + embed->border_vert_space); + rect->right += 2 * (embed->objTag.border_width + embed->objTag.border_horiz_space); + rect->bottom += 2 * (embed->objTag.border_width + embed->objTag.border_vert_space); } break; @@ -118,8 +118,8 @@ lo_GetElementBbox(LO_Element *element, XP_Rect *rect) case LO_JAVA: { LO_JavaAppStruct *java = &element->lo_java; - rect->right += 2 * (java->border_width + java->border_horiz_space); - rect->bottom += 2 * (java->border_width + java->border_vert_space); + rect->right += 2 * (java->objTag.border_width + java->objTag.border_horiz_space); + rect->bottom += 2 * (java->objTag.border_width + java->objTag.border_vert_space); } break; #endif diff --git a/mozilla/lib/libmocha/et_mocha.c b/mozilla/lib/libmocha/et_mocha.c index f5fc07afc8f..0d65419cee3 100644 --- a/mozilla/lib/libmocha/et_mocha.c +++ b/mozilla/lib/libmocha/et_mocha.c @@ -33,7 +33,9 @@ #endif #include "layout.h" /* XXX for lo_ContextToCell and lo_FormData */ #include "libimg.h" +#ifdef JAVA #include "java.h" +#endif #include "pa_tags.h" #include "css.h" #include "pa_parse.h" diff --git a/mozilla/lib/libmocha/lm_applt.c b/mozilla/lib/libmocha/lm_applt.c index e64c3ecd38f..f57cda90361 100644 --- a/mozilla/lib/libmocha/lm_applt.c +++ b/mozilla/lib/libmocha/lm_applt.c @@ -206,7 +206,7 @@ lm_ReallyReflectApplet(MWContext *context, LO_JavaAppStruct *lo_applet, PR_LOG(Moja, debug, ("really reflect applet 0x%x\n", lo_applet)); - obj = lo_applet->mocha_object; + obj = lo_applet->objTag.mocha_object; if (obj) return obj; @@ -223,7 +223,7 @@ lm_ReallyReflectApplet(MWContext *context, LO_JavaAppStruct *lo_applet, LM_GET_MAPPING_KEY(LM_APPLETS, layer_id, index)); if (obj) { - lo_applet->mocha_object = obj; + lo_applet->objTag.mocha_object = obj; return obj; } } @@ -232,10 +232,10 @@ lm_ReallyReflectApplet(MWContext *context, LO_JavaAppStruct *lo_applet, if (!JSJ_IsEnabled()) { PR_LOG(Moja, debug, ("reflected applet 0x%x as null\n", lo_applet)); - return lo_applet->mocha_object = lm_DummyObject; + return lo_applet->objTag.mocha_object = lm_DummyObject; } - ad = (LJAppletData *) lo_applet->session_data; + ad = (LJAppletData *) lo_applet->objTag.session_data; if (ad) { /* MozillaAppletContext.reflectApplet gets the java applet @@ -268,7 +268,7 @@ lm_ReallyReflectApplet(MWContext *context, LO_JavaAppStruct *lo_applet, if (obj) lm_java_clasp = JS_GetClass(obj); - return lo_applet->mocha_object = obj; + return lo_applet->objTag.mocha_object = obj; } else { PR_LOG(Moja, warn, ("failed to reflect applet 0x%x\n", lo_applet)); return NULL; @@ -288,7 +288,7 @@ LM_ReflectApplet(MWContext *context, LO_JavaAppStruct *applet_data, JSContext *cx; char *name; - obj = applet_data->mocha_object; + obj = applet_data->objTag.mocha_object; if (obj) return obj; @@ -346,7 +346,7 @@ LM_ReflectApplet(MWContext *context, LO_JavaAppStruct *applet_data, } /* cache it in layout data structure XXX lm_ReallyReflectApplet did this */ - XP_ASSERT(applet_data->mocha_object == obj); + XP_ASSERT(applet_data->objTag.mocha_object == obj); out: LM_PutMochaDecoder(decoder); diff --git a/mozilla/lib/libmocha/lm_doc.c b/mozilla/lib/libmocha/lm_doc.c index 548ce4838de..d256e646951 100644 --- a/mozilla/lib/libmocha/lm_doc.c +++ b/mozilla/lib/libmocha/lm_doc.c @@ -652,7 +652,7 @@ lm_reflect_stuff_eagerly(MWContext * context, int32 layer_id) /* reflect all applets in reverse order */ applet = doc_lists->applet_list; for (index = count-1; index >= 0; index--) { - if (applet->mocha_object == NULL) { + if (applet->objTag.mocha_object == NULL) { LM_ReflectApplet(context, applet, NULL, layer_id, index); } applet = applet->nextApplet; @@ -668,7 +668,7 @@ lm_reflect_stuff_eagerly(MWContext * context, int32 layer_id) /* reflect all embeds in reverse order */ embed = doc_lists->embed_list; for (index = count-1; index >= 0; index--) { - if (embed->mocha_object == NULL) { + if (embed->objTag.mocha_object == NULL) { LM_ReflectEmbed(context, embed, NULL, layer_id, index); } embed = embed->nextEmbed; diff --git a/mozilla/lib/libmocha/lm_embed.c b/mozilla/lib/libmocha/lm_embed.c index 0adf40147a3..b562ea9735d 100644 --- a/mozilla/lib/libmocha/lm_embed.c +++ b/mozilla/lib/libmocha/lm_embed.c @@ -192,7 +192,7 @@ lm_ReallyReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed, PRHashTable *map; PR_LOG(Moja, debug, ("really reflect embed 0x%x\n", lo_embed)); - if ((obj = lo_embed->mocha_object) != NULL) + if ((obj = lo_embed->objTag.mocha_object) != NULL) return obj; decoder = LM_GetMochaDecoder(context); @@ -208,7 +208,7 @@ lm_ReallyReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed, obj = (JSObject *)PR_HashTableLookup(map, LM_GET_MAPPING_KEY(LM_EMBEDS, layer_id, index)); if (obj) { - lo_embed->mocha_object = obj; + lo_embed->objTag.mocha_object = obj; return obj; } } @@ -217,10 +217,10 @@ lm_ReallyReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed, if (!JSJ_IsEnabled()) { PR_LOG(Moja, debug, ("reflected embed 0x%x as null\n", lo_embed)); - return lo_embed->mocha_object = lm_DummyObject; + return lo_embed->objTag.mocha_object = lm_DummyObject; } - embed = (NPEmbeddedApp*) lo_embed->FE_Data; + embed = (NPEmbeddedApp*) lo_embed->objTag.FE_Data; if (embed) { np_data *ndata = (np_data*) embed->np_data; np_instance *instance; @@ -249,7 +249,7 @@ lm_ReallyReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed, LM_GET_MAPPING_KEY(LM_EMBEDS, layer_id, index), obj); - return lo_embed->mocha_object = obj; + return lo_embed->objTag.mocha_object = obj; } else { PR_LOG(Moja, warn, ("failed to reflect embed 0x%x\n", lo_embed)); return NULL; @@ -267,7 +267,7 @@ LM_ReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed, char *name; int i; - obj = lo_embed->mocha_object; + obj = lo_embed->objTag.mocha_object; if (obj) return obj; @@ -279,12 +279,21 @@ LM_ReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed, /* get the name */ name = 0; +#ifdef OJI + for (i = 0; i < lo_embed->attributes.n; i++) { + if (!XP_STRCASECMP(lo_embed->attributes.names[i], "name")) { + name = strdup(lo_embed->attributes.values[i]); + break; + } + } +#else for (i = 0; i < lo_embed->attribute_cnt; i++) { if (!XP_STRCASECMP(lo_embed->attribute_list[i], "name")) { name = strdup(lo_embed->value_list[i]); break; } } +#endif /* Get the document object that will hold this applet */ document = lm_GetDocumentFromLayerId(decoder, layer_id); @@ -324,7 +333,7 @@ LM_ReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed, } /* cache it in layout data structure */ - lo_embed->mocha_object = obj; + lo_embed->objTag.mocha_object = obj; out: LM_PutMochaDecoder(decoder); diff --git a/mozilla/lib/libmocha/lm_init.c b/mozilla/lib/libmocha/lm_init.c index 2d1b7ed5ec6..e0d7a695330 100644 --- a/mozilla/lib/libmocha/lm_init.c +++ b/mozilla/lib/libmocha/lm_init.c @@ -37,7 +37,9 @@ #include "jri.h" #include "jriext.h" +#ifdef JAVA #include "java.h" +#endif #include "prefapi.h" #include "libi18n.h" #include "intl_csi.h" diff --git a/mozilla/lib/libmocha/lm_nav.c b/mozilla/lib/libmocha/lm_nav.c index f3417a88226..62ead0b4981 100644 --- a/mozilla/lib/libmocha/lm_nav.c +++ b/mozilla/lib/libmocha/lm_nav.c @@ -22,7 +22,9 @@ */ #include "lm.h" #include "prmem.h" +#ifdef JAVA #include "java.h" +#endif #include "gui.h" #include "prefapi.h" #include "msgcom.h" diff --git a/mozilla/lib/libmocha/lm_taint.c b/mozilla/lib/libmocha/lm_taint.c index a566ca2a3df..cd1e893e417 100644 --- a/mozilla/lib/libmocha/lm_taint.c +++ b/mozilla/lib/libmocha/lm_taint.c @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 @@ -34,7 +34,9 @@ #include "zig.h" #include "jri.h" #include "jsjava.h" +#ifdef JAVA #include "java.h" +#endif #include "jsobj.h" #include "jsatom.h" #include "jsscope.h" @@ -674,8 +676,12 @@ LM_NewJSPrincipals(URL_Struct *archive, char *id, const char *codebase) zip = zip_open(unixPath); } XP_FREEIF(unixPath); +#else +#ifdef OJI // XXX hack + zip = NULL; #else zip = zip_open(fn); +#endif #endif XP_FREE(fn); } @@ -746,8 +752,10 @@ destroyJSPrincipals(JSContext *cx, JSPrincipals *principals) XP_FREEIF(data->name); XP_FREEIF(data->untransformed); XP_FREEIF(data->transformed); +#ifndef OJI // XXX hack if (data->zip) zip_close(data->zip); +#endif if (data->needUnlock) NET_ChangeCacheFileLock(data->url_struct, FALSE); if (data->url_struct) @@ -1053,7 +1061,15 @@ lm_CheckContainerAccess(JSContext *cx, JSObject *obj, MochaDecoder *decoder, * We have signed scripts. Must check that the object principals are * a subset of the the subject principals. */ +#ifdef OJI // XXX hack + env = NULL; +#else +#ifdef JAVA env = LJ_JSJ_CurrentEnv(cx); +#else + env = NULL; +#endif +#endif if (env == NULL) { return JS_FALSE; } @@ -1072,14 +1088,18 @@ lm_CheckContainerAccess(JSContext *cx, JSObject *obj, MochaDecoder *decoder, return JS_TRUE; } fn = lm_GetSubjectOriginURL(cx); - if (!fn) - return JS_FALSE; + if (!fn) + return JS_FALSE; +#ifndef OJI // XXX hack +#ifdef JAVA if (subjPrincipals && principals) { PrintToConsole("Principals of script: "); printPrincipalsToConsole(cx, subjPrincipals); PrintToConsole("Principals of signed container: "); printPrincipalsToConsole(cx, principals); } +#endif /* JAVA */ +#endif /* !OJI */ JS_ReportError(cx, container_error_message, fn); return JS_FALSE; } @@ -1604,9 +1624,13 @@ LM_ExtractFromPrincipalsArchive(JSPrincipals *principals, char *name, uint *length) { JSPrincipalsData *data = (JSPrincipalsData *) principals; - char *result; + char *result = NULL; +#ifndef OJI // XXX hack +#ifdef JAVA result = LJ_LoadFromZipFile(data->zip, name); +#endif +#endif *length = result ? XP_STRLEN(result) : 0; return result; @@ -1983,17 +2007,25 @@ LM_RegisterPrincipals(MochaDecoder *decoder, JSPrincipals *principals, * Intersect principals and container principals, * modifying the container principals. */ +#ifndef OJI // XXX hack +#ifdef JAVA PrintToConsole("Intersecting principals "); printPrincipalsToConsole(cx, containerPrincipals); PrintToConsole("with "); printPrincipalsToConsole(cx, principals); +#endif +#endif if (!intersectPrincipals(decoder, containerPrincipals, principals)) { return NULL; } +#ifndef OJI // XXX hack +#ifdef JAVA PrintToConsole("yielding "); printPrincipalsToConsole(cx, containerPrincipals); +#endif +#endif } else { /* * Store the disjoint set of principals in the diff --git a/mozilla/lib/libmocha/lm_trggr.c b/mozilla/lib/libmocha/lm_trggr.c index c878cf6f8cb..1771084cff4 100644 --- a/mozilla/lib/libmocha/lm_trggr.c +++ b/mozilla/lib/libmocha/lm_trggr.c @@ -27,7 +27,9 @@ #include "lm.h" #include "prefapi.h" #include "VerReg.h" +#ifdef JAVA #include "softupdt.h" +#endif #include "gui.h" /* XP_AppPlatform */ JSBool PR_CALLBACK asd_Version(JSContext *cx, JSObject *obj, uint argc, jsval *argv, jsval *rval); @@ -206,9 +208,13 @@ JSBool PR_CALLBACK asd_start_update char* url = JS_GetStringBytes(JSVAL_TO_STRING(argv[0])); /* Bookmarks is a hack, you should really get some SmartUpdate context */ MWContext* cx = XP_FindContextOfType(NULL, MWContextBookmarks); - + +#ifdef JAVA XP_Bool result = SU_StartSoftwareUpdate( cx, url, NULL, NULL, NULL, JSVAL_TO_INT(argv[1]) ); +#else + XP_Bool result = FALSE; +#endif *rval = BOOLEAN_TO_JSVAL(result); return JS_TRUE; } @@ -244,8 +250,12 @@ JSBool PR_CALLBACK asd_conditional_update char* url = JS_GetStringBytes(JSVAL_TO_STRING(argv[0])); MWContext* cx = XP_FindContextOfType(NULL, MWContextBookmarks); +#ifdef JAVA XP_Bool result = SU_StartSoftwareUpdate( cx, url, NULL, NULL, NULL, JSVAL_TO_INT(argv[3]) ); +#else + XP_Bool result = FALSE; +#endif *rval = BOOLEAN_TO_JSVAL(result); return JS_TRUE; } diff --git a/mozilla/lib/plugin/Makefile b/mozilla/lib/plugin/Makefile index 873ffc44b88..3ee3434e4ec 100644 --- a/mozilla/lib/plugin/Makefile +++ b/mozilla/lib/plugin/Makefile @@ -24,9 +24,9 @@ CSRCS = npassoc.c CPPSRCS = nsplugin.cpp -EXPORTS = nppg.h npupp.h nsplugin.h nsjvm.h npglue.h nppriv.h +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 +REQUIRES = lay layer js style applet nspr dbm img util java pref xpcom netcnvts oji ifeq ($(subst /,_,$(shell uname -s)),OS2) CPPSRCS = npwplat.cpp @@ -41,4 +41,6 @@ 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) diff --git a/mozilla/lib/plugin/npglue.cpp b/mozilla/lib/plugin/npglue.cpp index b2f76c126b2..252701dc751 100644 --- a/mozilla/lib/plugin/npglue.cpp +++ b/mozilla/lib/plugin/npglue.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 @@ -36,6 +36,12 @@ static void np_ReplaceChars(char* word, char oldChar, char newChar); static char* np_CreateMimePref(const char* mimetype, const char* pref); #endif /* ANTHRAX */ +#ifdef PLUGIN_TIMER_EVENT +static void np_SetTimerInterval(NPP npp, uint32 msecs); +static void np_TimerCallback(void* app); +#define DEFAULT_TIMER_INTERVAL 1000 +#endif + /* list of all plugins */ static np_handle *np_plist = 0; @@ -60,7 +66,7 @@ np_is50StylePlugin(np_handle* handle) /* Find a mimetype in the handle */ static np_mimetype * -np_getmimetype(np_handle *handle, char *mimeStr, XP_Bool wildCard) +np_getmimetype(np_handle *handle, const char *mimeStr, XP_Bool wildCard) { np_mimetype *mimetype; @@ -522,7 +528,7 @@ NPL_Write(NET_StreamClass *stream, const unsigned char *str, int32 len) if (newstream->handle->userPlugin) { nsPluginStreamPeer* peerStream = (nsPluginStreamPeer*)newstream->pstream->pdata; NPIPluginStream* userStream = peerStream->GetUserStream(); - ret = userStream->Write(len, (void*)&str[urls->position]); + ret = userStream->Write(len, (const char*)str); } else if (ISFUNCPTR(newstream->handle->f->write)) { ret = CallNPP_WriteProc(newstream->handle->f->write, newstream->instance->npp, newstream->pstream, @@ -1056,7 +1062,6 @@ np_makecontext(np_instance* instance, const char* window) return cx; } - PR_STATIC_CALLBACK(void) np_redisable_js(URL_Struct* url_s, int status, MWContext* context) { @@ -1608,6 +1613,11 @@ npn_setvalue(NPP npp, NPPVariable variable, void *r_value) } #endif /* LAYERS */ break; + + case NPPVpluginTimerInterval: + np_SetTimerInterval(npp, *(uint32*)r_value); + break; + case NPPVpluginWindowSize: break; default: @@ -2043,7 +2053,7 @@ npn_reloadplugins(NPBool reloadPages) /* * In the case where we switch the handler (above), - * "instance" already points to the next object. + * "instance" already points to the next objTag. */ if (!switchedHandler) instance = instance->next; @@ -2186,10 +2196,10 @@ NS_DEFINE_IID(kLiveConnectPluginIID, NP_ILIVECONNECTPLUGIN_IID); #pragma pointers_in_D0 #endif -struct java_lang_Class* NP_EXPORT +#ifdef JAVA +java_lang_Class* NP_EXPORT npn_getJavaClass(np_handle* handle) { -#ifdef JAVA if (handle->userPlugin) { NPIPlugin* userPluginClass = (NPIPlugin*)handle->userPlugin; NPILiveConnectPlugin* lcPlugin; @@ -2210,9 +2220,9 @@ npn_getJavaClass(np_handle* handle) if (env == NULL) return NULL; return (java_lang_Class*)JRI_GetGlobalRef(env, handle->f->javaClass); } -#endif return NULL; } +#endif jref NP_EXPORT npn_getJavaPeer(NPP npp) @@ -2303,7 +2313,11 @@ np_IsLiveConnected(np_handle* handle) } } else { +#ifdef JAVA return npn_getJavaClass(handle) != NULL; +#else + return FALSE; +#endif } } @@ -2317,7 +2331,7 @@ XP_Bool NPL_IsLiveConnected(LO_EmbedStruct *embed) if (embed == NULL) return FALSE; - app = (NPEmbeddedApp*) embed->FE_Data; + app = (NPEmbeddedApp*) embed->objTag.FE_Data; if (app == NULL) return FALSE; @@ -2333,9 +2347,8 @@ XP_Bool NPL_IsLiveConnected(LO_EmbedStruct *embed) /******************************************************************************/ - - -static void +/* Returns false if there was an error: */ +static PRBool np_setwindow(np_instance *instance, NPWindow *appWin) { /* @@ -2355,10 +2368,9 @@ np_setwindow(np_instance *instance, NPWindow *appWin) ndata = (np_data*) app->np_data; lo_struct = ndata->lo_struct; #ifndef XP_MAC - if (lo_struct && lo_struct->ele_attrmask & LO_ELE_HIDDEN) - return; + if (lo_struct && lo_struct->objTag.ele_attrmask & LO_ELE_HIDDEN) + return PR_TRUE; #endif - } } @@ -2373,8 +2385,13 @@ np_setwindow(np_instance *instance, NPWindow *appWin) // If this is the first time we're drawing this, then call // the plugin's Start() method. - if (lo_struct && ! (lo_struct->ele_attrmask & LO_ELE_DRAWN)) - userInst->Start(); + if (lo_struct && ! (lo_struct->objTag.ele_attrmask & LO_ELE_DRAWN)) { + NPPluginError err = userInst->Start(); + if (err != NPPluginError_NoError) { + np_delete_instance(instance); + return PR_FALSE; + } + } } else if (ISFUNCPTR(instance->handle->f->setwindow)) { CallNPP_SetWindowProc(instance->handle->f->setwindow, instance->npp, appWin); @@ -2384,6 +2401,7 @@ np_setwindow(np_instance *instance, NPWindow *appWin) { NPTRACE(0,("setwindow before appWin was valid")); } + return PR_TRUE; } static void @@ -2392,7 +2410,7 @@ np_UnloadPluginClass(np_handle *handle) /* only called when we truly want to dispose the plugin class */ XP_ASSERT(handle && handle->refs == 0); -#ifdef JAVA +#ifdef JAVA if (handle->userPlugin == NULL && handle->f && handle->f->javaClass != NULL) { /* Don't get the environment unless there is a Java class, because this would cause the java runtime to start up. */ @@ -2415,6 +2433,7 @@ np_UnloadPluginClass(np_handle *handle) PR_IMPLEMENT(void) NPL_SetPluginWindow(void *data) { +#ifdef JAVA JRIEnv * env = NULL; np_instance *instance = (np_instance *) data; struct netscape_javascript_JSObject *mochaWindow = NULL; @@ -2422,7 +2441,6 @@ NPL_SetPluginWindow(void *data) if (instance && instance->cx) mochaWindow = LJ_GetMochaWindow(instance->cx); -#ifdef JAVA env = LJ_EnsureJavaEnv(PR_CurrentThread()); if (mochaWindow){ @@ -2513,10 +2531,15 @@ np_newinstance(np_handle *handle, MWContext *cx, NPEmbeddedApp *app, instance->npp = npp; instance->windowed = TRUE; instance->transparent = FALSE; + +#ifdef PLUGIN_TIMER_EVENT + instance->timeout = NULL; + instance->interval = DEFAULT_TIMER_INTERVAL; +#endif #ifdef LAYERS if (ndata) - instance->layer = ndata->lo_struct->layer; + instance->layer = ndata->lo_struct->objTag.layer; #endif /* LAYERS */ /* invite the plugin */ @@ -2548,10 +2571,15 @@ np_newinstance(np_handle *handle, MWContext *cx, NPEmbeddedApp *app, if (instance->type == NP_EMBED) { /* Embedded plug-ins get their attributes passed in from layout */ +#ifdef OJI + int16 argc = (int16) ndata->lo_struct->attributes.n; + char** names = ndata->lo_struct->attributes.names; + char** values = ndata->lo_struct->attributes.values; +#else int16 argc = (int16) ndata->lo_struct->attribute_cnt; char** names = ndata->lo_struct->attribute_list; char** values = ndata->lo_struct->value_list; - +#endif err = CallNPP_NewProc(handle->f->newp, requestedType, npp, instance->type, argc, names, values, savedData); } @@ -2599,7 +2627,8 @@ np_newinstance(np_handle *handle, MWContext *cx, NPEmbeddedApp *app, if (app->pagePluginType == NP_Embedded) { XP_ASSERT(app->wdata); - np_setwindow(instance, app->wdata); + PRBool success = np_setwindow(instance, app->wdata); + if (!success) goto error; } #endif } @@ -2635,8 +2664,10 @@ np_newinstance(np_handle *handle, MWContext *cx, NPEmbeddedApp *app, // The problem is that by deferring the jvm startup, we cause it to // happen later on the wrong thread. np_IsLiveConnected(handle) +#elif defined(JAVA) + npn_getJavaClass(handle) #else - npn_getJavaClass(handle) + FALSE #endif ) { /* for liveconnected plugins only */ ET_SetPluginWindow(cx, (void *)instance); @@ -2957,7 +2988,7 @@ NPL_NewPresentStream(FO_Present_Types format_out, void* type, URL_Struct* urls, /* * To actually create the instance we need to create a stream of - * fake HTML to cause layout to create a new embedded object. + * fake HTML to cause layout to create a new embedded objTag. * EmbedCreate will be called, which will created the NPEmbeddedApp * and put it into urls->fe_data, where we can retrieve it. */ @@ -3529,7 +3560,7 @@ np_delete_instance(np_instance *instance) #ifdef JAVA /* ** Break any association we have made between this instance and - ** its corresponding Java object. That way other java objects + ** its corresponding Java objTag. That way other java objects ** still referring to it will be able to detect that the plugin ** went away (by calling isActive). */ @@ -3595,6 +3626,12 @@ np_delete_instance(np_instance *instance) if (instance->typeString) XP_FREE(instance->typeString); + +#ifdef PLUGIN_TIMER_EVENT + if(instance->timeout) + FE_ClearTimeout(instance->timeout); +#endif + XP_FREE(instance); } } @@ -3719,7 +3756,7 @@ NPL_SameElement(LO_EmbedStruct* embed_struct) { if (embed_struct) { - NPEmbeddedApp* app = (NPEmbeddedApp*) embed_struct->FE_Data; + NPEmbeddedApp* app = (NPEmbeddedApp*) embed_struct->objTag.FE_Data; if (app) { np_data* ndata = (np_data*) app->np_data; @@ -3935,7 +3972,6 @@ np_deleteapp(MWContext* cx, NPEmbeddedApp* app) } } - /* * This is called by the front-end via layout when the plug-in's * context is going away. Based on what kind of plugin this is, what @@ -3949,17 +3985,17 @@ NPL_EmbedDelete(MWContext* cx, LO_EmbedStruct* embed_struct) NPEmbeddedApp* app; np_data* ndata; - if (!cx || !embed_struct || !embed_struct->FE_Data) + if (!cx || !embed_struct || !embed_struct->objTag.FE_Data) return; - app = (NPEmbeddedApp*) embed_struct->FE_Data; - embed_struct->FE_Data = NULL; + app = (NPEmbeddedApp*) embed_struct->objTag.FE_Data; + embed_struct->objTag.FE_Data = NULL; ndata = (np_data*) app->np_data; if (ndata) { - embed_struct->session_data = (void*) ndata; + embed_struct->objTag.session_data = (void*) ndata; ndata->refs--; @@ -4006,21 +4042,28 @@ NPL_EmbedDelete(MWContext* cx, LO_EmbedStruct* embed_struct) nsPluginInstancePeer* peerInst = (nsPluginInstancePeer*) ndata->instance->npp->pdata; NPIPluginInstance* userInst = peerInst->GetUserInstance(); - /* XXX Where should this error go? */ NPPluginError err = userInst->Stop(); - XP_ASSERT(err == NPPluginError_NoError); + if (err == NPPluginError_NoError) { + /* XXX So I'm going out on a limb here and saying that + by keeping the plugin in a "cached" state, we + should pretty much not need to perturb much + else... */ + ndata->state = NPDataCached; + ndata->lo_struct = NULL; + np_unbindContext(app, cx); - /* XXX So I'm going out on a limb here and saying that - by keeping the plugin in a "cached" state, we - should pretty much not need to perturb much - else... */ - ndata->state = NPDataCached; - ndata->lo_struct = NULL; - np_unbindContext(app, cx); - - /* Tell the front-end to save the embedded window for us */ - FE_SaveEmbedWindow(cx, app); - return; + /* Tell the front-end to save the embedded window for us */ + FE_SaveEmbedWindow(cx, app); + return; + } + else { + // the plugin failed to stop properly + // XXX is the following right?... + np_delete_instance(ndata->instance); + embed_struct->objTag.session_data = NULL; + app->np_data = NULL; + XP_FREE(ndata); + } } else { /* It's a normal old-fashioned plugin. Destroy the instance */ np_delete_instance(ndata->instance); @@ -4035,7 +4078,7 @@ NPL_EmbedDelete(MWContext* cx, LO_EmbedStruct* embed_struct) else { /* If there's no instance, there's no need to save session data */ - embed_struct->session_data = NULL; + embed_struct->objTag.session_data = NULL; app->np_data = NULL; XP_FREE(ndata); } @@ -4043,7 +4086,7 @@ NPL_EmbedDelete(MWContext* cx, LO_EmbedStruct* embed_struct) /* XXX This is pretty convoluted how this just all falls through to here. Clean it up sometime... */ - np_deleteapp(cx, app); /* unlink app from context and delete app */ + np_deleteapp(cx, app); /* unlink app from context and delete app */ } @@ -4091,6 +4134,16 @@ np_findTypeAttribute(LO_EmbedStruct* embed_struct) int i; /* Look for the TYPE attribute */ +#ifdef OJI + for (i = 0; i < embed_struct->attributes.n; i++) + { + if (XP_STRCASECMP(embed_struct->attributes.names[i], "TYPE") == 0) + { + typeAttribute = embed_struct->attributes.values[i]; + break; + } + } +#else for (i = 0; i < embed_struct->attribute_cnt; i++) { if (XP_STRCASECMP(embed_struct->attribute_list[i], "TYPE") == 0) @@ -4099,10 +4152,86 @@ np_findTypeAttribute(LO_EmbedStruct* embed_struct) break; } } - +#endif + return typeAttribute; } +void +np_FindHandleByType(const char* typeAttribute, np_handle* *resultingHandle, + np_mimetype* *resultingMimetype) +{ + np_handle* handle = NULL; + np_mimetype* mimetype = NULL; + + for (handle = np_plist; handle; handle = handle->next) { + mimetype = np_getmimetype(handle, typeAttribute, FALSE); + if (mimetype) break; + } + + /* No handler with an exactly-matching name, so check for a wildcard */ + if (!mimetype) + { + for (handle = np_plist; handle; handle = handle->next) { + mimetype = np_getmimetype(handle, typeAttribute, TRUE); + if (mimetype) break; + } + } + + *resultingHandle = handle; + *resultingMimetype = mimetype; +} + +// Used by OJI to load the Java VM plugin +PR_IMPLEMENT(struct NPIPlugin*) +NPL_LoadPluginByType(const char* typeAttribute) +{ + np_handle* handle = NULL; + np_mimetype* mimetype = NULL; + np_FindHandleByType(typeAttribute, &handle, &mimetype); + if (mimetype == NULL) + return NULL; + PR_ASSERT(handle); + + PRBool loaded = PR_FALSE; + if (handle->refs == 0) { +// FE_Progress(cx, XP_GetString(XP_PLUGIN_LOADING_PLUGIN)); + if (!(handle->f = FE_LoadPlugin(handle->pdesc, &npp_funcs, handle))) + { +// char* msg = PR_smprintf(XP_GetString(XP_PLUGIN_CANT_LOAD_PLUGIN), handle->name, mimetype->type); +// FE_Alert(cx, msg); +// XP_FREE(msg); + return NULL; + } + loaded = PR_TRUE; +#ifdef JAVA + /* + ** Don't use npn_getJavaEnv here. We don't want to start the + ** interpreter, just use env if it already exists. + */ + JRIEnv* env = JRI_GetCurrentEnv(); + + /* + ** An exception could have occurred when the plugin tried to load + ** it's class file. We'll print any exception to the console. + */ + if (env && JRI_ExceptionOccurred(env)) { + JRI_ExceptionDescribe(env); + JRI_ExceptionClear(env); + } +#endif + } + if (handle->userPlugin) { + // refcount was incremented + return handle->userPlugin; + } + else { + // old style plugin -- we failed so unload it + if (loaded) + FE_UnloadPlugin(handle->pdesc, handle); + return NULL; + } +} /* * This is called by the front-end to create a new plug-in. It will @@ -4127,10 +4256,10 @@ NPL_EmbedCreate(MWContext* cx, LO_EmbedStruct* embed_struct) * attach it to a new app. If there is nothing in the session * data, then we must create both a np_data object and an app. */ - if (embed_struct->session_data) + if (embed_struct->objTag.session_data) { - ndata = (np_data*) embed_struct->session_data; - embed_struct->session_data = NULL; + ndata = (np_data*) embed_struct->objTag.session_data; + embed_struct->objTag.session_data = NULL; if (ndata->state == NPDataCached) /* We cached this app, so don't create another */ { @@ -4166,7 +4295,7 @@ NPL_EmbedCreate(MWContext* cx, LO_EmbedStruct* embed_struct) ndata->state = NPDataNormal; #ifdef LAYERS if (ndata->instance) { - ndata->instance->layer = embed_struct->layer; + ndata->instance->layer = embed_struct->objTag.layer; LO_SetEmbedType(ndata->lo_struct, (PRBool)ndata->instance->windowed); } @@ -4191,11 +4320,11 @@ NPL_EmbedCreate(MWContext* cx, LO_EmbedStruct* embed_struct) /* Make the front-end restore the embedded window from it's saved context. */ - if (! (embed_struct->ele_attrmask & LO_ELE_HIDDEN)) + if (! (embed_struct->objTag.ele_attrmask & LO_ELE_HIDDEN)) FE_RestoreEmbedWindow(cx, ndata->app); /* Tie the app to the layout struct. */ - embed_struct->FE_Data = ndata->app; + embed_struct->objTag.FE_Data = ndata->app; return ndata->app; } @@ -4233,11 +4362,11 @@ NPL_EmbedCreate(MWContext* cx, LO_EmbedStruct* embed_struct) np_bindContext(app, cx); /* Tell the front-end to create the plugin window for us. */ - if (! (embed_struct->ele_attrmask & LO_ELE_HIDDEN)) + if (! (embed_struct->objTag.ele_attrmask & LO_ELE_HIDDEN)) FE_CreateEmbedWindow(cx, app); /* Attach the app to the layout info */ - embed_struct->FE_Data = ndata->app; + embed_struct->objTag.FE_Data = ndata->app; return app; error: @@ -4287,22 +4416,7 @@ NPL_EmbedStart(MWContext* cx, LO_EmbedStruct* embed_struct, NPEmbeddedApp* app) app->pagePluginType = NP_Embedded; /* Found the TYPE attribute, so look for a matching handler */ - mimetype = NULL; - for (handle = np_plist; handle; handle = handle->next) - { - mimetype = np_getmimetype(handle, typeAttribute, FALSE); - if (mimetype) break; - } - - /* No handler with an exactly-matching name, so check for a wildcard */ - if (!mimetype) - { - for (handle = np_plist; handle; handle = handle->next) - { - mimetype = np_getmimetype(handle, typeAttribute, TRUE); - if (mimetype) break; - } - } + np_FindHandleByType(typeAttribute, &handle, &mimetype); /* * If we found a handler, now we can create an instance. @@ -4389,7 +4503,7 @@ NPL_EmbedStart(MWContext* cx, LO_EmbedStruct* embed_struct, NPEmbeddedApp* app) */ app->pagePluginType = NP_Embedded; - if ((embed_struct->ele_attrmask & LO_ELE_STREAM_STARTED) == 0) + if ((embed_struct->objTag.ele_attrmask & LO_ELE_STREAM_STARTED) == 0) { URL_Struct* pURL; pURL = NET_CreateURLStruct(theURL, NET_DONT_RELOAD); @@ -4421,11 +4535,12 @@ error: void NPL_EmbedSize(NPEmbeddedApp *app) { - if(app) - { + if (app) { np_data *ndata = (np_data *)app->np_data; - if(ndata && ndata->instance && app->wdata) - np_setwindow(ndata->instance, app->wdata); + if (ndata && ndata->instance && app->wdata) { + PRBool success = np_setwindow(ndata->instance, app->wdata); + if (!success) return; // XXX deal with the error + } } } @@ -5067,3 +5182,37 @@ static void np_ReplaceChars(char* word, char oldChar, char newChar) #endif /* ANTHRAX */ +#ifdef PLUGIN_TIMER_EVENT + +static void np_SetTimerInterval(NPP npp, uint32 msecs) +{ + if(npp) { + np_instance* instance = (np_instance*) npp->ndata; + if(instance) + { + instance->interval = msecs; + instance->timeout = FE_SetTimeout(np_TimerCallback, (void*)instance, instance->interval); + } + } +} + +static void np_TimerCallback(void* data) +{ + NPEvent event; + np_instance* instance = (np_instance*) data; + +#ifdef XP_MAC + ((EventRecord)event).what = nullEvent; +#elif defined(XP_WIN) + event.event = 0; // ? +#elif defined(XP_OS2) + event.event = 0; // ? +#elif defined(XP_UNIX) + // not sure what to do here +#endif + + instance->timeout = FE_SetTimeout(np_TimerCallback, (void*)instance, instance->interval); + NPL_HandleEvent(instance->app, &event, NULL); +} +#endif + diff --git a/mozilla/lib/plugin/npglue.h b/mozilla/lib/plugin/npglue.h index f2df6544186..de5aed29d5e 100644 --- a/mozilla/lib/plugin/npglue.h +++ b/mozilla/lib/plugin/npglue.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 @@ -34,7 +34,9 @@ extern "C" { #include "gui.h" /* For XP_AppCodeName */ #include "merrors.h" #include "xpgetstr.h" +#ifdef JAVA #include "java.h" +#endif #include "nppriv.h" #include "shist.h" @@ -51,8 +53,16 @@ extern "C" { #include "layers.h" #endif /* LAYERS */ -#include "nsAgg.h" // nsPluginManager aggregates nsJVMManager +#include "nsILCPlg.h" +#include "nsAgg.h" /* nsPluginManager aggregates nsJVMManager */ +#ifdef OJI #include "nsjvm.h" +#else /* OJI */ +/* Just define a dummy struct for NPIJVMPluginManager. In the + plugin code, it is never actually dereferenced outside of an + `#ifdef OJI'. */ +struct NPIJVMPluginManager; +#endif /* OJI */ extern int XP_PLUGIN_LOADING_PLUGIN; extern int MK_BAD_CONNECT; @@ -307,7 +317,6 @@ protected: // aggregated sub-intefaces: NPIJVMPluginManager* GetJVMMgr(const nsIID& aIID); nsISupports* fJVMMgr; - }; extern nsPluginManager* thePluginManager; @@ -344,17 +353,42 @@ public: NS_IMETHOD_(NPPluginType) GetMode(void); - // (Corresponds to NPP_New's argc argument.) - NS_IMETHOD_(PRUint16) - GetArgCount(void); + // 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); - // (Corresponds to NPP_New's argn argument.) - NS_IMETHOD_(const char**) - GetArgNames(void); + // Get the value for the named attribute. Returns null + // if the attribute was not set. + NS_IMETHOD_(const char*) + GetAttribute(const char* name); - // (Corresponds to NPP_New's argv argument.) - NS_IMETHOD_(const char**) - GetArgValues(void); + // 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. + // + // returns a NPTagType. + NS_IMETHOD_(NPTagType) + GetTagType(void); NS_IMETHOD_(NPIPluginManager*) GetPluginManager(void); @@ -409,7 +443,7 @@ public: NS_IMETHOD_(void) UnregisterWindow(void* window); - + NS_IMETHOD_(PRInt16) AllocateMenuID(PRBool isSubmenu); @@ -452,7 +486,7 @@ public: // (Corresponds to NPP_Write and NPN_Write.) NS_IMETHOD_(PRInt32) - Write(PRInt32 len, void* buffer); + Write(PRInt32 len, const char* buffer); //////////////////////////////////////////////////////////////////////////// // from NPIPluginManagerStream: @@ -504,6 +538,22 @@ public: //////////////////////////////////////////////////////////////////////////// // from NPIPluginStreamPeer: + // (Corresponds to NPStream's url field.) + NS_IMETHOD_(const char*) + GetURL(void); + + // (Corresponds to NPStream's end field.) + NS_IMETHOD_(PRUint32) + GetEnd(void); + + // (Corresponds to NPStream's lastmodified field.) + NS_IMETHOD_(PRUint32) + GetLastModified(void); + + // (Corresponds to NPStream's notifyData field.) + NS_IMETHOD_(void*) + GetNotifyData(void); + // (Corresponds to NPP_DestroyStream's reason argument.) NS_IMETHOD_(NPPluginReason) GetReason(void); @@ -514,31 +564,7 @@ public: NS_IMETHOD_(PRUint32) GetContentLength(void); -#if 0 - NS_IMETHOD_(const char*) - GetContentEncoding(void); - NS_IMETHOD_(const char*) - GetCharSet(void); - - NS_IMETHOD_(const char*) - GetBoundary(void); - - NS_IMETHOD_(const char*) - GetContentName(void); - - NS_IMETHOD_(time_t) - GetExpires(void); - - NS_IMETHOD_(time_t) - GetLastModified(void); - - NS_IMETHOD_(time_t) - GetServerDate(void); - - NS_IMETHOD_(NPServerStatus) - GetServerStatus(void); -#endif NS_IMETHOD_(PRUint32) GetHeaderFieldCount(void); diff --git a/mozilla/lib/plugin/nppriv.h b/mozilla/lib/plugin/nppriv.h index e7f6833abe6..49bc72906e5 100644 --- a/mozilla/lib/plugin/nppriv.h +++ b/mozilla/lib/plugin/nppriv.h @@ -31,6 +31,8 @@ #define ISFUNCPTR(x) (x != NULL) +#define PLUGIN_TIMER_EVENT + typedef struct _np_handle np_handle; typedef struct _np_mimetype np_mimetype; typedef struct _np_instance np_instance; @@ -69,7 +71,6 @@ struct _np_handle { char *name; char *filename; char *description; - XP_Bool usesNewAPI; struct NPIPlugin* userPlugin; }; @@ -100,6 +101,12 @@ struct _np_instance { XP_Bool transparent; /* TRUE = transparent, FALSE = opaque */ XP_Bool calling_netlib_all_the_time; JRIGlobalRef mochaWindow; + +#ifdef PLUGIN_TIMER_EVENT + void* timeout; + uint32 interval; +#endif + #ifdef LAYERS CL_Layer *layer; #endif /* LAYERS */ diff --git a/mozilla/lib/plugin/npwplat.cpp b/mozilla/lib/plugin/npwplat.cpp index f2e3614a3e0..bb13acd9745 100644 --- a/mozilla/lib/plugin/npwplat.cpp +++ b/mozilla/lib/plugin/npwplat.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 @@ -37,7 +37,9 @@ #include "plgindll.h" #include "np.h" #include "helper.h" +#ifdef JAVA #include "java.h" +#endif #include "edt.h" #include "npglue.h" @@ -446,11 +448,28 @@ void fe_RegisterPlugins(char* pszPluginDir) CString csPluginSpec; csPluginSpec = pszPluginDir; -#ifdef JAVA // add directory to the java path no matter what +#if defined(xOJI) // XXX not yet -- ordering problem here between loading the vm and adding to the classpath + JVMMgr* jvmMgr = JVM_GetJVMMgr(); + if (jvmMgr) { + NPIJVMPlugin* jvm = jvmMgr->GetJVM(); + if (jvm) { + jvm->AddToClassPath(pszPluginDir); + } + jvmMgr->Release(); + } +#elif defined(JAVA) LJ_AddToClassPath(pszPluginDir); #endif + if (thePluginManager == NULL) { + static NS_DEFINE_IID(kIPluginManagerIID, NP_IPLUGINMANAGER_IID); + nsresult rslt = nsPluginManager::Create(NULL, kIPluginManagerIID, (void**)&thePluginManager); + // XXX Out of memory already? This function should return an error code! + PR_ASSERT(rslt == NS_OK); + // keep going anyway... + } + csPluginSpec += "\\*.*"; #ifndef _WIN32 @@ -616,7 +635,17 @@ NPPluginFuncs* FE_LoadPlugin(void* pluginType, NPNetscapeFuncs* pNavigatorFuncs, NPPMgtBlk* pNPMgtBlock = (NPPMgtBlk*)pluginType; CString csPluginDir; +#ifdef OJI + char* szExplicitDLL = strrchr(pNPMgtBlock->pPluginFilename, '\\'); + if( szExplicitDLL ) { + csPluginDir = pNPMgtBlock->pPluginFilename; // MFC copies the string + csPluginDir.SetAt( szExplicitDLL - pNPMgtBlock->pPluginFilename, '\0'); + } else { + wfe_GetPluginsDirectory(csPluginDir); + } +#else wfe_GetPluginsDirectory(csPluginDir); +#endif /* OJI */ LPSTR pPathSave = NULL; // storage for one dir spec @@ -649,11 +678,7 @@ NPPluginFuncs* FE_LoadPlugin(void* pluginType, NPNetscapeFuncs* pNavigatorFuncs, (NP_CREATEPLUGIN)PR_FindSymbol(pNPMgtBlock->pLibrary, "NP_CreatePlugin"); #endif if (npCreatePlugin != NULL) { - if (thePluginManager == NULL) { - static NS_DEFINE_IID(kIPluginManagerIID, NP_IPLUGINMANAGER_IID); - if (nsPluginManager::Create(NULL, kIPluginManagerIID, (void**)&thePluginManager) != NS_OK) - return NULL; - } + PR_ASSERT(thePluginManager != NULL); NPIPlugin* plugin = NULL; NPPluginError err = npCreatePlugin(thePluginManager, &plugin); handle->userPlugin = plugin; @@ -775,7 +800,8 @@ void FE_UnloadPlugin(void* pluginType, struct _np_handle* handle) // if this DLL is the last one, call its shutdown entry point if (pNPMgtBlk->uRefCount == 0) { if (handle->userPlugin) { - handle->userPlugin->Release(); + nsrefcnt cnt = handle->userPlugin->Release(); + PR_ASSERT(cnt == 0); } else { // the NP_Shutdown entry point was misnamed as NP_PluginShutdown, early @@ -804,8 +830,6 @@ void FE_UnloadPlugin(void* pluginType, struct _np_handle* handle) } } - // XXX Shouldn't the rest of this be inside the if statement, above?... - PR_UnloadLibrary(pNPMgtBlk->pLibrary); pNPMgtBlk->pLibrary = NULL; diff --git a/mozilla/lib/plugin/nsIPlug.h b/mozilla/lib/plugin/nsIPlug.h index ad06148622d..7935a115716 100644 --- a/mozilla/lib/plugin/nsIPlug.h +++ b/mozilla/lib/plugin/nsIPlug.h @@ -755,7 +755,6 @@ public: UnregisterWindow(void* window) = 0; // Menu ID allocation calls for Mac: - NS_IMETHOD_(PRInt16) AllocateMenuID(PRBool isSubmenu) = 0; diff --git a/mozilla/lib/plugin/nsjvm.cpp b/mozilla/lib/plugin/nsjvm.cpp deleted file mode 100644 index daee0764150..00000000000 --- a/mozilla/lib/plugin/nsjvm.cpp +++ /dev/null @@ -1,351 +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. - */ - -//////////////////////////////////////////////////////////////////////////////// -// Plugin Manager Methods to support the JVM Plugin API -//////////////////////////////////////////////////////////////////////////////// - -#include "npglue.h" -#include "prefapi.h" -#include "xp_str.h" -#include "libmocha.h" - -#include "nsjvm.h" - -#if 0 // XXX for now - -static int PR_CALLBACK -JavaPrefChanged(const char *prefStr, void* data) -{ - nsPluginManager* mgr = (nsPluginManager*)data; - PRBool prefBool; - PREF_GetBoolPref(prefStr, &prefBool); - mgr->SetJVMEnabled(prefBool); - return 0; -} - -void -nsPluginManager::EnsurePrefCallbackRegistered(void) -{ - if (fRegisteredJavaPrefChanged != PR_TRUE) { - fRegisteredJavaPrefChanged = PR_TRUE; - PREF_RegisterCallback("security.enable_java", JavaPrefChanged, this); - JavaPrefChanged("security.enable_java", this); - } -} - -PRBool -nsPluginManager::GetJVMEnabled(void) -{ - EnsurePrefCallbackRegistered(); - return fJVM->GetJVMEnabled(); -} - -void -nsPluginManager::SetJVMEnabled(PRBool enable) -{ - return fJVM->SetJVMEnabled(enable); -} - -JVMStatus -nsPluginManager::GetJVMStatus(void) -{ - EnsurePrefCallbackRegistered(); - return fJVM->GetJVMStatus(); -} - -//////////////////////////////////////////////////////////////////////////////// - -// Should be in a header; must solve build-order problem first -extern void VR_Initialize(JRIEnv* env); -extern void SU_Initialize(JRIEnv * env); - -JVMStatus -nsPluginManager::StartupJVM() -{ - // Be sure to check the prefs first before asking java to startup. - if (GetJVMStatus() == JVMStatus_Disabled) { - return JVMStatus_Disabled; - } - JVMStatus status = fJVM->StartupJVM(); - if (status == JVMStatus_Ok) { - JRIEnv* env = fJVM->EnsureExecEnv(); - - /* initialize VersionRegistry native routines */ - /* it is not an error that prevents java from starting if this stuff throws exceptions */ - VR_Initialize(env); - if (JRI_ExceptionOccurred(env)) { -#if DEBUG - fJVM->PrintToConsole("LJ: VR_Initialize failed. Bugs to dveditz.\n"); -#endif - goto error; - } - - SU_Initialize(env); - if (JRI_ExceptionOccurred(env)) { -#if DEBUG - fJVM->PrintToConsole("LJ: SU_Initialize failed. Bugs to atotic.\n"); -#endif - goto error; - } - } - return status; - - error: -#if DEBUG - JRI_ExceptionDescribe(env); -#endif - JRI_ExceptionClear(env); - ShutdownJVM(); - return JVMStatus_JavaError; -} - -JVMStatus -nsPluginManager::ShutdownJVM(PRBool fullShutdown = PR_TRUE) -{ - return fJVM->ShutdownJVM(); -} - -#endif // 0 - -//////////////////////////////////////////////////////////////////////////////// - -void NP_LOADDS -nsPluginManager::BeginWaitCursor(void) -{ - if (fWaiting == 0) { -#ifdef XP_PC - fOldCursor = (void*)GetCursor(); - HCURSOR newCursor = LoadCursor(NULL, IDC_WAIT); - if (newCursor) - SetCursor(newCursor); -#endif -#ifdef XP_MAC - startAsyncCursors(); -#endif - } - fWaiting++; -} - -void NP_LOADDS -nsPluginManager::EndWaitCursor(void) -{ - fWaiting--; - if (fWaiting == 0) { -#ifdef XP_PC - if (fOldCursor) - SetCursor((HCURSOR)fOldCursor); -#endif -#ifdef XP_MAC - stopAsyncCursors(); -#endif - fOldCursor = NULL; - } -} - -//////////////////////////////////////////////////////////////////////////////// - -const char* NP_LOADDS -nsPluginManager::GetProgramPath(void) -{ - return fProgramPath; -} - -const char* NP_LOADDS -nsPluginManager::GetTempDirPath(void) -{ - // XXX I don't need a static really, the browser holds the tempDir name - // as a static string -- it's just the XP_TempDirName that strdups it. - static const char* tempDirName = NULL; - if (tempDirName == NULL) - tempDirName = XP_TempDirName(); - return tempDirName; -} - -nsresult NP_LOADDS -nsPluginManager::GetFileName(const char* fn, FileNameType type, - char* resultBuf, PRUint32 bufLen) -{ - // XXX This should be rewritten so that we don't have to malloc the name. - XP_FileType filetype; - - if (type == SIGNED_APPLET_DBNAME) - filetype = xpSignedAppletDB; - else if (type == TEMP_FILENAME) - filetype = xpTemporary; - else - return NS_ERROR_ILLEGAL_VALUE; - - char* tempName = WH_FileName(fn, filetype); - if (tempName != NULL) return NS_ERROR_OUT_OF_MEMORY; - XP_STRNCPY_SAFE(resultBuf, tempName, bufLen); - XP_FREE(tempName); - return NS_OK; -} - -nsresult NP_LOADDS -nsPluginManager::NewTempFileName(const char* prefix, char* resultBuf, PRUint32 bufLen) -{ - // XXX This should be rewritten so that we don't have to malloc the name. - char* tempName = WH_TempName(xpTemporary, prefix); - if (tempName != NULL) return NS_ERROR_OUT_OF_MEMORY; - XP_STRNCPY_SAFE(resultBuf, tempName, bufLen); - XP_FREE(tempName); - return NS_OK; -} - -PRBool NP_LOADDS -nsPluginManager::HandOffJSLock(PRThread* oldOwner, PRThread* newOwner) -{ - return LM_HandOffJSLock(oldOwner, newOwner); -} - -//////////////////////////////////////////////////////////////////////////// -// Debugger Stuff - -extern "C" HWND FindNavigatorHiddenWindow(void); - -PRBool NP_LOADDS -nsPluginManager::SetDebugAgentPassword(PRInt32 pwd) -{ -#if defined(XP_PC) && defined(_WIN32) - HWND win = FindNavigatorHiddenWindow(); - HANDLE sem; - long err; - - /* set up by aHiddenFrameClass in CNetscapeApp::InitInstance */ - err = SetWindowLong(win, 0, pwd); - if (err == 0) { -// PR_LOG(NSJAVA, PR_LOG_ALWAYS, -// ("SetWindowLong returned %ld (err=%d)\n", err, GetLastError())); - /* continue so that we try to wake up the debugger */ - } - sem = OpenSemaphore(SEMAPHORE_MODIFY_STATE, FALSE, "Netscape-Symantec Debugger"); - if (sem) { - ReleaseSemaphore(sem, 1, NULL); - CloseHandle(sem); - } - return PR_TRUE; -#else - return PR_FALSE; -#endif -} - -//////////////////////////////////////////////////////////////////////////////// - -#if 0 // XXX for now - -PRBool -nsPluginManager::StartDebugger(JVMDebugPort port) -{ - JVMError err = fJVM->StartDebugger(port); - if (err != JVMError_NoError) { - JRIEnv* env = fJVM->EnsureJNIEnv(); - ReportJVMError(env, err); - return PR_FALSE; - } - return PR_TRUE; -} - -void -nsPluginManager::ReportJVMError(JRIEnv* env, JVMError err) -{ - MWContext* cx = XP_FindSomeContext(); - char *s; - switch (err) { - case LJStartupError_NoClasses: { - const char* cp = CLASSPATH(); - cp = lj_ConvertToPlatformPathList(cp); - s = PR_smprintf(XP_GetString(XP_JAVA_NO_CLASSES), - lj_jar_name, lj_jar_name, - (cp ? cp : "")); - free((void*)cp); - break; - } - - case LJStartupError_JavaError: { - const char* msg = GetJavaErrorString(env); -#ifdef DEBUG - JRI_ExceptionDescribe(env); -#endif - s = PR_smprintf(XP_GetString(XP_JAVA_STARTUP_FAILED), - (msg ? msg : "")); - if (msg) free((void*)msg); - break; - } - case LJStartupError_NoDebugger: { - s = PR_smprintf(XP_GetString(XP_JAVA_DEBUGGER_FAILED)); - break; - } - default: - return; /* don't report anything */ - } - if (s) { - FE_Alert(cx, s); - free(s); - } -} - -/* stolen from java_lang_Object.h (jri version) */ -#define classname_java_lang_Object "java/lang/Object" -#define name_java_lang_Object_toString "toString" -#define sig_java_lang_Object_toString "()Ljava/lang/String;" - -const char* -nsPluginManager::GetJavaErrorString(JRIEnv* env) -{ - /* XXX javah is a pain wrt mixing JRI and JDK native methods. - Since we need to call a method on Object, we'll do it the hard way - to avoid using javah for this. - Maybe we need a new JRI entry point for toString. Yikes! */ - - const char* msg; - struct java_lang_Class* classObject; - JRIMethodID toString; - struct java_lang_String* excString; - struct java_lang_Throwable* exc = JRI_ExceptionOccurred(env); - - if (exc == NULL) { - return strdup(""); /* XXX better "no error" message? */ - } - - /* Got to do this before trying to find a class (like Object). - This is because the runtime refuses to do this with a pending - exception! I think it's broken. */ - - JRI_ExceptionClear(env); - - classObject = (struct java_lang_Class*) - JRI_FindClass(env, classname_java_lang_Object); - toString = JRI_GetMethodID(env, classObject, - name_java_lang_Object_toString, - sig_java_lang_Object_toString); - excString = (struct java_lang_String *) - JRI_CallMethod(env)(env, JRI_CallMethod_op, - (struct java_lang_Object*)exc, toString); - - /* XXX change to JRI_GetStringPlatformChars */ - msg = JRI_GetStringPlatformChars(env, excString, NULL, 0); - if (msg == NULL) return NULL; - return strdup(msg); -} - -#endif // 0 - -//////////////////////////////////////////////////////////////////////////////// - diff --git a/mozilla/lib/plugin/nsjvm.h b/mozilla/lib/plugin/nsjvm.h deleted file mode 100644 index 0975c9c8f5d..00000000000 --- a/mozilla/lib/plugin/nsjvm.h +++ /dev/null @@ -1,212 +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. - */ - -//////////////////////////////////////////////////////////////////////////////// -// 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. -//////////////////////////////////////////////////////////////////////////////// - -#ifndef nsjvm_h___ -#define nsjvm_h___ - -#include "nsplugin.h" -#include "jri.h" // XXX for now -#include "jni.h" -#include "prthread.h" - -//////////////////////////////////////////////////////////////////////////////// -// Java VM Plugin Manager -// This interface defines additional entry points that are available -// to JVM plugins for browsers that support JVM plugins. - -class NPIJVMPluginManager : public NPIPluginManager { -public: - - virtual void NP_LOADDS - BeginWaitCursor(void) = 0; - - virtual void NP_LOADDS - EndWaitCursor(void) = 0; - - virtual const char* NP_LOADDS - GetProgramPath(void) = 0; - - virtual const char* NP_LOADDS - GetTempDirPath(void) = 0; - - enum FileNameType { SIGNED_APPLET_DBNAME, TEMP_FILENAME }; - - virtual nsresult NP_LOADDS - GetFileName(const char* fn, FileNameType type, - char* resultBuf, PRUint32 bufLen) = 0; - - virtual nsresult NP_LOADDS - NewTempFileName(const char* prefix, char* resultBuf, PRUint32 bufLen) = 0; - - virtual PRBool NP_LOADDS - HandOffJSLock(PRThread* oldOwner, PRThread* newOwner) = 0; - - //////////////////////////////////////////////////////////////////////////// - // Debugger Stuff (XXX move to subclass) - - virtual PRBool NP_LOADDS - SetDebugAgentPassword(PRInt32 pwd) = 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 -}; - -enum JVMError { - JVMError_Ok = NPPluginError_NoError, - JVMError_Base = 0x1000, - JVMError_InternalError = JVMError_Base, - JVMError_NoClasses, - JVMError_WrongClasses, - JVMError_JavaError, - JVMError_NoDebugger -}; - -enum JVMDebugPort { - JVMDebugPort_None = 0, - JVMDebugPort_SharedMemory = -1 - // anything else is a port number -}; - -//////////////////////////////////////////////////////////////////////////////// -// 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: - - virtual JVMStatus NP_LOADDS - StartupJVM() = 0; - - virtual JVMStatus NP_LOADDS - ShutdownJVM(PRBool fullShutdown = PR_TRUE) = 0; - - virtual PRBool NP_LOADDS - GetJVMEnabled() = 0; - - virtual void NP_LOADDS - SetJVMEnabled(PRBool enable) = 0; - - virtual JVMStatus NP_LOADDS - GetJVMStatus() = 0; - - // Find or create a JNIEnv for the specified thread. The thread - // parameter may be NULL indicating the current thread. - // XXX JNIEnv* - virtual JRIEnv* NP_LOADDS - EnsureExecEnv(PRThread* thread = NULL) = 0; - - virtual void NP_LOADDS - AddToClassPath(const char* dirPath) = 0; - - virtual void NP_LOADDS - ShowConsole() = 0; - - virtual void NP_LOADDS - HideConsole() = 0; - - virtual PRBool NP_LOADDS - IsConsoleVisible() = 0; - - virtual void NP_LOADDS - PrintToConsole(const char* msg) = 0; - - //////////////////////////////////////////////////////////////////////////// - // Debugger Stuff (XXX move to subclass) - - virtual JVMError NP_LOADDS - StartDebugger(JVMDebugPort port) = 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 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 Does this overlap with GetArgNames/GetArgValues? - // XXX What happens if someone says something like: - // - // Which takes precedent? - virtual char* NP_LOADDS - GetAttribute(NPTagAttributeName name) = 0; - - // XXX reload method? - - // Returns a unique id for the current document on which the - // plugin is displayed. - virtual PRUint32 NP_LOADDS - GetDocumentID() = 0; - -}; - -#define NP_IJVMPLUGININSTANCEPEER_IID \ -{ /* 27b42df0-a1bd-11d1-85b1-00805f0e4dfe */ \ - 0x27b42df0, \ - 0xa1bd, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -#endif /* nsjvm_h___ */ diff --git a/mozilla/lib/plugin/nsplugin.cpp b/mozilla/lib/plugin/nsplugin.cpp index c7462c257ca..604c7450296 100644 --- a/mozilla/lib/plugin/nsplugin.cpp +++ b/mozilla/lib/plugin/nsplugin.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 @@ -25,15 +25,21 @@ //////////////////////////////////////////////////////////////////////////////// #include "npglue.h" + #ifdef OJI +#include "nsIPlug.h" #include "jvmmgr.h" #endif +#include "plstr.h" /* PL_strcasecmp */ + #include "xp_mem.h" #include "xpassert.h" + #ifdef XP_MAC #include "MacMemAllocator.h" #endif + //////////////////////////////////////////////////////////////////////////////// // THINGS IMPLEMENTED BY THE BROWSER... //////////////////////////////////////////////////////////////////////////////// @@ -63,6 +69,8 @@ NS_IMPL_AGGREGATED(nsPluginManager); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +#include "nsRepository.h" + NS_METHOD nsPluginManager::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr) { @@ -206,7 +214,7 @@ nsPluginInstancePeer::AggregatedQueryInterface(const nsIID& aIID, void** aInstan np_data* ndata = (np_data*) app->np_data; nsresult result = JVMInstancePeer::Create((nsISupports*)this, kISupportsIID, (void**)&fJVMInstancePeer, - cx, (struct LO_JavaAppStruct_struct*)ndata->lo_struct); // XXX wrong kind of LO_Struct! + cx, (LO_CommonPluginStruct*)ndata->lo_struct); if (result != NS_OK) return result; } #endif @@ -233,49 +241,176 @@ nsPluginInstancePeer::GetMode(void) return (NPPluginType)instance->type; } -NS_METHOD_(PRUint16) -nsPluginInstancePeer::GetArgCount(void) +static char* empty_list[] = { "", NULL }; + +NS_METHOD_(NPPluginError) +nsPluginInstancePeer::GetAttributes(PRUint16& n, + const char*const*& names, + const char*const*& values) { np_instance* instance = (np_instance*)npp->ndata; + +#if 0 + // defense + PR_ASSERT( 0 != names ); + PR_ASSERT( 0 != values ); + if( 0 == names || 0 == values ) + return 0; +#endif + if (instance->type == NP_EMBED) { np_data* ndata = (np_data*)instance->app->np_data; - return (PRUint16)ndata->lo_struct->attribute_cnt; - } - else { - return 1; + +#ifdef OJI + names = (const char*const*)ndata->lo_struct->attributes.names; + values = (const char*const*)ndata->lo_struct->attributes.values; + n = (PRUint16)ndata->lo_struct->attributes.n; +#else + // XXX I think all the parameters and attributes just get + // munged together under MOZ_JAVA... + names = (const char*const*) ndata->lo_struct->attribute_list; + values = (const char*const*) ndata->lo_struct->value_list; + n = (PRUint16) ndata->lo_struct->attribute_cnt; +#endif + + return NPPluginError_NoError; + } else { + static char _name[] = "PALETTE"; + static char* _names[1]; + + static char _value[] = "foreground"; + static char* _values[1]; + + _names[0] = _name; + _values[0] = _value; + + names = (const char*const*) _names; + values = (const char*const*) _values; + n = 1; + + return NPPluginError_NoError; } + + // random, sun-spot induced error + PR_ASSERT( 0 ); + + n = 0; + // const char* const* empty_list = { { '\0' } }; + names = values = empty_list; + + return NPPluginError_GenericError; } -NS_METHOD_(const char**) -nsPluginInstancePeer::GetArgNames(void) +NS_METHOD_(const char*) +nsPluginInstancePeer::GetAttribute(const char* name) { - np_instance* instance = (np_instance*)npp->ndata; - if (instance->type == NP_EMBED) { - np_data* ndata = (np_data*)instance->app->np_data; - return (const char**)ndata->lo_struct->attribute_list; - } - else { - static char name[] = "PALETTE"; - static char* names[1]; - names[0] = name; - return (const char**)names; + PRUint16 nAttrs, i; + const char*const* names; + const char*const* values; + + if( NPCallFailed( GetAttributes( nAttrs, names, values )) ) + return 0; + + for( i = 0; i < nAttrs; i++ ) { + if( PL_strcasecmp( name, names[i] ) == 0 ) + return values[i]; } + + return 0; } -NS_METHOD_(const char**) -nsPluginInstancePeer::GetArgValues(void) +NS_METHOD_(NPPluginError) +nsPluginInstancePeer::GetParameters(PRUint16& n, + const char*const*& names, + const char*const*& values) { np_instance* instance = (np_instance*)npp->ndata; + if (instance->type == NP_EMBED) { np_data* ndata = (np_data*)instance->app->np_data; - return (const char**)ndata->lo_struct->value_list; + +#ifdef OJI + names = (const char*const*)ndata->lo_struct->parameters.names; + values = (const char*const*)ndata->lo_struct->parameters.values; + n = (PRUint16)ndata->lo_struct->parameters.n; +#else + // XXX I think all the parameters and attributes just get + // munged together under MOZ_JAVA... + names = (const char*const*) ndata->lo_struct->attribute_list; + values = (const char*const*) ndata->lo_struct->value_list; + n = (PRUint16)ndata->lo_struct->attribute_cnt; +#endif + + return NPPluginError_NoError; + } else { + static char _name[] = "PALETTE"; + static char* _names[1]; + + static char _value[] = "foreground"; + static char* _values[1]; + + _names[0] = _name; + _values[0] = _value; + + names = (const char*const*) _names; + values = (const char*const*) _values; + n = 1; + + return NPPluginError_NoError; } - else { - static char value[] = "foreground"; - static char* values[1]; - values[0] = value; - return (const char**)values; + + // random, sun-spot induced error + PR_ASSERT( 0 ); + + n = 0; + // static const char* const* empty_list = { { '\0' } }; + names = values = empty_list; + + return NPPluginError_GenericError; +} + +NS_METHOD_(const char*) +nsPluginInstancePeer::GetParameter(const char* name) +{ + PRUint16 nParams, i; + const char*const* names; + const char*const* values; + + if( NPCallFailed( GetParameters( nParams, names, values )) ) + return 0; + + for( i = 0; i < nParams; i++ ) { + if( PL_strcasecmp( name, names[i] ) == 0 ) + return values[i]; } + + return 0; +} + +NS_METHOD_(NPTagType) +nsPluginInstancePeer::GetTagType(void) +{ +#ifdef XXX + switch (fLayoutElement->lo_element.type) { + case LO_JAVA: + return NPTagType_Applet; + case LO_EMBED: + return NPTagType_Embed; + case LO_OBJECT: + return NPTagType_Object; + + default: + return NPTagType_Unknown; + } +#endif + return NPTagType_Unknown; +} + +NS_METHOD_(const char *) +nsPluginInstancePeer::GetTagText(void) +{ + // XXX + return NULL; } NS_METHOD_(NPIPluginManager*) @@ -310,7 +445,12 @@ nsPluginInstancePeer::NewStream(nsMIMEType type, const char* target, { NPStream* pstream; NPPluginError err = (NPPluginError) - npn_newstream(npp, (char*)type, (char*)target, &pstream); +#ifdef OJI + npn_newstream(npp, const_cast(type), + const_cast(target), &pstream); +#else + npn_newstream(npp, (char*)type,(char*)target, &pstream); +#endif if (err != NPPluginError_NoError) return err; *result = new nsPluginManagerStream(npp, pstream); @@ -362,19 +502,23 @@ nsPluginInstancePeer::ForceRedraw(void) NS_METHOD_(void) nsPluginInstancePeer::RegisterWindow(void* window) { - npn_registerwindow(npp, window); + npn_registerwindow(npp, window); } NS_METHOD_(void) nsPluginInstancePeer::UnregisterWindow(void* window) { - npn_unregisterwindow(npp, window); + npn_unregisterwindow(npp, window); } NS_METHOD_(PRInt16) nsPluginInstancePeer::AllocateMenuID(PRBool isSubmenu) { - return npn_allocateMenuID(npp, isSubmenu); +#ifdef XP_MAC + return npn_allocateMenuID(npp, isSubmenu); +#else + return -1; +#endif } NS_METHOD_(jref) @@ -396,6 +540,8 @@ nsPluginManagerStream::nsPluginManagerStream(NPP npp, NPStream* pstr) nsPluginManagerStream::~nsPluginManagerStream(void) { + NPError err = npn_destroystream(npp, pstream, NPPluginReason_Done); + PR_ASSERT(err == NPPluginError_NoError); } NS_METHOD_(PRInt32) @@ -407,9 +553,9 @@ nsPluginManagerStream::WriteReady(void) } NS_METHOD_(PRInt32) -nsPluginManagerStream::Write(PRInt32 len, void* buffer) +nsPluginManagerStream::Write(PRInt32 len, const char* buffer) { - return npn_write(npp, pstream, len, buffer); + return npn_write(npp, pstream, len, (void*)buffer); } NS_METHOD_(const char*) @@ -453,6 +599,34 @@ nsPluginStreamPeer::nsPluginStreamPeer(URL_Struct *urls, np_stream *stream) nsPluginStreamPeer::~nsPluginStreamPeer(void) { +#if 0 + NPError err = npn_destroystream(stream->instance->npp, stream->pstream, reason); + PR_ASSERT(err == NPPluginError_NoError); +#endif +} + +NS_METHOD_(const char*) +nsPluginStreamPeer::GetURL(void) +{ + return stream->pstream->url; +} + +NS_METHOD_(PRUint32) +nsPluginStreamPeer::GetEnd(void) +{ + return stream->pstream->end; +} + +NS_METHOD_(PRUint32) +nsPluginStreamPeer::GetLastModified(void) +{ + return stream->pstream->lastmodified; +} + +NS_METHOD_(void*) +nsPluginStreamPeer::GetNotifyData(void) +{ + return stream->pstream->notifyData; } NS_METHOD_(NPPluginReason) diff --git a/mozilla/lib/plugin/nsplugin.h b/mozilla/lib/plugin/nsplugin.h deleted file mode 100644 index 68526ce8cb0..00000000000 --- a/mozilla/lib/plugin/nsplugin.h +++ /dev/null @@ -1,939 +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. - */ - -//////////////////////////////////////////////////////////////////////////////// -// INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API). -// -// This superscedes the old plugin API (npapi.h, npupp.h), and -// eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp. -// Correspondences to the old API are shown throughout the file. -//////////////////////////////////////////////////////////////////////////////// - -// XXX THIS HEADER IS A BETA VERSION OF THE NEW PLUGIN INTERFACE. -// USE ONLY FOR EXPERIMENTAL PURPOSES! - -#ifndef nsplugin_h___ -#define nsplugin_h___ - -#ifdef __OS2__ -#pragma pack(1) -#endif - -// XXX Move this XP_ defining stuff to xpcom or nspr... - -#if defined (__OS2__ ) || defined (OS2) -# ifndef XP_OS2 -# define XP_OS2 1 -# endif /* XP_OS2 */ -#endif /* __OS2__ */ - -#ifdef _WINDOWS -# ifndef XP_WIN -# define XP_WIN 1 -# endif /* XP_WIN */ -#endif /* _WINDOWS */ - -#ifdef __MWERKS__ -# define _declspec __declspec -# ifdef macintosh -# ifndef XP_MAC -# define XP_MAC 1 -# endif /* XP_MAC */ -# endif /* macintosh */ -# ifdef __INTEL__ -# undef NULL -# ifndef XP_WIN -# define XP_WIN 1 -# endif /* __INTEL__ */ -# endif /* XP_PC */ -#endif /* __MWERKS__ */ - -#ifdef XP_MAC - #include - #include -#endif - -#ifdef XP_UNIX - #include - #include -#endif - -#include "jri.h" // XXX change to jni.h -#include "nsISupports.h" - -//////////////////////////////////////////////////////////////////////////////// - -/* The OS/2 version of Netscape uses RC_DATA to define the - mime types, file extentions, etc that are required. - Use a vertical bar to seperate types, end types with \0. - FileVersion and ProductVersion are 32bit ints, all other - entries are strings the MUST be terminated wwith a \0. - -AN EXAMPLE: - -RCDATA NP_INFO_ProductVersion { 1,0,0,1,} - -RCDATA NP_INFO_MIMEType { "video/x-video|", - "video/x-flick\0" } -RCDATA NP_INFO_FileExtents { "avi|", - "flc\0" } -RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", - "MMOS2 Flc/Fli player(*.flc)\0" } - -RCDATA NP_INFO_FileVersion { 1,0,0,1 } -RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } -RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" -RCDATA NP_INFO_InternalName { "NPAVI32\0" ) -RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0" -RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } -RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } - -*/ - - -/* RC_DATA types for version info - required */ -#define NP_INFO_ProductVersion 1 -#define NP_INFO_MIMEType 2 -#define NP_INFO_FileOpenName 3 -#define NP_INFO_FileExtents 4 - -/* RC_DATA types for version info - used if found */ -#define NP_INFO_FileDescription 5 -#define NP_INFO_ProductName 6 - -/* RC_DATA types for version info - optional */ -#define NP_INFO_CompanyName 7 -#define NP_INFO_FileVersion 8 -#define NP_INFO_InternalName 9 -#define NP_INFO_LegalCopyright 10 -#define NP_INFO_OriginalFilename 11 - -#ifndef RC_INVOKED - -//////////////////////////////////////////////////////////////////////////////// -// Structures and definitions - -#ifdef XP_MAC -#pragma options align=mac68k -#endif - -typedef const char* nsMIMEType; - -struct nsByteRange { - PRInt32 offset; /* negative offset means from the end */ - PRUint32 length; - struct nsByteRange* next; -}; - -struct nsRect { - PRUint16 top; - PRUint16 left; - PRUint16 bottom; - PRUint16 right; -}; - -//////////////////////////////////////////////////////////////////////////////// -// Unix specific structures and definitions - -#ifdef XP_UNIX - -/* - * Callback Structures. - * - * These are used to pass additional platform specific information. - */ -enum NPPluginCallbackType { - NPPluginCallbackType_SetWindow = 1, - NPPluginCallbackType_Print -}; - -struct NPPluginAnyCallbackStruct { - PRInt32 type; -}; - -struct NPPluginSetWindowCallbackStruct { - PRInt32 type; - Display* display; - Visual* visual; - Colormap colormap; - PRUint32 depth; -}; - -struct NPPluginPrintCallbackStruct { - PRInt32 type; - FILE* fp; -}; - -#endif /* XP_UNIX */ - -//////////////////////////////////////////////////////////////////////////////// - -// List of variable names for which NPP_GetValue shall be implemented -enum NPPluginVariable { - NPPluginVariable_NameString = 1, - NPPluginVariable_DescriptionString, - NPPluginVariable_WindowBool, // XXX go away - NPPluginVariable_TransparentBool, // XXX go away? - NPPluginVariable_JavaClass, // XXX go away - NPPluginVariable_WindowSize - // XXX add MIMEDescription (for unix) (but GetValue is on the instance, not the class) -}; - -// List of variable names for which NPN_GetValue is implemented by Mozilla -enum NPPluginManagerVariable { - NPPluginManagerVariable_XDisplay = 1, - NPPluginManagerVariable_XtAppContext, - NPPluginManagerVariable_NetscapeWindow, - NPPluginManagerVariable_JavascriptEnabledBool, // XXX prefs accessor api - NPPluginManagerVariable_ASDEnabledBool, // XXX prefs accessor api - NPPluginManagerVariable_IsOfflineBool // XXX prefs accessor api -}; - -//////////////////////////////////////////////////////////////////////////////// - -enum NPPluginType { - NPPluginType_Embedded = 1, - NPPluginType_Full -}; - -// XXX this can go away now -enum NPStreamType { - NPStreamType_Normal = 1, - NPStreamType_Seek, - NPStreamType_AsFile, - NPStreamType_AsFileOnly -}; - -#define NP_STREAM_MAXREADY (((unsigned)(~0)<<1)>>1) - -/* - * The type of a NPWindow - it specifies the type of the data structure - * returned in the window field. - */ -enum NPPluginWindowType { - NPPluginWindowType_Window = 1, - NPPluginWindowType_Drawable -}; - -struct NPPluginWindow { - void* window; /* Platform specific window handle */ - /* OS/2: x - Position of bottom left corner */ - /* OS/2: y - relative to visible netscape window */ - PRUint32 x; /* Position of top left corner relative */ - PRUint32 y; /* to a netscape page. */ - PRUint32 width; /* Maximum window size */ - PRUint32 height; - nsRect clipRect; /* Clipping rectangle in port coordinates */ - /* Used by MAC only. */ -#ifdef XP_UNIX - void* ws_info; /* Platform-dependent additonal data */ -#endif /* XP_UNIX */ - NPPluginWindowType type; /* Is this a window or a drawable? */ -}; - -struct NPPluginFullPrint { - PRBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */ - /* printing */ - PRBool printOne; /* TRUE if plugin should print one copy */ - /* to default printer */ - void* platformPrint; /* Platform-specific printing info */ -}; - -struct NPPluginEmbedPrint { - NPPluginWindow window; - void* platformPrint; /* Platform-specific printing info */ -}; - -struct NPPluginPrint { - NPPluginType mode; /* NP_FULL or NPPluginType_Embedded */ - union - { - NPPluginFullPrint fullPrint; /* if mode is NP_FULL */ - NPPluginEmbedPrint embedPrint; /* if mode is NPPluginType_Embedded */ - } print; -}; - -struct NPPluginEvent { - -#if defined(XP_MAC) - EventRecord* event; - void* window; - -#elif defined(XP_WIN) - uint16 event; - uint32 wParam; - uint32 lParam; - -#elif defined(XP_OS2) - uint32 event; - uint32 wParam; - uint32 lParam; - -#elif defined(XP_UNIX) - XEvent event; - -#endif -}; - -#ifdef XP_MAC -typedef RgnHandle nsRegion; -#elif defined(XP_WIN) -typedef HRGN nsRegion; -#elif defined(XP_UNIX) -typedef Region nsRegion; -#else -typedef void *nsRegion; -#endif /* XP_MAC */ - -//////////////////////////////////////////////////////////////////////////////// -// Mac-specific structures and definitions. - -#ifdef XP_MAC - -struct NPPort { - CGrafPtr port; /* Grafport */ - PRInt32 portx; /* position inside the topmost window */ - PRInt32 porty; -}; - -/* - * Non-standard event types that can be passed to HandleEvent - */ -#define getFocusEvent (osEvt + 16) -#define loseFocusEvent (osEvt + 17) -#define adjustCursorEvent (osEvt + 18) -#define menuCommandEvent (osEvt + 19) - -#endif /* XP_MAC */ - -//////////////////////////////////////////////////////////////////////////////// -// Error and Reason Code definitions - -enum NPPluginError { - NPPluginError_Base = 0, - NPPluginError_NoError = 0, - NPPluginError_GenericError, - NPPluginError_InvalidInstanceError, - NPPluginError_InvalidFunctableError, - NPPluginError_ModuleLoadFailedError, - NPPluginError_OutOfMemoryError, - NPPluginError_InvalidPluginError, - NPPluginError_InvalidPluginDirError, - NPPluginError_IncompatibleVersionError, - NPPluginError_InvalidParam, - NPPluginError_InvalidUrl, - NPPluginError_FileNotFound, - NPPluginError_NoData, - NPPluginError_StreamNotSeekable -}; - -enum NPPluginReason { - NPPluginReason_Base = 0, - NPPluginReason_Done = 0, - NPPluginReason_NetworkErr, - NPPluginReason_UserBreak, - NPPluginReason_NoReason -}; - -//////////////////////////////////////////////////////////////////////////////// -// Classes -//////////////////////////////////////////////////////////////////////////////// - -class NPIStream; // base class for all streams - -// Classes that must be implemented by the plugin DLL: -class NPIPlugin; // plugin class (MIME-type handler) -class NPILiveConnectPlugin; // subclass of NPIPlugin -class NPIPluginInstance; // plugin instance -class NPIPluginStream; // stream to receive data from the browser - -// Classes that are implemented by the browser: -class NPIPluginManager; // minimum browser requirements -class NPIPluginManagerStream; // stream to send data to the browser -class NPIPluginInstancePeer; // parts of NPIPluginInstance implemented by the browser -class NPILiveConnectPluginInstancePeer; // subclass of NPIPluginInstancePeer -class NPIPluginStreamPeer; // parts of NPIPluginStream implemented by the browser -class NPISeekablePluginStreamPeer; // seekable subclass of NPIPluginStreamPeer - -// Plugin DLL Side Browser Side -// -// -// +-----------+ +-----------------------+ -// | Plugin / | | Plugin Manager | -// | LC Plugin | | | -// +-----------+ +-----------------------+ -// ^ ^ -// | | -// | +-----------------------+ -// | | Plugin Manager Stream | -// | +-----------------------+ -// | -// | -// +-----------------+ peer +-----------------------+ -// | Plugin Instance |---------->| Plugin Instance Peer | -// | | | / LC Plugin Inst Peer | -// +-----------------+ +-----------------------+ -// -// +-----------------+ peer +-----------------------+ -// | Plugin Stream |---------->| Plugin Stream Peer / | -// | | | Seekable P Stream Peer| -// +-----------------+ +-----------------------+ - -//////////////////////////////////////////////////////////////////////////////// -// This is the main entry point to the plugin's DLL. The plugin manager finds -// this symbol and calls it to create the plugin class. Once the plugin object -// is returned to the plugin manager, instances on the page are created by -// calling NPIPlugin::NewInstance. - -// (Corresponds to NPP_Initialize.) -extern "C" NS_EXPORT NPPluginError -NP_CreatePlugin(NPIPluginManager* mgr, NPIPlugin* *result); - -//////////////////////////////////////////////////////////////////////////////// -// Plugin Stream Interface -// This base class is shared by both the plugin and the plugin manager. - -class NPIStream : public nsISupports { -public: - - // The Release method on NPIPlugin corresponds to NPP_DestroyStream. - - // (Corresponds to NPP_WriteReady.) - NS_IMETHOD_(PRInt32) - WriteReady(void) = 0; - - // (Corresponds to NPP_Write and NPN_Write.) - NS_IMETHOD_(PRInt32) - Write(PRInt32 len, void* buffer) = 0; - -}; - -#define NP_ISTREAM_IID \ -{ /* 5d852ef0-a1bc-11d1-85b1-00805f0e4dfe */ \ - 0x5d852ef0, \ - 0xa1bc, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// THINGS THAT MUST BE IMPLEMENTED BY THE PLUGIN... -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// Plugin Interface -// This is the minimum interface plugin developers need to support in order to -// implement a plugin. The plugin manager may QueryInterface for more specific -// plugin types, e.g. NPILiveConnectPlugin. - -class NPIPlugin : public nsISupports { -public: - - // The Release method on NPIPlugin corresponds to NPP_Shutdown. - - // The old NPP_New call has been factored into two plugin instance methods: - // - // NewInstance -- called once, after the plugin instance is created. This - // method is used to initialize the new plugin instance (although the actual - // plugin instance object will be created by the plugin manager). - // - // NPIPluginInstance::Start -- called when the plugin instance is to be - // started. This happens in two circumstances: (1) after the plugin instance - // is first initialized, and (2) after a plugin instance is returned to - // (e.g. by going back in the window history) after previously being stopped - // by the Stop method. - - NS_IMETHOD_(NPPluginError) - NewInstance(NPIPluginInstancePeer* peer, NPIPluginInstance* *result) = 0; - -#ifdef XP_UNIX // XXX why can't this be XP? - - // (Corresponds to NPP_GetMIMEDescription.) - NS_IMETHOD_(const char*) - GetMIMEDescription(void) = 0; - -#endif /* XP_UNIX */ - -}; - -#define NP_IPLUGIN_IID \ -{ /* 8a623430-a1bc-11d1-85b1-00805f0e4dfe */ \ - 0x8a623430, \ - 0xa1bc, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// LiveConnect Plugin Interface -// This interface defines additional entry points that a plugin developer needs -// to implement in order for the plugin to support LiveConnect, i.e. be -// scriptable by Java or JavaScript. - -class NPILiveConnectPlugin : public NPIPlugin { -public: - - // (Corresponds to NPP_GetJavaClass.) - NS_IMETHOD_(jclass) - GetJavaClass(void) = 0; - -}; - -#define NP_ILIVECONNECTPLUGIN_IID \ -{ /* cf134df0-a1bc-11d1-85b1-00805f0e4dfe */ \ - 0xcf134df0, \ - 0xa1bc, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// Plugin Instance Interface - -// (Corresponds to NPP object.) -class NPIPluginInstance : public nsISupports { -public: - - // The Release method on NPIPluginInstance corresponds to NPP_Destroy. - - // See comment for NPIPlugin::NewInstance, above. - NS_IMETHOD_(NPPluginError) - Start(void) = 0; - - // The old NPP_Destroy call has been factored into two plugin instance - // methods: - // - // Stop -- called when the plugin instance is to be stopped (e.g. by - // displaying another plugin manager window, causing the page containing - // the plugin to become removed from the display). - // - // Release -- called once, before the plugin instance peer is to be - // destroyed. This method is used to destroy the plugin instance. - - NS_IMETHOD_(NPPluginError) - Stop(void) = 0; - - // (Corresponds to NPP_SetWindow.) - NS_IMETHOD_(NPPluginError) - SetWindow(NPPluginWindow* window) = 0; - - // (Corresponds to NPP_NewStream.) - NS_IMETHOD_(NPPluginError) - NewStream(NPIPluginStreamPeer* peer, NPIPluginStream* *result) = 0; - - // (Corresponds to NPP_Print.) - NS_IMETHOD_(void) - Print(NPPluginPrint* platformPrint) = 0; - - // (Corresponds to NPP_HandleEvent.) - // Note that for Unix and Mac the NPPluginEvent structure is different - // from the old NPEvent structure -- it's no longer the native event - // record, but is instead a struct. This was done for future extensibility, - // and so that the Mac could receive the window argument too. For Windows - // and OS2, it's always been a struct, so there's no change for them. - NS_IMETHOD_(PRInt16) - HandleEvent(NPPluginEvent* event) = 0; - - // (Corresponds to NPP_URLNotify.) - NS_IMETHOD_(void) - URLNotify(const char* url, const char* target, - NPPluginReason reason, void* notifyData) = 0; - - // (Corresponds to NPP_GetValue.) - NS_IMETHOD_(NPPluginError) - GetValue(NPPluginVariable variable, void *value) = 0; - - // (Corresponds to NPP_SetValue.) - NS_IMETHOD_(NPPluginError) - SetValue(NPPluginManagerVariable variable, void *value) = 0; - -}; - -#define NP_IPLUGININSTANCE_IID \ -{ /* b62f3a10-a1bc-11d1-85b1-00805f0e4dfe */ \ - 0xb62f3a10, \ - 0xa1bc, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// Plugin Stream Interface - -class NPIPluginStream : public NPIStream { -public: - - // (Corresponds to NPP_NewStream's stype return parameter.) - NS_IMETHOD_(NPStreamType) - GetStreamType(void) = 0; - - // (Corresponds to NPP_StreamAsFile.) - NS_IMETHOD_(void) - AsFile(const char* fname) = 0; - -}; - -#define NP_IPLUGINSTREAM_IID \ -{ /* e7a97340-a1bc-11d1-85b1-00805f0e4dfe */ \ - 0xe7a97340, \ - 0xa1bc, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// THINGS IMPLEMENTED BY THE BROWSER... -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -// Plugin Manager Interface -// This interface defines the minimum set of functionality that a plugin -// manager will support if it implements plugins. Plugin implementations can -// QueryInterface to determine if a plugin manager implements more specific -// APIs for the plugin to use. - -class NPIPluginManager : public nsISupports { -public: - - // QueryInterface may be used to obtain a JRIEnv or JNIEnv - // from an NPIPluginManager. - // (Corresponds to NPN_GetJavaEnv.) - - // (Corresponds to NPN_ReloadPlugins.) - NS_IMETHOD_(void) - ReloadPlugins(PRBool reloadPages) = 0; - - // (Corresponds to NPN_MemAlloc.) - NS_IMETHOD_(void*) - MemAlloc(PRUint32 size) = 0; - - // (Corresponds to NPN_MemFree.) - NS_IMETHOD_(void) - MemFree(void* ptr) = 0; - - // (Corresponds to NPN_MemFlush.) - NS_IMETHOD_(PRUint32) - MemFlush(PRUint32 size) = 0; - -}; - -#define NP_IPLUGINMANAGER_IID \ -{ /* f10b9600-a1bc-11d1-85b1-00805f0e4dfe */ \ - 0xf10b9600, \ - 0xa1bc, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -#define NP_IJRIENV_IID \ -{ /* f9d4ea00-a1bc-11d1-85b1-00805f0e4dfe */ \ - 0xf9d4ea00, \ - 0xa1bc, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -#define NP_IJNIENV_IID \ -{ /* 04610650-a1bd-11d1-85b1-00805f0e4dfe */ \ - 0x04610650, \ - 0xa1bd, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// Plugin Instance Peer Interface - -class NPIPluginInstancePeer : public nsISupports { -public: - - NS_IMETHOD_(NPIPlugin*) - GetClass(void) = 0; - - // (Corresponds to NPP_New's MIMEType argument.) - NS_IMETHOD_(nsMIMEType) - GetMIMEType(void) = 0; - - // (Corresponds to NPP_New's mode argument.) - NS_IMETHOD_(NPPluginType) - GetMode(void) = 0; - - // (Corresponds to NPP_New's argc argument.) - NS_IMETHOD_(PRUint16) - GetArgCount(void) = 0; - - // (Corresponds to NPP_New's argn argument.) - NS_IMETHOD_(const char**) - GetArgNames(void) = 0; - - // (Corresponds to NPP_New's argv argument.) - NS_IMETHOD_(const char**) - GetArgValues(void) = 0; - - NS_IMETHOD_(NPIPluginManager*) - GetPluginManager(void) = 0; - - // (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) = 0; - - // (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) = 0; - - // (Corresponds to NPN_NewStream.) - NS_IMETHOD_(NPPluginError) - NewStream(nsMIMEType type, const char* target, - NPIPluginManagerStream* *result) = 0; - - // (Corresponds to NPN_Status.) - NS_IMETHOD_(void) - ShowStatus(const char* message) = 0; - - // (Corresponds to NPN_UserAgent.) - NS_IMETHOD_(const char*) - UserAgent(void) = 0; - - // (Corresponds to NPN_GetValue.) - NS_IMETHOD_(NPPluginError) - GetValue(NPPluginManagerVariable variable, void *value) = 0; - - // (Corresponds to NPN_SetValue.) - NS_IMETHOD_(NPPluginError) - SetValue(NPPluginVariable variable, void *value) = 0; - - //////////////////////////////////////////////////////////////////////////// - // XXX Only used by windowless plugin instances?... - - // (Corresponds to NPN_InvalidateRect.) - NS_IMETHOD_(void) - InvalidateRect(nsRect *invalidRect) = 0; - - // (Corresponds to NPN_InvalidateRegion.) - NS_IMETHOD_(void) - InvalidateRegion(nsRegion invalidRegion) = 0; - - // (Corresponds to NPN_ForceRedraw.) - NS_IMETHOD_(void) - ForceRedraw(void) = 0; - - // New top-level window handling calls for Mac: - - NS_IMETHOD_(void) - RegisterWindow(void* window) = 0; - - NS_IMETHOD_(void) - UnregisterWindow(void* window) = 0; - - // Menu ID allocation calls for Mac: - - NS_IMETHOD_(PRInt16) - AllocateMenuID(PRBool isSubmenu) = 0; -}; - -#define NP_IPLUGININSTANCEPEER_IID \ -{ /* 15c75de0-a1bd-11d1-85b1-00805f0e4dfe */ \ - 0x15c75de0, \ - 0xa1bd, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// LiveConnect Plugin Instance Peer Interface -// Browsers that support LiveConnect implement this subclass of plugin instance -// peer. - -// XXX Should this really be a separate subclass? - -class NPILiveConnectPluginInstancePeer : public NPIPluginInstancePeer { -public: - - // (Corresponds to NPN_GetJavaPeer.) - NS_IMETHOD_(jobject) - GetJavaPeer(void) = 0; - -}; - -#define NP_ILIVECONNECTPLUGININSTANCEPEER_IID \ -{ /* 1e3502a0-a1bd-11d1-85b1-00805f0e4dfe */ \ - 0x1e3502a0, \ - 0xa1bd, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// Plugin Manager Stream Interface - -class NPIPluginManagerStream : public NPIStream { -public: - - // (Corresponds to NPStream's url field.) - NS_IMETHOD_(const char*) - GetURL(void) = 0; - - // (Corresponds to NPStream's end field.) - NS_IMETHOD_(PRUint32) - GetEnd(void) = 0; - - // (Corresponds to NPStream's lastmodified field.) - NS_IMETHOD_(PRUint32) - GetLastModified(void) = 0; - - // (Corresponds to NPStream's notifyData field.) - NS_IMETHOD_(void*) - GetNotifyData(void) = 0; - -}; - -#define NP_IPLUGINMANAGERSTREAM_IID \ -{ /* 30c24560-a1bd-11d1-85b1-00805f0e4dfe */ \ - 0x30c24560, \ - 0xa1bd, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// Plugin Stream Peer Interface -// A plugin stream peer is passed to a plugin instance's NewStream call in -// order to indicate that a new stream is to be created and be read by the -// plugin instance. - -class NPIPluginStreamPeer : public nsISupports { -public: - - // (Corresponds to NPP_DestroyStream's reason argument.) - NS_IMETHOD_(NPPluginReason) - GetReason(void) = 0; - - // (Corresponds to NPP_NewStream's MIMEType argument.) - NS_IMETHOD_(nsMIMEType) - GetMIMEType(void) = 0; - - NS_IMETHOD_(PRUint32) - GetContentLength(void) = 0; -#if 0 - NS_IMETHOD_(const char*) - GetContentEncoding(void) = 0; - - NS_IMETHOD_(const char*) - GetCharSet(void) = 0; - - NS_IMETHOD_(const char*) - GetBoundary(void) = 0; - - NS_IMETHOD_(const char*) - GetContentName(void) = 0; - - NS_IMETHOD_(time_t) - GetExpires(void) = 0; - - NS_IMETHOD_(time_t) - GetLastModified(void) = 0; - - NS_IMETHOD_(time_t) - GetServerDate(void) = 0; - - NS_IMETHOD_(NPServerStatus) - GetServerStatus(void) = 0; -#endif - NS_IMETHOD_(PRUint32) - GetHeaderFieldCount(void) = 0; - - NS_IMETHOD_(const char*) - GetHeaderFieldKey(PRUint32 index) = 0; - - NS_IMETHOD_(const char*) - GetHeaderField(PRUint32 index) = 0; - -}; - -#define NP_IPLUGINSTREAMPEER_IID \ -{ /* 38278eb0-a1bd-11d1-85b1-00805f0e4dfe */ \ - 0x38278eb0, \ - 0xa1bd, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// Seekable Plugin Stream Peer Interface -// The browser implements this subclass of plugin stream peer if a stream -// is seekable. Plugins can query interface for this type, and call the -// RequestRead method to seek to a particular position in the stream. - -class NPISeekablePluginStreamPeer : public NPIPluginStreamPeer { -public: - - // QueryInterface for this class corresponds to NPP_NewStream's - // seekable argument. - - // (Corresponds to NPN_RequestRead.) - NS_IMETHOD_(NPPluginError) - RequestRead(nsByteRange* rangeList) = 0; - -}; - -#define NP_ISEEKABLEPLUGINSTREAMPEER_IID \ -{ /* f55c8250-a73e-11d1-85b1-00805f0e4dfe */ \ - 0xf55c8250, \ - 0xa73e, \ - 0x11d1, \ - {0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \ -} \ - -//////////////////////////////////////////////////////////////////////////////// - -#ifdef XP_MAC -#pragma options align=reset -#endif - -#endif /* RC_INVOKED */ -#ifdef __OS2__ -#pragma pack() -#endif - -#endif /* nsplugin_h___ */ diff --git a/mozilla/lib/xlate/print.c b/mozilla/lib/xlate/print.c index 26325ac7ce5..67ea283eb3d 100644 --- a/mozilla/lib/xlate/print.c +++ b/mozilla/lib/xlate/print.c @@ -1878,7 +1878,7 @@ void PSFE_FreeEmbedElement (MWContext *context, LO_EmbedStruct *embed_struct) { NPL_EmbedDelete(context, embed_struct); - embed_struct->FE_Data = 0; + embed_struct->objTag.FE_Data = 0; } void @@ -1919,18 +1919,18 @@ PSFE_DisplayEmbed (MWContext *context, NPPrint npprint; if (!embed_struct) return; - eApp = (NPEmbeddedApp *)embed_struct->FE_Data; + eApp = (NPEmbeddedApp *)embed_struct->objTag.FE_Data; if (!eApp) return; npprint.mode = NP_EMBED; npprint.print.embedPrint.platformPrint = NULL; npprint.print.embedPrint.window.window = NULL; npprint.print.embedPrint.window.x = - embed_struct->x + embed_struct->x_offset; + embed_struct->objTag.x + embed_struct->objTag.x_offset; npprint.print.embedPrint.window.y = - embed_struct->y + embed_struct->y_offset; - npprint.print.embedPrint.window.width = embed_struct->width; - npprint.print.embedPrint.window.height = embed_struct->height; + embed_struct->objTag.y + embed_struct->objTag.y_offset; + npprint.print.embedPrint.window.width = embed_struct->objTag.width; + npprint.print.embedPrint.window.height = embed_struct->objTag.height; npPrintInfo.type = NP_PRINT; npPrintInfo.fp = context->prSetup->out; @@ -1943,30 +1943,36 @@ void PSFE_GetEmbedSize (MWContext *context, LO_EmbedStruct *embed_struct, NET_ReloadMethod force_reload) { - NPEmbeddedApp *eApp = (NPEmbeddedApp *)embed_struct->FE_Data; + NPEmbeddedApp *eApp = (NPEmbeddedApp *)embed_struct->objTag.FE_Data; if(eApp) return; /* attempt to make a plugin */ if(!(eApp = NPL_EmbedCreate(context, embed_struct)) || - (embed_struct->ele_attrmask & LO_ELE_HIDDEN)) { + (embed_struct->objTag.ele_attrmask & LO_ELE_HIDDEN)) { return; } /* Determine if this is a fullpage plugin */ +#ifdef OJI + if ((embed_struct->attributes.n > 0) && + (!strcmp(embed_struct->attributes.names[0], "src")) && + (!strcmp(embed_struct->attributes.values[0], "internal-external-plugin"))) +#else if ((embed_struct->attribute_cnt > 0) && (!strcmp(embed_struct->attribute_list[0], "src")) && (!strcmp(embed_struct->value_list[0], "internal-external-plugin"))) +#endif { - embed_struct->width = context->prInfo->page_width; - embed_struct->height = context->prInfo->page_height; + embed_struct->objTag.width = context->prInfo->page_width; + embed_struct->objTag.height = context->prInfo->page_height; } - embed_struct->FE_Data = (void *)eApp; + embed_struct->objTag.FE_Data = (void *)eApp; if (NPL_EmbedStart(context, embed_struct, eApp) != NPERR_NO_ERROR) { /* Spoil sport! */ - embed_struct->FE_Data = NULL; + embed_struct->objTag.FE_Data = NULL; return; } } @@ -1979,27 +1985,27 @@ void PSFE_DisplayJavaApp(MWContext *context, int iLocation, int x, y; float w, h, tw, th; - LJAppletData *ad = (LJAppletData *)java_app->session_data; + LJAppletData *ad = (LJAppletData *)java_app->objTag.session_data; if (!XP_CheckElementSpan(context, - java_app->x + java_app->x_offset, java_app->height)) + java_app->objTag.x + java_app->objTag.x_offset, java_app->objTag.height)) return; /* Calculate (x,y) coordinate of bottom left corner. */ - x = java_app->x + java_app->x_offset; - y = java_app->y + java_app->y_offset + java_app->height; + x = java_app->objTag.x + java_app->objTag.x_offset; + y = java_app->objTag.y + java_app->objTag.y_offset + java_app->objTag.height; - w = PAGE_TO_POINT_F(java_app->width); - h = PAGE_TO_POINT_F(java_app->height); + w = PAGE_TO_POINT_F(java_app->objTag.width); + h = PAGE_TO_POINT_F(java_app->objTag.height); - tw = (float)java_app->width / context->convertPixX; - th = (float)java_app->height / context->convertPixY; + tw = (float)java_app->objTag.width / context->convertPixX; + th = (float)java_app->objTag.height / context->convertPixY; XP_FilePrintf(context->prSetup->out, "BeginEPSF\n"); /* Clip to the applet's bounding box */ - xl_moveto(context, java_app->x, java_app->y); - xl_box(context, java_app->width, java_app->height); + xl_moveto(context, java_app->objTag.x, java_app->objTag.y); + xl_box(context, java_app->objTag.width, java_app->objTag.height); XP_FilePrintf(context->prSetup->out, "clip\n"); xl_translate(context, x, y); diff --git a/mozilla/modules/Makefile b/mozilla/modules/Makefile index 16e4f3a0f13..512d2824cda 100644 --- a/mozilla/modules/Makefile +++ b/mozilla/modules/Makefile @@ -36,20 +36,24 @@ ifdef NO_SECURITY DIRS += security endif -ifdef MOZ_JAVA -DIRS += libreg softupdt zlib li progress +ifdef JAVA_OR_OJI +DIRS += libreg softupdt +endif # JAVA_OR_OJI -ifdef EDITOR -DIRS += edtplug spellchk +ifdef MOZ_OJI +DIRS += modules/oji endif -else # MOZ_JAVA DIRS += zlib li progress -ifdef EDITOR -DIRS += spellchk -endif -endif # MOZ_JAVA +ifdef EDITOR + +ifdef JAVA_OR_OJI +DIRS += edtplug +endif # JAVA_OR_OJI + +DIRS += spellchk +endif # EDITOR ifeq ($(subst /,_,$(shell uname -s)),OS2) DIRS += spellchk diff --git a/mozilla/modules/edtplug/src/edtplugStubs.c b/mozilla/modules/edtplug/src/edtplugStubs.c index e7e566e6ea3..e9aa0a133b5 100644 --- a/mozilla/modules/edtplug/src/edtplugStubs.c +++ b/mozilla/modules/edtplug/src/edtplugStubs.c @@ -77,9 +77,11 @@ void EDTPLUG_RegisterEditURLCallback(EditURLCallback callback){ static JRIEnv* getEnv(MozillaEvent_MozillaCallback* e) { JRIEnv* ee = e->env; +#ifdef JAVA // XXX hack to get OJI working if ( ! ee ) { ee = JRI_GetCurrentEnv(); } +#endif return ee; } diff --git a/mozilla/modules/libfont/jmcgen/include/Mwinfp.h b/mozilla/modules/libfont/jmcgen/include/Mwinfp.h index 16edecebc6c..32f05760f7b 100755 --- a/mozilla/modules/libfont/jmcgen/include/Mwinfp.h +++ b/mozilla/modules/libfont/jmcgen/include/Mwinfp.h @@ -1,22 +1,6 @@ -/* -*- 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. - */ +/* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* - * Source date: 26 Feb 1998 01:03:40 GMT + * Source date: 28 Apr 1998 21:44:18 GMT * netscape/fonts/winfp module C header file * Generated by jmc version 1.8 -- DO NOT EDIT ******************************************************************************/ diff --git a/mozilla/modules/libfont/jmcgen/include/Mwinrf.h b/mozilla/modules/libfont/jmcgen/include/Mwinrf.h index 6678a81081b..a9dfc9c9ea2 100755 --- a/mozilla/modules/libfont/jmcgen/include/Mwinrf.h +++ b/mozilla/modules/libfont/jmcgen/include/Mwinrf.h @@ -1,22 +1,6 @@ -/* -*- 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. - */ +/* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* - * Source date: 26 Feb 1998 01:03:40 GMT + * Source date: 28 Apr 1998 21:44:18 GMT * netscape/fonts/winrf module C header file * Generated by jmc version 1.8 -- DO NOT EDIT ******************************************************************************/ diff --git a/mozilla/modules/libfont/producers/win/makefile.win b/mozilla/modules/libfont/producers/win/makefile.win index 3469f635698..0bd4fdf624e 100644 --- a/mozilla/modules/libfont/producers/win/makefile.win +++ b/mozilla/modules/libfont/producers/win/makefile.win @@ -20,7 +20,10 @@ IGNORE_MANIFEST=1 # DEPTH=..\..\..\.. -!ifdef MOZ_JAVA + +!include $(DEPTH)\config\config.mak + +!ifdef JAVA_OR_OJI DIRS=classes src !else DIRS=src diff --git a/mozilla/modules/libfont/producers/win/src/makefile.win b/mozilla/modules/libfont/producers/win/src/makefile.win index 7e0d9950358..5b73385e0d6 100644 --- a/mozilla/modules/libfont/producers/win/src/makefile.win +++ b/mozilla/modules/libfont/producers/win/src/makefile.win @@ -26,6 +26,9 @@ IGNORE_MANIFEST=1 OBJS = $(OBJS) $(JMC_OBJS) DEPTH=..\..\..\..\.. + +!include $(DEPTH)\config\config.mak + MODULE=winfont CCJMC=1 JMC_GEN=Mwinfp Mwinrf @@ -44,14 +47,14 @@ LINCS=-I$(XPDIST)\public\jtools -I$(XPDIST)\public\nspr \ -I$(XPDIST)\public\java !endif -!if !defined (MOZ_JAVA) +!if !defined (JAVA_OR_OJI) LOCAL_JMC_SUBDIR = ..\..\..\jmcgen\include LOCAL_JMC_SRC_SUBDIR = ..\..\..\jmcgen\src !endif !include $(DEPTH)\config\rules.mak -!if !defined (MOZ_JAVA) +!if !defined (JAVA_OR_OJI) export:: @echo +++ make: Copying JMC src files from $(LOCAL_JMC_SRC_SUBDIR)/Mwin*.c to cwd -for %f in ($(LOCAL_JMC_SRC_SUBDIR)\Mwin*.c) do $(MAKE_INSTALL) %f . @@ -81,4 +84,3 @@ MY_INSTALL_DIR = $(DIST)\lib install:: !$(MAKE_INSTALL) $(MY_INSTALL_FILE_LIST) $(MY_INSTALL_DIR) - diff --git a/mozilla/modules/libfont/public/Makefile b/mozilla/modules/libfont/public/Makefile index ebd683ffb93..f1d62884939 100644 --- a/mozilla/modules/libfont/public/Makefile +++ b/mozilla/modules/libfont/public/Makefile @@ -15,12 +15,14 @@ # Copyright (C) 1998 Netscape Communications Corporation. All Rights # Reserved. -ifndef MOZ_JAVA +DEPTH = ../../.. + +include $(DEPTH)/config/config.mk + +ifndef JAVA_OR_OJI LOCAL_JMC_SUBDIR = ../jmcgen/include endif -DEPTH = ../../.. - MODULE = libfont JMC_GEN = Mnfdoer \ diff --git a/mozilla/modules/libfont/public/makefile.win b/mozilla/modules/libfont/public/makefile.win index d195d161695..ee97c3ba3f6 100644 --- a/mozilla/modules/libfont/public/makefile.win +++ b/mozilla/modules/libfont/public/makefile.win @@ -17,14 +17,13 @@ IGNORE_MANIFEST=1 -!ifndef MOZ_JAVA -LOCAL_JMC_SUBDIR = ..\jmcgen\include -!endif - - DEPTH=..\..\.. !include $(DEPTH)\config\config.mak +!ifndef JAVA_OR_OJI +LOCAL_JMC_SUBDIR = ..\jmcgen\include +!endif + JMC_GEN=Mnfdoer Mnff Mnffbc Mnffbp Mnffbu Mnffmi Mnffp Mnfrc Mnfrf \ Mnfstrm Mnfdlm @@ -33,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(MOZ_JAVA) +!if !defined(JAVA_OR_OJI) EXPORTS=$(EXPORTS) $(JMC_GEN_DIR)\Mwinfp.h !endif diff --git a/mozilla/modules/libfont/src/Makefile b/mozilla/modules/libfont/src/Makefile index 9bb62ce8e6e..11eeb9de268 100644 --- a/mozilla/modules/libfont/src/Makefile +++ b/mozilla/modules/libfont/src/Makefile @@ -15,13 +15,15 @@ # Copyright (C) 1998 Netscape Communications Corporation. All Rights # Reserved. -ifndef MOZ_JAVA +DEPTH = ../../.. + +include $(DEPTH)/config/config.mk + +ifndef JAVA_OR_OJI LOCAL_JMC_SUBDIR = ../jmcgen/include LOCAL_JMC_SRC_SUBDIR = ../jmcgen/src endif -DEPTH = ../../.. - MODULE = libfont LIBRARY_NAME = font @@ -62,7 +64,7 @@ SDK_TARGET = producer-sdk SDK_NAME = FontProducer-sdk-v1.0 SDK_DIR = $(OBJDIR)/$(SDK_TARGET) -ifndef MOZ_JAVA +ifndef JAVA_OR_OJI export:: @echo "Copying JMC src files from $(LOCAL_JMC_SRC_SUBDIR)/*.c to cwd" @for FILE in $(LOCAL_JMC_SRC_SUBDIR)/*.c ;\ diff --git a/mozilla/modules/libfont/src/makefile.win b/mozilla/modules/libfont/src/makefile.win index 5690ddd684b..11a628f471c 100644 --- a/mozilla/modules/libfont/src/makefile.win +++ b/mozilla/modules/libfont/src/makefile.win @@ -27,6 +27,9 @@ OBJS = $(OBJS) $(JMC_OBJS) DEPTH=..\..\.. + +!include $(DEPTH)\config\config.mak + MODULE=libfont JMC_GEN=Mcf Mcfb Mcfmi Mcrc Mcdoer JMC_GEN_FLAGS=-cimpl @@ -62,14 +65,14 @@ LINCS=-I$(XPDIST)\public\libfont -I$(XPDIST)\public\java \ -I$(XPDIST)\public\htmldlgs -I$(XPDIST)\public\security !endif -!if !defined (MOZ_JAVA) +!if !defined (JAVA_OR_OJI) LOCAL_JMC_SUBDIR = ..\jmcgen\include LOCAL_JMC_SRC_SUBDIR = ..\jmcgen\src !endif !include $(DEPTH)\config\rules.mak -!if !defined (MOZ_JAVA) +!if !defined (JAVA_OR_OJI) 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 . diff --git a/mozilla/modules/libimg/public/MIMGCB.h b/mozilla/modules/libimg/public/MIMGCB.h index a8f22b44554..e65102b8b11 100644 --- a/mozilla/modules/libimg/public/MIMGCB.h +++ b/mozilla/modules/libimg/public/MIMGCB.h @@ -1,35 +1,19 @@ -/* -*- 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. - */ - +/* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* - * Source date: 16 Jan 1997 01:24:04 GMT + * Source date: 3 Jun 1998 00:22:02 GMT * netscape/libimg/IMGCB module C header file + * Generated by jmc version 1.8 -- DO NOT EDIT ******************************************************************************/ #ifndef _MIMGCB_H_ #define _MIMGCB_H_ +#include "jmc.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "jmc.h" - /******************************************************************************* * IMGCB ******************************************************************************/ @@ -46,7 +30,7 @@ typedef struct IMGCB { #ifndef JMC_INIT_IMGCB_ID extern EXTERN_C_WITHOUT_EXTERN const JMCInterfaceID IMGCB_ID; #else -EXTERN_C const JMCInterfaceID IMGCB_ID = { 0x38775d44, 0x23525963, 0x7f763562, 0x625c5b2a }; +EXTERN_C const JMCInterfaceID IMGCB_ID = { 0x38775d44, 0x23525963, 0x7f76557d, 0x4b0a5b2a }; #endif /* JMC_INIT_IMGCB_ID */ /******************************************************************************* * IMGCB Operations @@ -181,15 +165,19 @@ typedef struct IMGCBImplHeader { * given a pointer to one of its interfaces. ******************************************************************************/ +#undef IMGCBImpl2IMGCBIF #define IMGCBImpl2IMGCBIF(IMGCBImplPtr) \ ((IMGCBIF*)((char*)(IMGCBImplPtr) + offsetof(IMGCBImplHeader, vtableIMGCB))) +#undef IMGCBIF2IMGCBImpl #define IMGCBIF2IMGCBImpl(IMGCBIFPtr) \ ((IMGCBImpl*)((char*)(IMGCBIFPtr) - offsetof(IMGCBImplHeader, vtableIMGCB))) +#undef IMGCBImpl2IMGCB #define IMGCBImpl2IMGCB(IMGCBImplPtr) \ ((IMGCB*)((char*)(IMGCBImplPtr) + offsetof(IMGCBImplHeader, vtableIMGCB))) +#undef IMGCB2IMGCBImpl #define IMGCB2IMGCBImpl(IMGCBPtr) \ ((IMGCBImpl*)((char*)(IMGCBPtr) - offsetof(IMGCBImplHeader, vtableIMGCB))) diff --git a/mozilla/modules/libimg/public/MIMGCBIF.h b/mozilla/modules/libimg/public/MIMGCBIF.h index fa0cfb6b1cb..ab087114d1d 100644 --- a/mozilla/modules/libimg/public/MIMGCBIF.h +++ b/mozilla/modules/libimg/public/MIMGCBIF.h @@ -1,35 +1,19 @@ -/* -*- 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. - */ - +/* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* - * Source date: 16 Jan 1997 01:24:04 GMT + * Source date: 3 Jun 1998 00:22:02 GMT * netscape/libimg/IMGCBIF module C header file + * Generated by jmc version 1.8 -- DO NOT EDIT ******************************************************************************/ #ifndef _MIMGCBIF_H_ #define _MIMGCBIF_H_ +#include "jmc.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "jmc.h" - /******************************************************************************* * IMGCBIF ******************************************************************************/ @@ -46,7 +30,7 @@ typedef struct IMGCBIF { #ifndef JMC_INIT_IMGCBIF_ID extern EXTERN_C_WITHOUT_EXTERN const JMCInterfaceID IMGCBIF_ID; #else -EXTERN_C const JMCInterfaceID IMGCBIF_ID = { 0x38775d44, 0x23525963, 0x7f763562, 0x625c5b2a }; +EXTERN_C const JMCInterfaceID IMGCBIF_ID = { 0x38775d44, 0x23525963, 0x7f76557d, 0x4b0a5b2a }; #endif /* JMC_INIT_IMGCBIF_ID */ /******************************************************************************* * IMGCBIF Operations @@ -181,15 +165,19 @@ typedef struct IMGCBIFImplHeader { * given a pointer to one of its interfaces. ******************************************************************************/ +#undef IMGCBIFImpl2Object #define IMGCBIFImpl2Object(IMGCBIFImplPtr) \ ((Object*)((char*)(IMGCBIFImplPtr) + offsetof(IMGCBIFImplHeader, vtableIMGCBIF))) +#undef Object2IMGCBIFImpl #define Object2IMGCBIFImpl(ObjectPtr) \ ((IMGCBIFImpl*)((char*)(ObjectPtr) - offsetof(IMGCBIFImplHeader, vtableIMGCBIF))) +#undef IMGCBIFImpl2IMGCBIF #define IMGCBIFImpl2IMGCBIF(IMGCBIFImplPtr) \ ((IMGCBIF*)((char*)(IMGCBIFImplPtr) + offsetof(IMGCBIFImplHeader, vtableIMGCBIF))) +#undef IMGCBIF2IMGCBIFImpl #define IMGCBIF2IMGCBIFImpl(IMGCBIFPtr) \ ((IMGCBIFImpl*)((char*)(IMGCBIFPtr) - offsetof(IMGCBIFImplHeader, vtableIMGCBIF))) diff --git a/mozilla/modules/libimg/public/MPSIMGCB.h b/mozilla/modules/libimg/public/MPSIMGCB.h index 98b2426a648..da43547a3ba 100644 --- a/mozilla/modules/libimg/public/MPSIMGCB.h +++ b/mozilla/modules/libimg/public/MPSIMGCB.h @@ -1,35 +1,19 @@ -/* -*- 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. - */ - +/* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* - * Source date: 22 Feb 1997 07:07:50 GMT + * Source date: 3 Jun 1998 00:22:02 GMT * netscape/libimg/PSIMGCB module C header file + * Generated by jmc version 1.8 -- DO NOT EDIT ******************************************************************************/ #ifndef _MPSIMGCB_H_ #define _MPSIMGCB_H_ +#include "jmc.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "jmc.h" - /******************************************************************************* * PSIMGCB ******************************************************************************/ @@ -46,7 +30,7 @@ typedef struct PSIMGCB { #ifndef JMC_INIT_PSIMGCB_ID extern EXTERN_C_WITHOUT_EXTERN const JMCInterfaceID PSIMGCB_ID; #else -EXTERN_C const JMCInterfaceID PSIMGCB_ID = { 0x38775d44, 0x23525963, 0x7f763562, 0x625c5b2a }; +EXTERN_C const JMCInterfaceID PSIMGCB_ID = { 0x38775d44, 0x23525963, 0x7f76557d, 0x4b0a5b2a }; #endif /* JMC_INIT_PSIMGCB_ID */ /******************************************************************************* * PSIMGCB Operations @@ -181,15 +165,19 @@ typedef struct PSIMGCBImplHeader { * given a pointer to one of its interfaces. ******************************************************************************/ +#undef PSIMGCBImpl2IMGCBIF #define PSIMGCBImpl2IMGCBIF(PSIMGCBImplPtr) \ ((IMGCBIF*)((char*)(PSIMGCBImplPtr) + offsetof(PSIMGCBImplHeader, vtablePSIMGCB))) +#undef IMGCBIF2PSIMGCBImpl #define IMGCBIF2PSIMGCBImpl(IMGCBIFPtr) \ ((PSIMGCBImpl*)((char*)(IMGCBIFPtr) - offsetof(PSIMGCBImplHeader, vtablePSIMGCB))) +#undef PSIMGCBImpl2PSIMGCB #define PSIMGCBImpl2PSIMGCB(PSIMGCBImplPtr) \ ((PSIMGCB*)((char*)(PSIMGCBImplPtr) + offsetof(PSIMGCBImplHeader, vtablePSIMGCB))) +#undef PSIMGCB2PSIMGCBImpl #define PSIMGCB2PSIMGCBImpl(PSIMGCBPtr) \ ((PSIMGCBImpl*)((char*)(PSIMGCBPtr) - offsetof(PSIMGCBImplHeader, vtablePSIMGCB))) diff --git a/mozilla/modules/libimg/src/MIMGCB.c b/mozilla/modules/libimg/src/MIMGCB.c index f936853686c..4ccc125d5b2 100644 --- a/mozilla/modules/libimg/src/MIMGCB.c +++ b/mozilla/modules/libimg/src/MIMGCB.c @@ -1,24 +1,8 @@ -/* -*- 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. - */ - +/* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* - * Source date: 16 Jan 1997 01:24:04 GMT + * Source date: 3 Jun 1998 00:22:02 GMT * netscape/libimg/IMGCB module C stub file + * Generated by jmc version 1.8 -- DO NOT EDIT ******************************************************************************/ #include diff --git a/mozilla/modules/libimg/src/MPSIMGCB.c b/mozilla/modules/libimg/src/MPSIMGCB.c index 1626c34f07b..cdd18d854f7 100644 --- a/mozilla/modules/libimg/src/MPSIMGCB.c +++ b/mozilla/modules/libimg/src/MPSIMGCB.c @@ -1,23 +1,6 @@ -/* -*- 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. - */ - +/* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* - * Source date: 22 Feb 1997 07:07:50 GMT + * Source date: 3 Jun 1998 00:22:02 GMT * netscape/libimg/PSIMGCB module C stub file * Generated by jmc version 1.8 -- DO NOT EDIT ******************************************************************************/ diff --git a/mozilla/modules/makefile.win b/mozilla/modules/makefile.win index 362ebeb48b6..3eed4e551eb 100644 --- a/mozilla/modules/makefile.win +++ b/mozilla/modules/makefile.win @@ -30,6 +30,7 @@ DEPTH=.. ## Include support for MOZ_LITE/MOZ_MEDIUM +include <$(DEPTH)/config/config.mak> include <$(DEPTH)/config/liteness.mak> #//------------------------------------------------------------------------ @@ -50,7 +51,7 @@ DIRS= \ libimg \ libfont \ libreg \ -!ifdef MOZ_JAVA +!ifdef JAVA_OR_OJI !ifdef EDITOR edtplug \ !endif @@ -61,7 +62,7 @@ DIRS= \ !if ("$(MOZ_BITS)" == "16") libmem \ !endif - coreincl \ + coreincl \ !ifdef MOZ_LOC_INDEP li \ !endif @@ -70,7 +71,8 @@ DIRS= \ !endif rdf \ schedulr \ - xml + xml \ + oji #//------------------------------------------------------------------------ #// diff --git a/mozilla/modules/oji/Makefile b/mozilla/modules/oji/Makefile index e69de29bb2d..18922fc7631 100644 --- a/mozilla/modules/oji/Makefile +++ b/mozilla/modules/oji/Makefile @@ -0,0 +1,31 @@ +#//------------------------------------------------------------------------ +#// +#// Makefile to build the MODULES/OJI tree +#// +#//------------------------------------------------------------------------ + +#//------------------------------------------------------------------------ +#// +#// Specify the depth of the current directory relative to the +#// root of NS +#// +#//------------------------------------------------------------------------ +NS_DEPTH=../.. + +#//------------------------------------------------------------------------ +#// +#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...) +#// (these must come before the common makefiles are included) +#// +#// DIRS - There are subdirectories to process +#// +#//------------------------------------------------------------------------ +DIRS= src + +#//------------------------------------------------------------------------ +#// +#// Include the common makefile rules +#// +#//------------------------------------------------------------------------ +include $(NS_DEPTH)/config/rules.mk + diff --git a/mozilla/modules/oji/makefile.win b/mozilla/modules/oji/makefile.win index e69de29bb2d..75c6c7f488f 100644 --- a/mozilla/modules/oji/makefile.win +++ b/mozilla/modules/oji/makefile.win @@ -0,0 +1,30 @@ +#//------------------------------------------------------------------------ +#// +#// Makefile to build the MODULES\APPLET tree +#// +#//------------------------------------------------------------------------ + +#//------------------------------------------------------------------------ +#// +#// Specify the depth of the current directory relative to the +#// root of NS +#// +#//------------------------------------------------------------------------ +DEPTH=..\.. + +#//------------------------------------------------------------------------ +#// +#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...) +#// (these must come before the common makefiles are included) +#// +#// DIRS - There are subdirectories to process +#// +#//------------------------------------------------------------------------ +DIRS= src + +#//------------------------------------------------------------------------ +#// +#// Include the common makefile rules +#// +#//------------------------------------------------------------------------ +include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/modules/oji/src/Makefile b/mozilla/modules/oji/src/Makefile index 139597f9cb0..540164cb29d 100644 --- a/mozilla/modules/oji/src/Makefile +++ b/mozilla/modules/oji/src/Makefile @@ -1,2 +1,24 @@ +#//------------------------------------------------------------------------ +#// +#// Makefile to build OJI +#// +#//------------------------------------------------------------------------ +NS_DEPTH = ../../.. + +MODULE = oji + +ifdef MOZ_OJI +LIBRARY_NAME = oji + +CPPSRCS = jvmmgr.cpp \ + jvmpeer.cpp \ + scd.cpp + +REQUIRES = img java js lay layer plug pref style util xpcom +endif # MOZ_OJI + +EXPORTS = nsjvm.h jvmmgr.h nsscd.h + +include $(NS_DEPTH)/config/rules.mk diff --git a/mozilla/modules/oji/src/jvmmgr.cpp b/mozilla/modules/oji/src/jvmmgr.cpp index 139597f9cb0..99dcb2e1530 100644 --- a/mozilla/modules/oji/src/jvmmgr.cpp +++ b/mozilla/modules/oji/src/jvmmgr.cpp @@ -1,2 +1,499 @@ +/* -*- 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. + */ +//////////////////////////////////////////////////////////////////////////////// +// Plugin Manager Methods to support the JVM Plugin API +//////////////////////////////////////////////////////////////////////////////// + +#include "jvmmgr.h" +#include "xp.h" +#include "net.h" +#include "prefapi.h" +#include "xp_str.h" +#include "libmocha.h" +#include "np.h" + +#include "xpgetstr.h" +extern "C" int XP_PROGRESS_STARTING_JAVA; +extern "C" int XP_PROGRESS_STARTING_JAVA_DONE; +extern "C" int XP_JAVA_NO_CLASSES; +extern "C" int XP_JAVA_WRONG_CLASSES; +extern "C" int XP_JAVA_STARTUP_FAILED; +extern "C" int XP_JAVA_DEBUGGER_FAILED; + +// FIXME -- need prototypes for these functions!!! XXX +#ifdef XP_MAC +extern "C" { +OSErr ConvertUnixPathToMacPath(const char *, char **); +void startAsyncCursors(void); +void stopAsyncCursors(void); +} +#endif // XP_MAC + +//////////////////////////////////////////////////////////////////////////////// + +NS_IMPL_AGGREGATED(JVMMgr); + +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +static NS_DEFINE_IID(kIJVMPluginManagerIID, NP_IJVMPLUGINMANAGER_IID); +static NS_DEFINE_IID(kIJVMPluginIID, NP_IJVMPLUGIN_IID); +static NS_DEFINE_IID(kISymantecDebugManagerIID, NP_ISYMANTECDEBUGMANAGER_IID); + +NS_METHOD +JVMMgr::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr) +{ + if (outer && !aIID.Equals(kISupportsIID)) + return NS_NOINTERFACE; // XXX right error? + JVMMgr* jvmMgr = new JVMMgr(outer); + nsresult result = jvmMgr->QueryInterface(aIID, aInstancePtr); + if (result != NS_OK) { + delete jvmMgr; + } + return result; +} + +NPIJVMPlugin* +JVMMgr::GetJVM(void) +{ + if (fJVM) { + fJVM->AddRef(); + return fJVM; + } + NPIPlugin* plugin = NPL_LoadPluginByType(NPJVM_MIME_TYPE); + if (plugin) { + nsresult rslt = plugin->QueryInterface(kIJVMPluginIID, (void**)&fJVM); + if (rslt == NS_OK) return fJVM; + } + return NULL; +} + +JVMMgr::JVMMgr(nsISupports* outer) + : fJVM(NULL), fWaiting(0), fOldCursor(NULL), fProgramPath(NULL) +{ + NS_INIT_AGGREGATED(outer); +} + +JVMMgr::~JVMMgr() +{ + if (fJVM) { + nsrefcnt c = fJVM->Release(); // Release for QueryInterface in GetJVM + // XXX unload plugin if c == 1 ? (should this be done inside Release?) + } +} + +NS_METHOD +JVMMgr::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + if (aIID.Equals(kIJVMPluginManagerIID)) { + *aInstancePtr = this; + AddRef(); + return NS_OK; + } +#ifdef XP_PC + // Aggregates... + if (fDebugManager == NULL) { + nsresult rslt = + nsSymantecDebugManager::Create(this, kISupportsIID, + (void**)&fDebugManager, this); + if (rslt != NS_OK) return rslt; + } + return fDebugManager->QueryInterface(aIID, aInstancePtr); +#else + return NS_NOINTERFACE; +#endif +} + +//////////////////////////////////////////////////////////////////////////////// + +NS_METHOD_(void) +JVMMgr::BeginWaitCursor(void) +{ + if (fWaiting == 0) { +#ifdef XP_PC + fOldCursor = (void*)GetCursor(); + HCURSOR newCursor = LoadCursor(NULL, IDC_WAIT); + if (newCursor) + SetCursor(newCursor); +#endif +#ifdef XP_MAC + startAsyncCursors(); +#endif + } + fWaiting++; +} + +NS_METHOD_(void) +JVMMgr::EndWaitCursor(void) +{ + fWaiting--; + if (fWaiting == 0) { +#ifdef XP_PC + if (fOldCursor) + SetCursor((HCURSOR)fOldCursor); +#endif +#ifdef XP_MAC + stopAsyncCursors(); +#endif + fOldCursor = NULL; + } +} + +//////////////////////////////////////////////////////////////////////////////// + +NS_METHOD_(const char*) +JVMMgr::GetProgramPath(void) +{ + return fProgramPath; +} + +NS_METHOD_(const char*) +JVMMgr::GetTempDirPath(void) +{ + // XXX I don't need a static really, the browser holds the tempDir name + // as a static string -- it's just the XP_TempDirName that strdups it. + static const char* tempDirName = NULL; + if (tempDirName == NULL) + tempDirName = XP_TempDirName(); + return tempDirName; +} + +NS_METHOD +JVMMgr::GetFileName(const char* fn, FileNameType type, + char* resultBuf, PRUint32 bufLen) +{ + // XXX This should be rewritten so that we don't have to malloc the name. + XP_FileType filetype; + + if (type == SIGNED_APPLET_DBNAME) + filetype = xpSignedAppletDB; + else if (type == TEMP_FILENAME) + filetype = xpTemporary; + else + return NS_ERROR_ILLEGAL_VALUE; + + char* tempName = WH_FileName(fn, filetype); + if (tempName == NULL) + return NS_ERROR_OUT_OF_MEMORY; + XP_STRNCPY_SAFE(resultBuf, tempName, bufLen); + XP_FREE(tempName); + return NS_OK; +} + +NS_METHOD +JVMMgr::NewTempFileName(const char* prefix, char* resultBuf, PRUint32 bufLen) +{ + // XXX This should be rewritten so that we don't have to malloc the name. + char* tempName = WH_TempName(xpTemporary, prefix); + if (tempName == NULL) + return NS_ERROR_OUT_OF_MEMORY; + XP_STRNCPY_SAFE(resultBuf, tempName, bufLen); + XP_FREE(tempName); + return NS_OK; +} + +NS_METHOD_(PRBool) +JVMMgr::HandOffJSLock(PRThread* oldOwner, PRThread* newOwner) +{ + return LM_HandOffJSLock(oldOwner, newOwner); +} + +//////////////////////////////////////////////////////////////////////////////// + +// Should be in a header; must solve build-order problem first +extern "C" void VR_Initialize(JRIEnv* env); +extern "C" void SU_Initialize(JRIEnv * env); + +JVMStatus +JVMMgr::StartupJVM(void) +{ + // Be sure to check the prefs first before asking java to startup. + if (GetJVMStatus() == JVMStatus_Disabled) { + return JVMStatus_Disabled; + } + JVMStatus status = fJVM->StartupJVM(); + if (status == JVMStatus_Running) { + JVMEnv* env = fJVM->EnsureExecEnv(); + + /* initialize VersionRegistry native routines */ + /* it is not an error that prevents java from starting if this stuff throws exceptions */ +#ifdef XP_MAC + if (env->ExceptionOccurred()) { +#ifdef DEBUG + env->ExceptionDescribe(); +#endif + env->ExceptionClear(); + return ShutdownJVM(); + } +#else + VR_Initialize(env); + if (JRI_ExceptionOccurred(env)) { +#ifdef DEBUG + fJVM->PrintToConsole("LJ: VR_Initialize failed. Bugs to dveditz.\n"); + JRI_ExceptionDescribe(env); +#endif + JRI_ExceptionClear(env); + return ShutdownJVM(); + } + + SU_Initialize(env); + if (JRI_ExceptionOccurred(env)) { +#ifdef DEBUG + fJVM->PrintToConsole("LJ: SU_Initialize failed. Bugs to atotic.\n"); + JRI_ExceptionDescribe(env); +#endif + JRI_ExceptionClear(env); + return ShutdownJVM(); + } +#endif /* !XP_MAC */ + } + return status; +} + +JVMStatus +JVMMgr::ShutdownJVM(PRBool fullShutdown) +{ + if (fJVM) + return fJVM->ShutdownJVM(); + return JVMStatus_Enabled; // XXX what if there's no plugin available? +} + +//////////////////////////////////////////////////////////////////////////////// + +static int PR_CALLBACK +JavaPrefChanged(const char *prefStr, void* data) +{ + JVMMgr* mgr = (JVMMgr*)data; + XP_Bool prefBool; + PREF_GetBoolPref(prefStr, &prefBool); + mgr->SetJVMEnabled((PRBool)prefBool); + return 0; +} + +void +JVMMgr::EnsurePrefCallbackRegistered(void) +{ + if (fRegisteredJavaPrefChanged != PR_TRUE) { + fRegisteredJavaPrefChanged = PR_TRUE; + PREF_RegisterCallback("security.enable_java", JavaPrefChanged, this); + JavaPrefChanged("security.enable_java", this); + } +} + +PRBool +JVMMgr::GetJVMEnabled(void) +{ + EnsurePrefCallbackRegistered(); + return fJVM->GetJVMEnabled(); +} + +void +JVMMgr::SetJVMEnabled(PRBool enable) +{ + fJVM->SetJVMEnabled(enable); +} + +JVMStatus +JVMMgr::GetJVMStatus(void) +{ + EnsurePrefCallbackRegistered(); + return fJVM->GetJVMStatus(); +} + +//////////////////////////////////////////////////////////////////////////////// + +static const char* +ConvertToPlatformPathList(const char* cp) +{ + const char* c = strdup(cp); + if (c == NULL) + return NULL; +#ifdef XP_MAC + { + const char* path; + const char* strtok_path; + + char* result = (char*) malloc(1); + if (result == NULL) + return NULL; + result[0] = '\0'; + path = c; + strtok_path = path; +#ifndef NSPR20 + while ((path = XP_STRTOK(strtok_path, PATH_SEPARATOR_STR))) +#else + while ((path = XP_STRTOK(strtok_path, PR_PATH_SEPARATOR_STR))) +#endif + { + const char* macPath; + OSErr err = ConvertUnixPathToMacPath(path, &macPath); + char* r = PR_smprintf("%s\r%s", result, macPath); + + strtok_path = NULL; + + if (r == NULL) + return result; /* return what we could come up with */ + free(result); + result = r; + } + free(c); + return result; + } +#else + return c; +#endif +} + +NS_METHOD_(void) +JVMMgr::ReportJVMError(JVMEnv* env, JVMError err) +{ + MWContext* cx = XP_FindSomeContext(); + char *s; + switch (err) { + case JVMError_NoClasses: { + const char* cp = fJVM->GetClassPath(); + const char* jarName = fJVM->GetSystemJARPath(); + cp = ConvertToPlatformPathList(cp); + s = PR_smprintf(XP_GetString(XP_JAVA_NO_CLASSES), + jarName, jarName, + (cp ? cp : "")); + free((void*)cp); + break; + } + + case JVMError_JavaError: { + const char* msg = GetJavaErrorString(env); +#ifdef DEBUG +# ifdef XP_MAC + env->ExceptionDescribe(); +# else + JRI_ExceptionDescribe(env); +# endif +#endif + s = PR_smprintf(XP_GetString(XP_JAVA_STARTUP_FAILED), + (msg ? msg : "")); + if (msg) free((void*)msg); + break; + } + case JVMError_NoDebugger: { + s = PR_smprintf(XP_GetString(XP_JAVA_DEBUGGER_FAILED)); + break; + } + default: + return; /* don't report anything */ + } + if (s) { + FE_Alert(cx, s); + free(s); + } +} + +/* stolen from java_lang_Object.h (jri version) */ +#define classname_java_lang_Object "java/lang/Object" +#define name_java_lang_Object_toString "toString" +#define sig_java_lang_Object_toString "()Ljava/lang/String;" + +const char* +JVMMgr::GetJavaErrorString(JVMEnv* env) +{ + /* XXX javah is a pain wrt mixing JRI and JDK native methods. + Since we need to call a method on Object, we'll do it the hard way + to avoid using javah for this. + Maybe we need a new JRI entry point for toString. Yikes! */ + +#ifdef XP_MAC + jthrowable exc = env->ExceptionOccurred(); + if (exc == NULL) { + return strdup(""); /* XXX better "no error" message? */ + } + + /* Got to do this before trying to find a class (like Object). + This is because the runtime refuses to do this with a pending + exception! I think it's broken. */ + + env->ExceptionClear(); + + jclass classObject = env->FindClass(classname_java_lang_Object); + jmethodID toString = env->GetMethodID(classObject, name_java_lang_Object_toString, sig_java_lang_Object_toString); + jstring excString = (jstring) env->CallObjectMethod(exc, toString); + + jboolean isCopy; + const char* msg = env->GetStringUTFChars(excString, &isCopy); + if (msg != NULL) { + const char* dupmsg = (msg == NULL ? NULL : strdup(msg)); + env->ReleaseStringUTFChars(excString, msg); + msg = dupmsg; + } + return msg; +#else + const char* msg; + struct java_lang_Class* classObject; + JRIMethodID toString; + struct java_lang_String* excString; + struct java_lang_Throwable* exc = JRI_ExceptionOccurred(env); + + if (exc == NULL) { + return strdup(""); /* XXX better "no error" message? */ + } + + /* Got to do this before trying to find a class (like Object). + This is because the runtime refuses to do this with a pending + exception! I think it's broken. */ + + JRI_ExceptionClear(env); + + classObject = (struct java_lang_Class*) + JRI_FindClass(env, classname_java_lang_Object); + toString = JRI_GetMethodID(env, classObject, + name_java_lang_Object_toString, + sig_java_lang_Object_toString); + excString = (struct java_lang_String *) + JRI_CallMethod(env)(env, JRI_CallMethod_op, + (struct java_lang_Object*)exc, toString); + + /* XXX change to JRI_GetStringPlatformChars */ + msg = JRI_GetStringPlatformChars(env, excString, NULL, 0); + if (msg == NULL) return NULL; + return strdup(msg); +#endif +} + +NS_METHOD_(PRBool) +JVMMgr::SupportsURLProtocol(const char* protocol) +{ + int type = NET_URL_Type(protocol); + return (PRBool)(type != 0); +} + +//////////////////////////////////////////////////////////////////////////////// + +extern "C" PR_IMPLEMENT(JVMMgr*) +JVM_GetJVMMgr(void) +{ + extern nsISupports* thePluginManager; + if (thePluginManager == NULL) + return NULL; + JVMMgr* mgr; + nsresult res = + thePluginManager->QueryInterface(kIJVMPluginManagerIID, (void**)&mgr); + if (res != NS_OK) + return NULL; + return mgr; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/modules/oji/src/jvmmgr.h b/mozilla/modules/oji/src/jvmmgr.h index 139597f9cb0..e8ecb15e72d 100644 --- a/mozilla/modules/oji/src/jvmmgr.h +++ b/mozilla/modules/oji/src/jvmmgr.h @@ -1,2 +1,352 @@ +/* -*- 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. + */ +#ifndef jvmmgr_h___ +#define jvmmgr_h___ +#include "nsjvm.h" +#include "nsscd.h" +#include "nsAgg.h" + +class nsSymantecDebugManager; + +//////////////////////////////////////////////////////////////////////////////// +// 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. + +class JVMMgr : public NPIJVMPluginManager { +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); + + //////////////////////////////////////////////////////////////////////////// + // JVMMgr specific methods: + + // ====> From here on are things only called by the browser, not the plugin... + + static NS_METHOD + Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr); + + NPIJVMPlugin* GetJVM(void); + + // Unlike the NPIJVMPlugin::StartupJVM, this version handles putting + // up any error dialog: + JVMStatus StartupJVM(void); + JVMStatus ShutdownJVM(PRBool fullShutdown = PR_TRUE); + + PRBool GetJVMEnabled(void); + void SetJVMEnabled(PRBool enable); + JVMStatus GetJVMStatus(void); + + void SetProgramPath(const char* path) { fProgramPath = path; } + +protected: + JVMMgr(nsISupports* outer); + virtual ~JVMMgr(void); + + void EnsurePrefCallbackRegistered(void); + const char* GetJavaErrorString(JVMEnv* env); + + NPIJVMPlugin* fJVM; + PRUint16 fWaiting; + void* fOldCursor; + const char* fProgramPath; + PRBool fRegisteredJavaPrefChanged; + nsISupports* fDebugManager; + +}; + +//////////////////////////////////////////////////////////////////////////////// +// Symantec Debugger Stuff + +class nsSymantecDebugManager : public NPISymantecDebugManager { +public: + + NS_DECL_AGGREGATED + + NS_IMETHOD_(PRBool) + SetDebugAgentPassword(PRInt32 pwd); + + static NS_METHOD + Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr, + JVMMgr* jvmMgr); + +protected: + nsSymantecDebugManager(nsISupports* outer, JVMMgr* jvmMgr); + virtual ~nsSymantecDebugManager(void); + + JVMMgr* fJVMMgr; + +}; + +//////////////////////////////////////////////////////////////////////////////// +// JVMInstancePeer: The browser makes one of these when it sees an APPLET or +// appropriate OBJECT tag. + +class JVMInstancePeer : public NPIJVMPluginInstancePeer { +public: + + NS_DECL_AGGREGATED + + //////////////////////////////////////////////////////////////////////////// + // Methods specific to NPIPluginInstancePeer: + + // ====> These are usually only called by the plugin, not the browser... + + NS_IMETHOD_(NPIPlugin*) + GetClass(void); + + // (Corresponds to NPP_New's MIMEType argument.) + NS_IMETHOD_(nsMIMEType) + GetMIMEType(void); + + // (Corresponds to NPP_New's mode argument.) + NS_IMETHOD_(NPPluginType) + GetMode(void); + + // 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); + + // 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); + + //////////////////////////////////////////////////////////////////////////// + // 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: + + // ====> 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); + +protected: + + JVMInstancePeer(nsISupports* outer, MWContext* cx, LO_CommonPluginStruct* lo); + virtual ~JVMInstancePeer(void); + + // Instance Variables: + NPIPluginInstancePeer* fPluginInstancePeer; + MWContext* fContext; + LO_CommonPluginStruct* fLayoutElement; + PRUint32 fUniqueID; + +}; + +//////////////////////////////////////////////////////////////////////////////// + +// Returns the JVM manager. You must do a Release on the +// pointer returned when you're done with it. +extern "C" PR_EXTERN(JVMMgr*) +JVM_GetJVMMgr(void); + +//////////////////////////////////////////////////////////////////////////////// +#endif /* jvmmgr_h___ */ diff --git a/mozilla/modules/oji/src/jvmpeer.cpp b/mozilla/modules/oji/src/jvmpeer.cpp index 139597f9cb0..77f175c1d83 100644 --- a/mozilla/modules/oji/src/jvmpeer.cpp +++ b/mozilla/modules/oji/src/jvmpeer.cpp @@ -1,2 +1,357 @@ +/* -*- Mode: C++; tb-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. + */ +//////////////////////////////////////////////////////////////////////////////// +// Plugin Manager Methods to support the JVM Plugin API +//////////////////////////////////////////////////////////////////////////////// + +#include "lo_ele.h" +#include "layout.h" +#include "shist.h" +#include "jvmmgr.h" + +JVMInstancePeer::JVMInstancePeer(nsISupports* outer, + MWContext* cx, LO_CommonPluginStruct* lo) + : fContext(cx), fLayoutElement(lo), fUniqueID(0) +{ + NS_INIT_AGGREGATED(outer); +} + +JVMInstancePeer::~JVMInstancePeer(void) +{ +} + +NS_IMPL_AGGREGATED(JVMInstancePeer); + +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +static NS_DEFINE_IID(kIJVMPluginInstancePeerIID, NP_IJVMPLUGININSTANCEPEER_IID); +static NS_DEFINE_IID(kIPluginInstancePeerIID, NP_IPLUGININSTANCEPEER_IID); + +NS_METHOD +JVMInstancePeer::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + if (aIID.Equals(kIJVMPluginInstancePeerIID) || + aIID.Equals(kIPluginInstancePeerIID) || + aIID.Equals(kISupportsIID)) { + *aInstancePtr = this; + AddRef(); + return NS_OK; + } + return NS_NOINTERFACE; +} + +NS_METHOD +JVMInstancePeer::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr, + MWContext* cx, LO_CommonPluginStruct* lo) +{ + if (outer && !aIID.Equals(kISupportsIID)) + return NS_NOINTERFACE; // XXX right error? + + JVMInstancePeer* jvmInstPeer = new JVMInstancePeer(outer, cx, lo); + if (jvmInstPeer == NULL) + return NS_ERROR_OUT_OF_MEMORY; + nsresult result = jvmInstPeer->QueryInterface(aIID, aInstancePtr); + if (result != NS_OK) goto error; + + result = outer->QueryInterface(kIPluginInstancePeerIID, + (void**)&jvmInstPeer->fPluginInstancePeer); + if (result != NS_OK) goto error; + outer->Release(); // no need to AddRef outer + return result; + + error: + delete jvmInstPeer; + return result; +} + +//////////////////////////////////////////////////////////////////////////////// +// Delegated methods: + +NS_METHOD_(NPIPlugin*) +JVMInstancePeer::GetClass(void) +{ + return fPluginInstancePeer->GetClass(); +} + +NS_METHOD_(nsMIMEType) +JVMInstancePeer::GetMIMEType(void) +{ + return fPluginInstancePeer->GetMIMEType(); +} + +NS_METHOD_(NPPluginType) +JVMInstancePeer::GetMode(void) +{ + return fPluginInstancePeer->GetMode(); +} + +NS_METHOD_(NPPluginError) +JVMInstancePeer::GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values) +{ + return fPluginInstancePeer->GetAttributes(n, names, values); +} + +NS_METHOD_(const char*) +JVMInstancePeer::GetAttribute(const char* name) +{ + return fPluginInstancePeer->GetAttribute( name ); +} + +NS_METHOD_(NPPluginError) +JVMInstancePeer::GetParameters(PRUint16& n, const char*const*& names, const char*const*& values) +{ + return fPluginInstancePeer->GetParameters(n, names, values); +} + +NS_METHOD_(const char*) +JVMInstancePeer::GetParameter(const char* name) +{ + return fPluginInstancePeer->GetParameter( name ); +} + +NS_METHOD_(NPTagType) +JVMInstancePeer::GetTagType(void) +{ + return fPluginInstancePeer->GetTagType(); +} + +NS_METHOD_(const char *) +JVMInstancePeer::GetTagText(void) +{ + return fPluginInstancePeer->GetTagText(); +} + +NS_METHOD_(NPIPluginManager*) +JVMInstancePeer::GetPluginManager(void) +{ + return fPluginInstancePeer->GetPluginManager(); +} + +NS_METHOD_(NPPluginError) +JVMInstancePeer::GetURL(const char* url, const char* target, void* notifyData, + const char* altHost, const char* referrer, + PRBool forceJSEnabled) +{ + return fPluginInstancePeer->GetURL(url, target, notifyData, altHost, referrer, forceJSEnabled); +} + +NS_METHOD_(NPPluginError) +JVMInstancePeer::PostURL(const char* url, const char* target, PRUint32 bufLen, + const char* buf, PRBool file, void* notifyData, + const char* altHost, const char* referrer, + PRBool forceJSEnabled, + PRUint32 postHeadersLength, const char* postHeaders) +{ + return fPluginInstancePeer->PostURL(url, target, + bufLen, buf, file, notifyData, + altHost, referrer, forceJSEnabled, + postHeadersLength, postHeaders); +} + +NS_METHOD_(NPPluginError) +JVMInstancePeer::NewStream(nsMIMEType type, const char* target, + NPIPluginManagerStream* *result) +{ + return fPluginInstancePeer->NewStream(type, target, result); +} + +NS_METHOD_(void) +JVMInstancePeer::ShowStatus(const char* message) +{ + fPluginInstancePeer->ShowStatus(message); +} + +NS_METHOD_(const char*) +JVMInstancePeer::UserAgent(void) +{ + return fPluginInstancePeer->UserAgent(); +} + +NS_METHOD_(NPPluginError) +JVMInstancePeer::GetValue(NPPluginManagerVariable variable, void *value) +{ + return fPluginInstancePeer->GetValue(variable, value); +} + +NS_METHOD_(NPPluginError) +JVMInstancePeer::SetValue(NPPluginVariable variable, void *value) +{ + return fPluginInstancePeer->SetValue(variable, value); +} + +NS_METHOD_(void) +JVMInstancePeer::InvalidateRect(nsRect *invalidRect) +{ + fPluginInstancePeer->InvalidateRect(invalidRect); +} + +NS_METHOD_(void) +JVMInstancePeer::InvalidateRegion(nsRegion invalidRegion) +{ + fPluginInstancePeer->InvalidateRegion(invalidRegion); +} + +NS_METHOD_(void) +JVMInstancePeer::ForceRedraw(void) +{ + fPluginInstancePeer->ForceRedraw(); +} + +NS_METHOD_(void) +JVMInstancePeer::RegisterWindow(void* window) +{ + fPluginInstancePeer->RegisterWindow(window); +} + +NS_METHOD_(void) +JVMInstancePeer::UnregisterWindow(void* window) +{ + fPluginInstancePeer->UnregisterWindow(window); +} + +NS_METHOD_(PRInt16) +JVMInstancePeer::AllocateMenuID(PRBool isSubmenu) +{ + return fPluginInstancePeer->AllocateMenuID(isSubmenu); +} + +//////////////////////////////////////////////////////////////////////////////// +// Non-delegated methods: + +NS_METHOD_(PRUint32) +JVMInstancePeer::GetDocumentID(void) +{ + if (fUniqueID == 0) { + History_entry* history_element = SHIST_GetCurrent(&fContext->hist); + if (history_element) { + fUniqueID = history_element->unique_id; + } else { + /* + ** XXX What to do? This can happen for instance when printing a + ** mail message that contains an applet. + */ + static int32 unique_number; + fUniqueID = --unique_number; + } + PR_ASSERT(fUniqueID != 0); + } + return fUniqueID; +} + +NS_METHOD_(const char *) +JVMInstancePeer::GetID(void) +{ + switch (fLayoutElement->type) { + case LO_JAVA: + return GetAttribute("name"); + default: + return GetAttribute("id"); + } +} + +NS_METHOD_(const char *) +JVMInstancePeer::GetCode(void) +{ + return fPluginInstancePeer->GetAttribute("code"); +} + +NS_METHOD_(const char *) +JVMInstancePeer::GetCodeBase() +{ + return fPluginInstancePeer->GetAttribute("codebase"); +} + +NS_METHOD_(const char *) +JVMInstancePeer::GetArchive() +{ + return fPluginInstancePeer->GetAttribute("archive"); +} + +NS_METHOD_(PRBool) +JVMInstancePeer::GetMayScript() +{ + return (fPluginInstancePeer->GetAttribute("mayscript") != NULL); +} + +NS_METHOD_(const char*) +JVMInstancePeer::GetDocumentBase(void) +{ + return (const char*)fLayoutElement->base_url; +} + +NS_METHOD_(INTL_CharSetInfo) +JVMInstancePeer::GetDocumentCharSetInfo(void) +{ + return LO_GetDocumentCharacterSetInfo(fContext); +} + +NS_METHOD_(const char*) +JVMInstancePeer::GetAlignment(void) +{ + int alignment = fLayoutElement->alignment; + + const char* cp; + switch (alignment) { + case LO_ALIGN_CENTER: cp = "abscenter"; break; + case LO_ALIGN_LEFT: cp = "left"; break; + case LO_ALIGN_RIGHT: cp = "right"; break; + case LO_ALIGN_TOP: cp = "texttop"; break; + case LO_ALIGN_BOTTOM: cp = "absbottom"; break; + case LO_ALIGN_NCSA_CENTER: cp = "center"; break; + case LO_ALIGN_NCSA_BOTTOM: cp = "bottom"; break; + case LO_ALIGN_NCSA_TOP: cp = "top"; break; + default: cp = "baseline"; break; + } + return cp; +} + +NS_METHOD_(PRUint32) +JVMInstancePeer::GetWidth(void) +{ + return fLayoutElement->width ? fLayoutElement->width : 50; +} + +NS_METHOD_(PRUint32) +JVMInstancePeer::GetHeight(void) +{ + return fLayoutElement->height ? fLayoutElement->height : 50; +} + +NS_METHOD_(PRUint32) +JVMInstancePeer::GetBorderVertSpace(void) +{ + return fLayoutElement->border_vert_space; +} + +NS_METHOD_(PRUint32) +JVMInstancePeer::GetBorderHorizSpace(void) +{ + return fLayoutElement->border_horiz_space; +} + +NS_METHOD_(PRBool) +JVMInstancePeer::Tickle(void) +{ +#ifdef XP_MAC + // XXX add something for the Mac... +#endif + return PR_TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/modules/oji/src/makefile.win b/mozilla/modules/oji/src/makefile.win index 139597f9cb0..5e444750112 100644 --- a/mozilla/modules/oji/src/makefile.win +++ b/mozilla/modules/oji/src/makefile.win @@ -1,2 +1,115 @@ +IGNORE_MANIFEST=1 +#//------------------------------------------------------------------------ +#// +#// Makefile to build +#// +#//------------------------------------------------------------------------ +#//------------------------------------------------------------------------ +#// +#// Specify the depth of the current directory relative to the +#// root of NS +#// +#//------------------------------------------------------------------------ +DEPTH= ..\..\.. + +!ifdef MOZ_OJI + +!ifndef MAKE_OBJ_TYPE +MAKE_OBJ_TYPE=EXE +!endif + +#//------------------------------------------------------------------------ +#// +#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...) +#// +#//------------------------------------------------------------------------ +LIBNAME=oji$(MOZ_BITS) +PDBFILE=$(LIBNAME).pdb + +#//------------------------------------------------------------------------ +#// +#// Define the files necessary to build the target (ie. OBJS) +#// +#//------------------------------------------------------------------------ + +OBJS = .\$(OBJDIR)\jvmmgr.obj \ + .\$(OBJDIR)\jvmpeer.obj \ + .\$(OBJDIR)\scd.obj + +#//------------------------------------------------------------------------ +#// +#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...) +#// (these must be defined before the common makefiles are included) +#// +#//------------------------------------------------------------------------ + +LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib + +#//------------------------------------------------------------------------ +#// +#// Define any local options for the make tools +#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS) +#// +#//------------------------------------------------------------------------ + +LINCS= $(LINCS) -I_jri -I$(DEPTH)/lib/plugin \ +# +# For Win16 the following include directories are copied into +# ns/dist/public/win16 +# +!if "$(MOZ_BITS)" == "32" + -I$(PUBLIC)/js \ + -I$(PUBLIC)/java \ + -I$(PUBLIC)/libimg \ + -I$(PUBLIC)/nspr \ + -I$(PUBLIC)/dbm \ + -I$(PUBLIC)/security \ + -I$(PUBLIC)/pref \ + -I$(PUBLIC)/xpcom \ +!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 + +EXPORTS = nsjvm.h jvmmgr.h nsscd.h + +#//------------------------------------------------------------------------ +#// +#// Include the common makefile rules +#// +#//------------------------------------------------------------------------ +include <$(DEPTH)/config/rules.mak> + +LCFLAGS=$(LCFLAGS) ^ + $(JAVA_DEFINES) + +!if "$(MOZ_BITS)" == "32" +PUBLIC_HEADER_DIR=$(PUBLIC)\oji +!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 +install:: $(LIBRARY) + $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib + +clobber:: + $(RM_R) _jri +!endif # MOZ_OJI diff --git a/mozilla/modules/oji/src/nsjvm.h b/mozilla/modules/oji/src/nsjvm.h index 139597f9cb0..e7841f6c67d 100644 --- a/mozilla/modules/oji/src/nsjvm.h +++ b/mozilla/modules/oji/src/nsjvm.h @@ -1,2 +1,274 @@ +/* -*- 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___ */ diff --git a/mozilla/modules/plugin/base/public/npapi.h b/mozilla/modules/plugin/base/public/npapi.h index 289346cb167..208b089cd7a 100644 --- a/mozilla/modules/plugin/base/public/npapi.h +++ b/mozilla/modules/plugin/base/public/npapi.h @@ -18,7 +18,7 @@ /* - * npapi.h $Revision: 3.1 $ + * npapi.h $Revision: 3.2 $ * Netscape client plug-in API spec */ @@ -274,7 +274,8 @@ typedef enum { NPPVpluginWindowBool, NPPVpluginTransparentBool, NPPVjavaClass, - NPPVpluginWindowSize + NPPVpluginWindowSize, + NPPVpluginTimerInterval } NPPVariable; /* diff --git a/mozilla/modules/rdf/src/ht.c b/mozilla/modules/rdf/src/ht.c index ede2811a87c..04c76078fe6 100644 --- a/mozilla/modules/rdf/src/ht.c +++ b/mozilla/modules/rdf/src/ht.c @@ -2544,7 +2544,7 @@ htIsMenuCmdEnabled(HT_Pane pane, HT_MenuCmd menuCmd, } else { - if ((node = HT_GetNextSelection(pane->selectedView, NULL)) == NULL) + if (pane->selectedView == NULL || (node = HT_GetNextSelection(pane->selectedView, NULL)) == NULL) { return(false); } diff --git a/mozilla/modules/softupdt/src/Makefile b/mozilla/modules/softupdt/src/Makefile index 074cf4d01fc..89130267c21 100644 --- a/mozilla/modules/softupdt/src/Makefile +++ b/mozilla/modules/softupdt/src/Makefile @@ -17,14 +17,23 @@ DEPTH = ../../.. +include $(DEPTH)/config/config.mk + MODULE = softupdate LIBRARY_NAME = softupdate REQUIRES = softupdt js java net dbm nspr img util layer pref \ - jar security applet lay style libreg network + jar security lay style libreg network + +ifeq ($(MOZ_OJI),1) +REQUIRES += oji npj +endif +ifeq ($(MOZ_JAVA),1) +REQUIRES += applet +endif JRI_GEN = netscape.softupdate.FolderSpec \ - netscape.softupdate.InstallObject \ + netscape.softupdate.InstallObject \ netscape.softupdate.InstallFile \ netscape.softupdate.InstallPatch \ netscape.softupdate.InstallExecute \ @@ -64,7 +73,7 @@ EXPORTS = ../include/softupdt.h \ $(JRI_GEN_DIR)/netscape_softupdate_SoftwareUpdate.h \ $(JRI_GEN_DIR)/netscape_softupdate_SoftUpdateException.h \ $(JRI_GEN_DIR)/netscape_softupdate_VersionInfo.h \ - $(JRI_GEN_DIR)/netscape_softupdate_VersionRegistry.h \ + $(JRI_GEN_DIR)/netscape_softupdate_VersionRegistry.h \ $(JRI_GEN_DIR)/netscape_softupdate_VerRegEnumerator.h \ $(JRI_GEN_DIR)/netscape_softupdate_Registry.h \ $(JRI_GEN_DIR)/netscape_softupdate_RegistryNode.h \ @@ -106,4 +115,3 @@ $(OBJDIR)/vr_java.o: $(JRI_GEN_DIR)/netscape_softupdate_VersionInfo.h \ $(JRI_GEN_DIR)/netscape_softupdate_RegistryException.h \ $(JRI_GEN_DIR)/netscape_softupdate_RegKeyEnumerator.h \ $(JRI_GEN_DIR)/netscape_softupdate_RegEntryEnumerator.h - diff --git a/mozilla/modules/softupdt/src/makefile.win b/mozilla/modules/softupdt/src/makefile.win index c188b78a582..ca0ebe42e07 100644 --- a/mozilla/modules/softupdt/src/makefile.win +++ b/mozilla/modules/softupdt/src/makefile.win @@ -125,7 +125,12 @@ LINCS= $(LINCS) -I_jri \ LINCS= $(LINCS) \ -I$(PUBLIC)/softupdt \ -I$(PUBLIC)/libreg \ +#if defined(MOZ_OJI) + -I$(PUBLIC)/oji \ + -I$(PUBLIC)/npj \ +#elseif defined(MOZ_JAVA) -I$(PUBLIC)/applet \ +#endif -I$(PUBLIC)/java \ -I$(PUBLIC)/nspr \ -I$(PUBLIC)/js \ @@ -136,10 +141,7 @@ LINCS= $(LINCS) \ -I$(PUBLIC)/jtools \ -I$(PUBLIC)/winfont \ -I$(PUBLIC)/rdf \ - -I$(PUBLIC)/java \ - -I$(PUBLIC)/applet \ -I$(PUBLIC)/network \ - -I$(PUBLIC)/rdf \ $(NULL) !endif @@ -191,7 +193,7 @@ clobber:: $(JRI_GEN_DIR)\netscape_softupdate_InstallPatch.c \ $(JRI_GEN_DIR)/netscape_softupdate_SoftwareUpdate.h \ $(JRI_GEN_DIR)/netscape_softupdate_SoftUpdateException.h \ - $(JRI_GEN_DIR)\netscape_softupdate_Strings.h + $(JRI_GEN_DIR)\netscape_softupdate_Strings.h .\$(OBJDIR)\su_trigger.obj: \ $(JRI_GEN_DIR)\netscape_softupdate_Trigger.c \ diff --git a/mozilla/modules/softupdt/src/su_trigger.c b/mozilla/modules/softupdt/src/su_trigger.c index 97c3730d5e2..41bf0ea806d 100644 --- a/mozilla/modules/softupdt/src/su_trigger.c +++ b/mozilla/modules/softupdt/src/su_trigger.c @@ -147,7 +147,11 @@ native_netscape_softupdate_SoftwareUpdate_VerifyJSObject(JRIEnv* env, */ JSObject * jsobj; JSClass * jsclass; +#ifdef OJI // XXX hack + jsobj = NULL; +#else jsobj = JSJ_ExtractInternalJSObject(env, (HObject*)a); +#endif jsclass = JS_GetClass(jsobj); if ( jsclass != &lm_softup_class ) { @@ -422,7 +426,11 @@ native_netscape_softupdate_SoftwareUpdate_getCertificates(JRIEnv* env, if (!pathname) return NULL; +#ifdef OJI // XXX hack + return NULL; +#else return LJ_GetCertificates(env, (void *)zigPtr, pathname); +#endif } #ifdef XP_MAC diff --git a/mozilla/nsprpub/config/UNIX.mk b/mozilla/nsprpub/config/UNIX.mk index ad45ddb144a..2e79655cb75 100644 --- a/mozilla/nsprpub/config/UNIX.mk +++ b/mozilla/nsprpub/config/UNIX.mk @@ -32,7 +32,7 @@ OBJDIR_TAG = _DBG endif # Name of the binary code directories -OBJDIR_NAME = $(OS_CONFIG)$(CPU_ARCH_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ +OBJDIR_NAME = SunOS5.5.1_sparc_DBG.OBJ MKDEPEND_DIR = $(DEPTH)/config/mkdepend MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend diff --git a/mozilla/nsprpub/pr/include/prmem.h b/mozilla/nsprpub/pr/include/prmem.h index dc88f755544..e2b88f82c37 100644 --- a/mozilla/nsprpub/pr/include/prmem.h +++ b/mozilla/nsprpub/pr/include/prmem.h @@ -121,7 +121,7 @@ PR_EXTERN(void) PR_Free(void *ptr); ** OUTPUTS: the referenced object is returned to the heap ** RETURN: void ***********************************************************************/ -#define PR_DELETE(_ptr) { PR_Free(_ptr); (_ptr) = NULL; } +#define PR_DELETE(_ptr) { PR_Free((void*)_ptr); (_ptr) = NULL; } /*********************************************************************** ** FUNCTION: PR_FREEIF() diff --git a/mozilla/nsprpub/pr/src/linking/prlink.c b/mozilla/nsprpub/pr/src/linking/prlink.c index 93f0b45ae3b..61edcad1a06 100644 --- a/mozilla/nsprpub/pr/src/linking/prlink.c +++ b/mozilla/nsprpub/pr/src/linking/prlink.c @@ -103,6 +103,8 @@ static void DLLErrorInternal(PRIntn oserr) error = dlerror(); /* $$$ That'll be wrong some of the time - AOF */ #elif defined(HAVE_STRERROR) error = strerror(oserr); /* this should be okay */ +#elif defined(XP_PC) + error = errno_string(GetLastError()); #else error = errno_string(oserr); #endif diff --git a/mozilla/sun-java/stubs/include/jni.h b/mozilla/sun-java/stubs/include/jni.h index 22b46bb35af..c10bdef963a 100644 --- a/mozilla/sun-java/stubs/include/jni.h +++ b/mozilla/sun-java/stubs/include/jni.h @@ -42,6 +42,9 @@ typedef jobject jclass; typedef void *jbyteArray; typedef void *jobjectArray; +typedef void JNIEnvInterface; +typedef const JNIEnvInterface *JNIEnv; + #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ diff --git a/mozilla/sun-java/stubs/include/jri_md.h b/mozilla/sun-java/stubs/include/jri_md.h index c7a554f6dfb..2d1a5c11004 100644 --- a/mozilla/sun-java/stubs/include/jri_md.h +++ b/mozilla/sun-java/stubs/include/jri_md.h @@ -18,32 +18,74 @@ #ifndef JRI_MD_H #define JRI_MD_H +#include + #ifdef __cplusplus extern "C" { #endif +/******************************************************************************* + * WHAT'S UP WITH THIS FILE? + * + * This is where we define the mystical JRI_PUBLIC_API macro that works on all + * platforms. If you're running with Visual C++, Symantec C, or Borland's + * development environment on the PC, you're all set. Or if you're on the Mac + * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't + * matter. + * + * On UNIX though you probably care about a couple of other symbols though: + * IS_LITTLE_ENDIAN must be defined for little-endian systems + * HAVE_LONG_LONG must be defined on systems that have 'long long' integers + * HAVE_ALIGNED_LONGLONGS must be defined if long-longs must be 8 byte aligned + * HAVE_ALIGNED_DOUBLES must be defined if doubles must be 8 byte aligned + * IS_64 must be defined on 64-bit machines (like Dec Alpha) + ******************************************************************************/ + +/* DLL Entry modifiers... */ + +/* PC */ #if defined(XP_PC) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32) # include # if defined(_MSC_VER) # if defined(WIN32) || defined(_WIN32) # define JRI_PUBLIC_API(ResultType) _declspec(dllexport) ResultType # define JRI_PUBLIC_VAR(VarType) VarType +# define JRI_PUBLIC_VAR_EXP(VarType) _declspec(dllexport) VarType +# define JRI_PUBLIC_VAR_IMP(VarType) _declspec(dllimport) VarType +# define JRI_NATIVE_STUB(ResultType) _declspec(dllexport) ResultType +# define JRI_CALLBACK # else /* !_WIN32 */ # if defined(_WINDLL) # define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds # define JRI_PUBLIC_VAR(VarType) VarType +# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType) +# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType) +# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds +# define JRI_CALLBACK __loadds # else /* !WINDLL */ # define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export # define JRI_PUBLIC_VAR(VarType) VarType +# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType) +# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType) +# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __export +# define JRI_CALLBACK __export # endif /* !WINDLL */ # endif /* !_WIN32 */ # elif defined(__BORLANDC__) # if defined(WIN32) || defined(_WIN32) # define JRI_PUBLIC_API(ResultType) __export ResultType # define JRI_PUBLIC_VAR(VarType) VarType +# define JRI_PUBLIC_VAR_EXP(VarType) __export VarType +# define JRI_PUBLIC_VAR_IMP(VarType) __import VarType +# define JRI_NATIVE_STUB(ResultType) __export ResultType +# define JRI_CALLBACK # else /* !_WIN32 */ # define JRI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds # define JRI_PUBLIC_VAR(VarType) VarType +# define JRI_PUBLIC_VAR_EXP(VarType) __cdecl __export VarType +# define JRI_PUBLIC_VAR_IMP(VarType) __cdecl __import VarType +# define JRI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds +# define JRI_CALLBACK _loadds # endif # else # error Unsupported PC development environment. @@ -65,6 +107,9 @@ extern "C" { # endif /* !GENERATINGCFM */ # define JRI_PUBLIC_API(ResultType) __declspec(export) ResultType # define JRI_PUBLIC_VAR(VarType) JRI_PUBLIC_API(VarType) +# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_API(VarType) +# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_API(VarType) +# define JRI_NATIVE_STUB(ResultType) JRI_PUBLIC_API(ResultType) # elif defined(__SC__) /* Symantec */ # error What are the Symantec defines? (warren@netscape.com) # elif macintosh && applec /* MPW */ @@ -72,22 +117,398 @@ extern "C" { # else # error Unsupported Mac development environment. # endif +# define JRI_CALLBACK /* Unix or else */ #else # define JRI_PUBLIC_API(ResultType) ResultType # define JRI_PUBLIC_VAR(VarType) VarType +# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType) +# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType) +# define JRI_NATIVE_STUB(ResultType) ResultType +# define JRI_CALLBACK +#endif + +#ifndef FAR /* for non-Win16 */ +#define FAR +#endif + +/******************************************************************************/ + +/* Java Scalar Types */ + +#if 0 /* now in jni.h */ +typedef short jchar; +typedef short jshort; +typedef float jfloat; +typedef double jdouble; +typedef juint jsize; #endif typedef unsigned char jbool; -typedef char jbyte; +typedef char jbyte; #ifdef IS_64 /* XXX ok for alpha, but not right on all 64-bit architectures */ -typedef int jint; +typedef unsigned int juint; +typedef int jint; #else -typedef long jint; +typedef unsigned long juint; +typedef long jint; #endif +/******************************************************************************* + * jlong : long long (64-bit signed integer type) support. + ******************************************************************************/ + +/* +** Bit masking macros. (n must be <= 31 to be portable) +*/ +#define JRI_BIT(n) ((juint)1 << (n)) +#define JRI_BITMASK(n) (JRI_BIT(n) - 1) + +#ifdef HAVE_LONG_LONG + +#if !(defined(WIN32) || defined(_WIN32)) +typedef long long jlong; +typedef unsigned long long julong; + +#define jlong_MAXINT 0x7fffffffffffffffLL +#define jlong_MININT 0x8000000000000000LL +#define jlong_ZERO 0x0LL + +#else +typedef LONGLONG jlong; +typedef DWORDLONG julong; + +#define jlong_MAXINT 0x7fffffffffffffffi64 +#define jlong_MININT 0x8000000000000000i64 +#define jlong_ZERO 0x0i64 + +#endif + +#define jlong_IS_ZERO(a) ((a) == 0) +#define jlong_EQ(a, b) ((a) == (b)) +#define jlong_NE(a, b) ((a) != (b)) +#define jlong_GE_ZERO(a) ((a) >= 0) +#define jlong_CMP(a, op, b) ((a) op (b)) + +#define jlong_AND(r, a, b) ((r) = (a) & (b)) +#define jlong_OR(r, a, b) ((r) = (a) | (b)) +#define jlong_XOR(r, a, b) ((r) = (a) ^ (b)) +#define jlong_OR2(r, a) ((r) = (r) | (a)) +#define jlong_NOT(r, a) ((r) = ~(a)) + +#define jlong_NEG(r, a) ((r) = -(a)) +#define jlong_ADD(r, a, b) ((r) = (a) + (b)) +#define jlong_SUB(r, a, b) ((r) = (a) - (b)) + +#define jlong_MUL(r, a, b) ((r) = (a) * (b)) +#define jlong_DIV(r, a, b) ((r) = (a) / (b)) +#define jlong_MOD(r, a, b) ((r) = (a) % (b)) + +#define jlong_SHL(r, a, b) ((r) = (a) << (b)) +#define jlong_SHR(r, a, b) ((r) = (a) >> (b)) +#define jlong_USHR(r, a, b) ((r) = (julong)(a) >> (b)) +#define jlong_ISHL(r, a, b) ((r) = ((jlong)(a)) << (b)) + +#define jlong_L2I(i, l) ((i) = (int)(l)) +#define jlong_L2UI(ui, l) ((ui) =(unsigned int)(l)) +#define jlong_L2F(f, l) ((f) = (l)) +#define jlong_L2D(d, l) ((d) = (l)) + +#define jlong_I2L(l, i) ((l) = (i)) +#define jlong_UI2L(l, ui) ((l) = (ui)) +#define jlong_F2L(l, f) ((l) = (f)) +#define jlong_D2L(l, d) ((l) = (d)) + +#define jlong_UDIVMOD(qp, rp, a, b) \ + (*(qp) = ((julong)(a) / (b)), \ + *(rp) = ((julong)(a) % (b))) + +#else /* !HAVE_LONG_LONG */ + +typedef struct { +#ifdef IS_LITTLE_ENDIAN + juint lo, hi; +#else + juint hi, lo; +#endif +} jlong; +typedef jlong julong; + +extern jlong jlong_MAXINT, jlong_MININT, jlong_ZERO; + +#define jlong_IS_ZERO(a) (((a).hi == 0) && ((a).lo == 0)) +#define jlong_EQ(a, b) (((a).hi == (b).hi) && ((a).lo == (b).lo)) +#define jlong_NE(a, b) (((a).hi != (b).hi) || ((a).lo != (b).lo)) +#define jlong_GE_ZERO(a) (((a).hi >> 31) == 0) + +/* + * NB: jlong_CMP and jlong_UCMP work only for strict relationals (<, >). + */ +#define jlong_CMP(a, op, b) (((int32)(a).hi op (int32)(b).hi) || \ + (((a).hi == (b).hi) && ((a).lo op (b).lo))) +#define jlong_UCMP(a, op, b) (((a).hi op (b).hi) || \ + (((a).hi == (b).hi) && ((a).lo op (b).lo))) + +#define jlong_AND(r, a, b) ((r).lo = (a).lo & (b).lo, \ + (r).hi = (a).hi & (b).hi) +#define jlong_OR(r, a, b) ((r).lo = (a).lo | (b).lo, \ + (r).hi = (a).hi | (b).hi) +#define jlong_XOR(r, a, b) ((r).lo = (a).lo ^ (b).lo, \ + (r).hi = (a).hi ^ (b).hi) +#define jlong_OR2(r, a) ((r).lo = (r).lo | (a).lo, \ + (r).hi = (r).hi | (a).hi) +#define jlong_NOT(r, a) ((r).lo = ~(a).lo, \ + (r).hi = ~(a).hi) + +#define jlong_NEG(r, a) ((r).lo = -(int32)(a).lo, \ + (r).hi = -(int32)(a).hi - ((r).lo != 0)) +#define jlong_ADD(r, a, b) { \ + jlong _a, _b; \ + _a = a; _b = b; \ + (r).lo = _a.lo + _b.lo; \ + (r).hi = _a.hi + _b.hi + ((r).lo < _b.lo); \ +} + +#define jlong_SUB(r, a, b) { \ + jlong _a, _b; \ + _a = a; _b = b; \ + (r).lo = _a.lo - _b.lo; \ + (r).hi = _a.hi - _b.hi - (_a.lo < _b.lo); \ +} \ + +/* + * Multiply 64-bit operands a and b to get 64-bit result r. + * First multiply the low 32 bits of a and b to get a 64-bit result in r. + * Then add the outer and inner products to r.hi. + */ +#define jlong_MUL(r, a, b) { \ + jlong _a, _b; \ + _a = a; _b = b; \ + jlong_MUL32(r, _a.lo, _b.lo); \ + (r).hi += _a.hi * _b.lo + _a.lo * _b.hi; \ +} + +/* XXX _jlong_lo16(a) = ((a) << 16 >> 16) is better on some archs (not on mips) */ +#define _jlong_lo16(a) ((a) & JRI_BITMASK(16)) +#define _jlong_hi16(a) ((a) >> 16) + +/* + * Multiply 32-bit operands a and b to get 64-bit result r. + * Use polynomial expansion based on primitive field element (1 << 16). + */ +#define jlong_MUL32(r, a, b) { \ + juint _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3; \ + _a1 = _jlong_hi16(a), _a0 = _jlong_lo16(a); \ + _b1 = _jlong_hi16(b), _b0 = _jlong_lo16(b); \ + _y0 = _a0 * _b0; \ + _y1 = _a0 * _b1; \ + _y2 = _a1 * _b0; \ + _y3 = _a1 * _b1; \ + _y1 += _jlong_hi16(_y0); /* can't carry */ \ + _y1 += _y2; /* might carry */ \ + if (_y1 < _y2) _y3 += 1 << 16; /* propagate */ \ + (r).lo = (_jlong_lo16(_y1) << 16) + _jlong_lo16(_y0); \ + (r).hi = _y3 + _jlong_hi16(_y1); \ +} + +/* + * Divide 64-bit unsigned operand a by 64-bit unsigned operand b, setting *qp + * to the 64-bit unsigned quotient, and *rp to the 64-bit unsigned remainder. + * Minimize effort if one of qp and rp is null. + */ +#define jlong_UDIVMOD(qp, rp, a, b) jlong_udivmod(qp, rp, a, b) + +extern JRI_PUBLIC_API(void) +jlong_udivmod(julong *qp, julong *rp, julong a, julong b); + +#define jlong_DIV(r, a, b) { \ + jlong _a, _b; \ + juint _negative = (int32)(a).hi < 0; \ + if (_negative) { \ + jlong_NEG(_a, a); \ + } else { \ + _a = a; \ + } \ + if ((int32)(b).hi < 0) { \ + _negative ^= 1; \ + jlong_NEG(_b, b); \ + } else { \ + _b = b; \ + } \ + jlong_UDIVMOD(&(r), 0, _a, _b); \ + if (_negative) \ + jlong_NEG(r, r); \ +} + +#define jlong_MOD(r, a, b) { \ + jlong _a, _b; \ + juint _negative = (int32)(a).hi < 0; \ + if (_negative) { \ + jlong_NEG(_a, a); \ + } else { \ + _a = a; \ + } \ + if ((int32)(b).hi < 0) { \ + jlong_NEG(_b, b); \ + } else { \ + _b = b; \ + } \ + jlong_UDIVMOD(0, &(r), _a, _b); \ + if (_negative) \ + jlong_NEG(r, r); \ +} + +/* + * NB: b is a juint, not jlong or julong, for the shift ops. + */ +#define jlong_SHL(r, a, b) { \ + if (b) { \ + jlong _a; \ + _a = a; \ + if ((b) < 32) { \ + (r).lo = _a.lo << (b); \ + (r).hi = (_a.hi << (b)) | (_a.lo >> (32 - (b))); \ + } else { \ + (r).lo = 0; \ + (r).hi = _a.lo << ((b) & 31); \ + } \ + } else { \ + (r) = (a); \ + } \ +} + +/* a is an int32, b is int32, r is jlong */ +#define jlong_ISHL(r, a, b) { \ + if (b) { \ + jlong _a; \ + _a.lo = (a); \ + _a.hi = 0; \ + if ((b) < 32) { \ + (r).lo = (a) << (b); \ + (r).hi = ((a) >> (32 - (b))); \ + } else { \ + (r).lo = 0; \ + (r).hi = (a) << ((b) & 31); \ + } \ + } else { \ + (r).lo = (a); \ + (r).hi = 0; \ + } \ +} + +#define jlong_SHR(r, a, b) { \ + if (b) { \ + jlong _a; \ + _a = a; \ + if ((b) < 32) { \ + (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \ + (r).hi = (int32)_a.hi >> (b); \ + } else { \ + (r).lo = (int32)_a.hi >> ((b) & 31); \ + (r).hi = (int32)_a.hi >> 31; \ + } \ + } else { \ + (r) = (a); \ + } \ +} + +#define jlong_USHR(r, a, b) { \ + if (b) { \ + jlong _a; \ + _a = a; \ + if ((b) < 32) { \ + (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \ + (r).hi = _a.hi >> (b); \ + } else { \ + (r).lo = _a.hi >> ((b) & 31); \ + (r).hi = 0; \ + } \ + } else { \ + (r) = (a); \ + } \ +} + +#define jlong_L2I(i, l) ((i) = (l).lo) +#define jlong_L2UI(ui, l) ((ui) = (l).lo) +#define jlong_L2F(f, l) { double _d; jlong_L2D(_d, l); (f) = (float) _d; } + +#define jlong_L2D(d, l) { \ + int32 _negative; \ + jlong _absval; \ + \ + _negative = (l).hi >> 31; \ + if (_negative) { \ + jlong_NEG(_absval, l); \ + } else { \ + _absval = l; \ + } \ + (d) = (double)_absval.hi * 4.294967296e9 + _absval.lo; \ + if (_negative) \ + (d) = -(d); \ +} + +#define jlong_I2L(l, i) ((l).hi = (i) >> 31, (l).lo = (i)) +#define jlong_UI2L(l, ui) ((l).hi = 0, (l).lo = (ui)) +#define jlong_F2L(l, f) { double _d = (double) f; jlong_D2L(l, _d); } + +#define jlong_D2L(l, d) { \ + int _negative; \ + double _absval, _d_hi; \ + jlong _lo_d; \ + \ + _negative = ((d) < 0); \ + _absval = _negative ? -(d) : (d); \ + \ + (l).hi = (juint)(_absval / 4.294967296e9); \ + (l).lo = 0; \ + jlong_L2D(_d_hi, l); \ + _absval -= _d_hi; \ + _lo_d.hi = 0; \ + if (_absval < 0) { \ + _lo_d.lo = (juint) -_absval; \ + jlong_SUB(l, l, _lo_d); \ + } else { \ + _lo_d.lo = (juint) _absval; \ + jlong_ADD(l, l, _lo_d); \ + } \ + \ + if (_negative) \ + jlong_NEG(l, l); \ +} + +#endif /* !HAVE_LONG_LONG */ + +/******************************************************************************/ + +#ifdef HAVE_ALIGNED_LONGLONGS +#define JRI_GET_INT64(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \ + ((_t).x[1] = ((jint*)(_addr))[1]), \ + (_t).l ) +#define JRI_SET_INT64(_t, _addr, _v) ( (_t).l = (_v), \ + ((jint*)(_addr))[0] = (_t).x[0], \ + ((jint*)(_addr))[1] = (_t).x[1] ) +#else +#define JRI_GET_INT64(_t,_addr) (*(jlong*)(_addr)) +#define JRI_SET_INT64(_t, _addr, _v) (*(jlong*)(_addr) = (_v)) +#endif + +/* If double's must be aligned on doubleword boundaries then define this */ +#ifdef HAVE_ALIGNED_DOUBLES +#define JRI_GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \ + ((_t).x[1] = ((jint*)(_addr))[1]), \ + (_t).d ) +#define JRI_SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v), \ + ((jint*)(_addr))[0] = (_t).x[0], \ + ((jint*)(_addr))[1] = (_t).x[1] ) +#else +#define JRI_GET_DOUBLE(_t,_addr) (*(jdouble*)(_addr)) +#define JRI_SET_DOUBLE(_t, _addr, _v) (*(jdouble*)(_addr) = (_v)) +#endif + +/******************************************************************************/ #ifdef __cplusplus } #endif #endif /* JRI_MD_H */ +/******************************************************************************/