Hello, guys.
I'm trying to embed the Mozilla browser on MacOS X inside an Eclipse
plugin. I've read all the docs I could find on the Web and finally did
the following:
1) Fetched XULRunner from 1.8 CVS branch (MOZILLA_1_8_BRANCH or smt
like that).
2) Made sure that the patch that adds getNativeHandleFromAWT is there.
3) Compiled using gcc 4 (for Intel, that is).
4) Fetched the latest ATF sources (as an example that is said to
work).
5) Tried to apply the patch Javier Pedemonte has provided in https://
bugs.eclipse.org/bugs/show_bug.cgi?id=160098. It had some conflicts,
but I believe I've merged the SWT browser-related one by hands. (I'm
only interested in the browser widget, not the whole ATF.)
6) Created a simple editor which looks basically like this:
public class BrowserEditor extends EditorPart {
private MozillaBrowser browser;
public void createPartControl(Composite parent) {
browser = new MozillaBrowser(parent, SWT.NONE);
browser.setUrl("http://www.xored.com");
browser.setBounds(0, 0, 100, 100);
}
... stubs ...
}
7) Installed Apple's update for Java that brings in SWT_AWT support.
8) Changed org.eclipse.atf.mozilla.ide.core.MozillaHelper to reference
my XULRunner path and also to call mozilla.initialize (about which
I've read in one of Eclipse bugs, and also JavaXPCOM has told me when
I've tried to launch the app without that call):
Index: src/org/eclipse/atf/mozilla/ide/core/MozillaHelper.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.atf/components/plugins/
org.eclipse.atf.mozilla.ide.core/src/org/eclipse/atf/mozilla/ide/core/
MozillaHelper.java,v
retrieving revision 1.4
diff -u -r1.4 MozillaHelper.java
--- src/org/eclipse/atf/mozilla/ide/core/MozillaHelper.java 30 Oct
2006 22:10:15 -0000 1.4
+++ src/org/eclipse/atf/mozilla/ide/core/MozillaHelper.java 30 Jan
2007 23:47:42 -0000
@@ -51,8 +51,10 @@
if (!grePath.isDirectory())
grePath = grePath.getParentFile();
} catch (FileNotFoundException fnfe) {
- throw new MozillaInitializationException(fnfe);
+// throw new MozillaInitializationException(fnfe);
+ System.out.println("Note: XULRunner
installation wouldn't be
found.");
}
+ grePath = new
File("/Users/andreyvit/mozilla/xul181/mozilla/dist/
XUL.framework/Versions/Current");
}
//finally initialize
@@ -63,6 +65,7 @@
}
MozideCorePlugin.logInfo("Using XulRunner profile at: " +
profileDir);
LocationProvider locProvider = new
LocationProvider(grePath, profileDir);
+ mozilla.initialize(grePath);
mozilla.initEmbedding(grePath, grePath, locProvider);
_initialized = true;
} catch (Exception e) {
I don't know if initialize() is called the right way.
9) Ran the whole thing. Oops. Mozilla returns NS_ERROR_FAILURE:
org.mozilla.xpcom.XPCOMException: The function "initWindow" returned
an error condition (0x80004005)
at org.mozilla.xpcom.internal.XPCOMJavaProxy.callXPCOMMethod(Native
Method)
at
org.mozilla.xpcom.internal.XPCOMJavaProxy.invoke(XPCOMJavaProxy.java:
143)
at $Proxy5.initWindow(Unknown Source)
at org.eclipse.swt.browser.MozillaBrowser.<init>(MozillaBrowser.java:
230)
at
com.xored.browser.test.editors.BrowserEditor.createPartControl(BrowserE
ditor.java:36)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReferenc
e.java:596)
...
The following is on the console:
2007-01-31 05:28:49.386 java[10797] [Java CocoaComponent compatibility
mode]: Enabled
2007-01-31 05:28:49.386 java[10797] [Java CocoaComponent compatibility
mode]: Setting timeout for SWT to 0.100000
10) This is not the worst result, however. When I've tried using my
own code for Mozilla binding (I gave it a try a few month ago), based
on the code from Bugzilla patch which seem to be adopted and further
reworked inside ATF now - then the app just crashed upon reaching
initWindow (100% reproducibly). The console had, additionally to the
two lines mentioned above, a line about illegal memory access or smt
like that.
Does anybody have a working ATF or simply SWT-embedded Mozilla browser
on a mac now? If yes, how did you get that done?
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding