mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
1999-10-07 <Ed Burns <ed.burns@sun.com>>
* This change fixes http://bugzilla.mozilla.org/show_bug.cgi?id=15793 which caused one to have to copy the component.reg and components directory. It also causes webclient to do autoregistration. It also adds a debugging method to BrowserControlMozillaShim.java nativeDebugBreak(). This changes makes webclient depend on having mozilla sources from 10/5/99 or later. Reviewed by Mark Lin <marklin@eng.sun.com> Approved by Ed Burns <edburns@acm.org>, module owner
This commit is contained in:
parent
f0c6611e7a
commit
a8e9d5219a
@ -7,6 +7,9 @@
|
||||
debugging method to BrowserControlMozillaShim.java
|
||||
nativeDebugBreak().
|
||||
|
||||
This changes makes webclient depend on having mozilla sources from
|
||||
10/5/99 or later.
|
||||
|
||||
Reviewed by Mark Lin <marklin@eng.sun.com>
|
||||
Approved by Ed Burns <edburns@acm.org>, module owner
|
||||
|
||||
|
@ -31,7 +31,7 @@ import java.awt.Rectangle;
|
||||
*
|
||||
* <B>Lifetime And Scope</B> <P>
|
||||
*
|
||||
* @version $Id: BrowserControlImpl.java,v 1.2 1999/09/03 19:28:44 edburns%acm.org Exp $
|
||||
* @version $Id: BrowserControlImpl.java,v 1.3 1999/10/08 00:48:01 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControl
|
||||
*
|
||||
@ -69,7 +69,8 @@ public class BrowserControlImpl extends Object implements BrowserControl
|
||||
|
||||
public BrowserControlImpl(int windowPtr, Rectangle bounds) throws Exception
|
||||
{
|
||||
nativeWebShell = BrowserControlMozillaShim.webShellCreate(windowPtr, bounds);
|
||||
nativeWebShell = BrowserControlMozillaShim.webShellCreate(windowPtr,
|
||||
bounds);
|
||||
}
|
||||
|
||||
//
|
||||
@ -244,7 +245,7 @@ public static void main(String [] args)
|
||||
// BrowserControlImpl me = new BrowserControlImpl();
|
||||
Log.setApplicationName("BrowserControlImpl");
|
||||
Log.setApplicationVersion("0.0");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.2 1999/09/03 19:28:44 edburns%acm.org Exp $");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.3 1999/10/08 00:48:01 edburns%acm.org Exp $");
|
||||
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ import java.awt.*;
|
||||
* There is one instance of this class and all of the exposed methods
|
||||
* are static.
|
||||
|
||||
* @version $Id: BrowserControlMozillaShim.java,v 1.3 1999/09/03 19:28:45 edburns%acm.org Exp $
|
||||
* @version $Id: BrowserControlMozillaShim.java,v 1.4 1999/10/08 00:48:02 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControlImpl
|
||||
|
||||
@ -85,25 +85,19 @@ public BrowserControlMozillaShim()
|
||||
// Class methods
|
||||
//
|
||||
|
||||
public static void initialize () throws Exception
|
||||
/**
|
||||
|
||||
* it is safe to call this method multiple times, it is guaranteed
|
||||
* to only actually do something once.
|
||||
|
||||
*/
|
||||
|
||||
public static void initialize(String verifiedBinDirAbsolutePath) throws Exception
|
||||
{
|
||||
if (!initialized) {
|
||||
instance = new BrowserControlMozillaShim();
|
||||
|
||||
// PENDING(mark): Try loading the native library in your own implemntation specfic canvas
|
||||
// class (ie. Win32BrowserControlCanvas or MotifBrowserControlCanvas.
|
||||
// The Unix port needs this. If this is a problem, let me know ASAP.
|
||||
// - Mark
|
||||
/*
|
||||
try {
|
||||
System.loadLibrary("webclient");
|
||||
}
|
||||
catch (java.lang.UnsatisfiedLinkError e) {
|
||||
throw new Exception("Unable to open native webclient library");
|
||||
}
|
||||
*/
|
||||
|
||||
instance.nativeInitialize();
|
||||
instance.nativeInitialize(verifiedBinDirAbsolutePath);
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
@ -285,7 +279,10 @@ public static int webShellCreate (int windowPtr,
|
||||
{
|
||||
synchronized(lock) {
|
||||
if (initialized) {
|
||||
return(instance.nativeWebShellCreate(windowPtr, bounds.x, bounds.y, bounds.width + 1, bounds.height + 1));
|
||||
return(instance.nativeWebShellCreate(windowPtr,
|
||||
bounds.x, bounds.y,
|
||||
bounds.width + 1,
|
||||
bounds.height + 1));
|
||||
}
|
||||
else {
|
||||
throw new Exception("Error: unable to create native nsIWebShell");
|
||||
@ -504,7 +501,7 @@ public static boolean webShellRefresh(int webShellPtr) throws Exception
|
||||
// Native interfaces
|
||||
//
|
||||
|
||||
private native void nativeInitialize () throws Exception;
|
||||
private native void nativeInitialize (String verifiedBinDirAbsolutePath) throws Exception;
|
||||
private native void nativeTerminate () throws Exception;
|
||||
|
||||
|
||||
@ -573,6 +570,8 @@ private native String nativeWebShellGetURL (int webShellPtr, int aHistoryIndex
|
||||
*/
|
||||
private native boolean nativeWebShellRefresh (int webShellPtr) throws Exception;
|
||||
|
||||
public static native void nativeDebugBreak(String fileName, int lineNumber);
|
||||
|
||||
//
|
||||
// General Methods
|
||||
//
|
||||
@ -589,7 +588,7 @@ public static void main(String [] args)
|
||||
BrowserControlMozillaShim me = new BrowserControlMozillaShim();
|
||||
Log.setApplicationName("BrowserControlMozillaShim");
|
||||
Log.setApplicationVersion("0.0");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlMozillaShim.java,v 1.3 1999/09/03 19:28:45 edburns%acm.org Exp $");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlMozillaShim.java,v 1.4 1999/10/08 00:48:02 edburns%acm.org Exp $");
|
||||
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ import org.mozilla.webclient.*;
|
||||
* This is a test application for using the BrowserControl.
|
||||
|
||||
*
|
||||
* @version $Id: EmbeddedMozilla.java,v 1.2 1999/09/03 19:28:45 edburns%acm.org Exp $
|
||||
* @version $Id: EmbeddedMozilla.java,v 1.3 1999/10/08 00:48:04 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControlCanvasFactory
|
||||
|
||||
@ -47,16 +47,26 @@ public class EmbeddedMozilla extends Frame implements ActionListener {
|
||||
private Panel controlPanel;
|
||||
private Panel buttonsPanel;
|
||||
|
||||
public static void printUsage()
|
||||
{
|
||||
System.out.println("usage: java org.mozilla.webclient.test.EmbeddedMozilla <path> [url]");
|
||||
System.out.println(" <path> is the absolute path to the native browser bin directory, ");
|
||||
System.out.println(" including the bin.");
|
||||
}
|
||||
|
||||
|
||||
public static void main (String[] arg) {
|
||||
String urlArg =(0 < arg.length) ? arg[0] : "http://www.mozilla.org/";
|
||||
if (1 > arg.length) {
|
||||
printUsage();
|
||||
System.exit(-1);
|
||||
}
|
||||
String urlArg =(2 == arg.length) ? arg[1] : "http://www.mozilla.org/";
|
||||
|
||||
EmbeddedMozilla gecko =
|
||||
new EmbeddedMozilla("Embedded Mozilla", urlArg);
|
||||
new EmbeddedMozilla("Embedded Mozilla", arg[0], urlArg);
|
||||
} // main()
|
||||
|
||||
|
||||
public EmbeddedMozilla (String title, String url) {
|
||||
public EmbeddedMozilla (String title, String binDir, String url) {
|
||||
super(title);
|
||||
System.out.println("constructed with " + url);
|
||||
|
||||
@ -96,8 +106,17 @@ public class EmbeddedMozilla extends Frame implements ActionListener {
|
||||
controlPanel.add(buttonsPanel, BorderLayout.WEST);
|
||||
|
||||
// Create the browser
|
||||
BrowserControlCanvas browser =
|
||||
BrowserControlCanvasFactory.newBrowserControlCanvas();
|
||||
BrowserControlCanvas browser = null;
|
||||
|
||||
try {
|
||||
BrowserControlCanvasFactory.setAppData(binDir);
|
||||
browser = BrowserControlCanvasFactory.newBrowserControlCanvas();
|
||||
}
|
||||
catch(Exception e) {
|
||||
System.out.println("Can't create BrowserControlCanvas: " +
|
||||
e.getMessage());
|
||||
}
|
||||
|
||||
browser.setSize(defaultWidth, defaultHeight);
|
||||
|
||||
// Add the control panel and the browser
|
||||
|
@ -60,6 +60,8 @@ nsMacMessageSink gMessageSink;
|
||||
#include "nsActions.h"
|
||||
|
||||
#include "nsIRegistry.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#define DEBUG_RAPTOR_CANVAS 1
|
||||
|
||||
@ -71,9 +73,13 @@ static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
||||
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
extern "C" void NS_SetupRegistry();
|
||||
extern nsresult NS_AutoregisterComponents();
|
||||
|
||||
static nsFileSpec registryFile;
|
||||
static nsFileSpec componentDir;
|
||||
|
||||
struct WebShellInitContext {
|
||||
#ifdef XP_UNIX
|
||||
@ -288,6 +294,23 @@ EmbeddedEventHandler (void * arg) {
|
||||
initContext->initFailCode = kInitWebShellError;
|
||||
return;
|
||||
}
|
||||
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("EmbeddedEventHandler(%lx): Install Prefs in the Webshell...\n", initContext);
|
||||
#endif
|
||||
|
||||
nsIPref *prefs;
|
||||
|
||||
rv = nsServiceManager::GetService(kPrefCID,
|
||||
nsIPref::GetIID(),
|
||||
(nsISupports **)&prefs);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Set the prefs in the outermost webshell.
|
||||
initContext->webShell->SetPrefs(prefs);
|
||||
nsServiceManager::ReleaseService(kPrefCID, prefs);
|
||||
}
|
||||
|
||||
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("EmbeddedEventHandler(%lx): Show the WebShell...\n", initContext);
|
||||
#endif
|
||||
@ -588,19 +611,29 @@ extern "C" {
|
||||
/*
|
||||
* Class: BrowserControlMozillaShim
|
||||
* Method: raptorInitialize
|
||||
* Signature: ()V
|
||||
* Signature: (Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize(
|
||||
JNIEnv *env,
|
||||
jobject obj)
|
||||
jobject obj,
|
||||
jstring verifiedBinDirAbsolutePath)
|
||||
{
|
||||
JNIEnv * pEnv = env;
|
||||
jobject jobj = obj;
|
||||
static PRBool gFirstTime = PR_TRUE;
|
||||
if (gFirstTime)
|
||||
{
|
||||
// set the registryFile and componentDir correctly
|
||||
const char *nativePath = (const char *) env->GetStringUTFChars(verifiedBinDirAbsolutePath, 0);
|
||||
registryFile = nativePath;
|
||||
registryFile += "component.reg";
|
||||
componentDir = nativePath;
|
||||
componentDir += "components";
|
||||
|
||||
NS_InitXPCOM(NULL, ®istryFile, &componentDir);
|
||||
NS_SetupRegistry();
|
||||
NS_AutoregisterComponents();
|
||||
gFirstTime = PR_FALSE;
|
||||
}
|
||||
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize()
|
||||
@ -1845,6 +1878,21 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MozillaEventThread_proce
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_BrowserControlMozillaShim
|
||||
* Method: nativeDebugBreak
|
||||
* Signature: (Ljava/lang/String;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeDebugBreak(JNIEnv *jEnv,
|
||||
jclass myClass,
|
||||
jstring fileName,
|
||||
jint lineNumber)
|
||||
{
|
||||
const char *charFileName = (char *) jEnv->GetStringUTFChars(fileName, 0);
|
||||
nsDebug::Break(charFileName, lineNumber);
|
||||
}
|
||||
|
||||
|
||||
#ifdef XP_UNIX
|
||||
}// End extern "C"
|
||||
|
@ -67,7 +67,7 @@ install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
|
||||
@echo +++ Creating $(MOZ_SRC)\mozilla\java\webclient\src\$(OBJDIR)\runem.bat. Use this to run the test browser.
|
||||
@echo set PATH=$(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin;$(PATH) > .\$(OBJDIR)\runem.bat
|
||||
@echo $(JAVA) -Djava.library.path=$(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin -classpath $(JAVAC_CLASSPATH) org.mozilla.webclient.test.EmbeddedMozilla %1% >> .\$(OBJDIR)\runem.bat
|
||||
@echo $(JAVA) -Djava.library.path=$(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin -classpath $(JAVAC_CLASSPATH) org.mozilla.webclient.test.EmbeddedMozilla $(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin %1% >> .\$(OBJDIR)\runem.bat
|
||||
|
||||
clobber_all:: clobber
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user