Line 0
Link Here
|
|
|
1 |
--- plugins/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java.orig Wed Nov 29 14:32:45 2006 |
2 |
+++ plugins/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java Wed Nov 29 14:42:01 2006 |
3 |
@@ -10,15 +10,75 @@ |
4 |
*******************************************************************************/ |
5 |
package org.eclipse.swt.browser; |
6 |
|
7 |
-import java.io.*; |
8 |
-import java.util.*; |
9 |
-import org.eclipse.swt.*; |
10 |
-import org.eclipse.swt.widgets.*; |
11 |
-import org.eclipse.swt.graphics.*; |
12 |
-import org.eclipse.swt.internal.*; |
13 |
-import org.eclipse.swt.internal.gtk.*; |
14 |
-import org.eclipse.swt.internal.mozilla.*; |
15 |
-import org.eclipse.swt.layout.*; |
16 |
+import java.io.File; |
17 |
+import java.io.UnsupportedEncodingException; |
18 |
+import java.util.Locale; |
19 |
+import java.util.StringTokenizer; |
20 |
+ |
21 |
+import org.eclipse.swt.SWT; |
22 |
+import org.eclipse.swt.SWTError; |
23 |
+import org.eclipse.swt.SWTException; |
24 |
+import org.eclipse.swt.graphics.Point; |
25 |
+import org.eclipse.swt.graphics.Rectangle; |
26 |
+import org.eclipse.swt.internal.Callback; |
27 |
+import org.eclipse.swt.internal.Converter; |
28 |
+import org.eclipse.swt.internal.Library; |
29 |
+import org.eclipse.swt.internal.gtk.GdkEvent; |
30 |
+import org.eclipse.swt.internal.gtk.LONG; |
31 |
+import org.eclipse.swt.internal.gtk.OS; |
32 |
+import org.eclipse.swt.internal.mozilla.XPCOM; |
33 |
+import org.eclipse.swt.internal.mozilla.XPCOMObject; |
34 |
+import org.eclipse.swt.internal.mozilla.nsEmbedString; |
35 |
+import org.eclipse.swt.internal.mozilla.nsIAppShell; |
36 |
+import org.eclipse.swt.internal.mozilla.nsIBaseWindow; |
37 |
+import org.eclipse.swt.internal.mozilla.nsICategoryManager; |
38 |
+import org.eclipse.swt.internal.mozilla.nsIComponentManager; |
39 |
+import org.eclipse.swt.internal.mozilla.nsIComponentRegistrar; |
40 |
+import org.eclipse.swt.internal.mozilla.nsIContextMenuListener; |
41 |
+import org.eclipse.swt.internal.mozilla.nsICookie; |
42 |
+import org.eclipse.swt.internal.mozilla.nsICookieManager; |
43 |
+import org.eclipse.swt.internal.mozilla.nsID; |
44 |
+import org.eclipse.swt.internal.mozilla.nsIDOMEvent; |
45 |
+import org.eclipse.swt.internal.mozilla.nsIDOMMouseEvent; |
46 |
+import org.eclipse.swt.internal.mozilla.nsIDOMWindow; |
47 |
+import org.eclipse.swt.internal.mozilla.nsIDirectoryService; |
48 |
+import org.eclipse.swt.internal.mozilla.nsIDocShell; |
49 |
+import org.eclipse.swt.internal.mozilla.nsIEmbeddingSiteWindow; |
50 |
+import org.eclipse.swt.internal.mozilla.nsIFile; |
51 |
+import org.eclipse.swt.internal.mozilla.nsIIOService; |
52 |
+import org.eclipse.swt.internal.mozilla.nsIInterfaceRequestor; |
53 |
+import org.eclipse.swt.internal.mozilla.nsILocalFile; |
54 |
+import org.eclipse.swt.internal.mozilla.nsIPrefBranch; |
55 |
+import org.eclipse.swt.internal.mozilla.nsIPrefLocalizedString; |
56 |
+import org.eclipse.swt.internal.mozilla.nsIPrefService; |
57 |
+import org.eclipse.swt.internal.mozilla.nsIProperties; |
58 |
+import org.eclipse.swt.internal.mozilla.nsIRequest; |
59 |
+import org.eclipse.swt.internal.mozilla.nsIServiceManager; |
60 |
+import org.eclipse.swt.internal.mozilla.nsISimpleEnumerator; |
61 |
+import org.eclipse.swt.internal.mozilla.nsISupports; |
62 |
+import org.eclipse.swt.internal.mozilla.nsISupportsWeakReference; |
63 |
+import org.eclipse.swt.internal.mozilla.nsITooltipListener; |
64 |
+import org.eclipse.swt.internal.mozilla.nsIURI; |
65 |
+import org.eclipse.swt.internal.mozilla.nsIURIContentListener; |
66 |
+import org.eclipse.swt.internal.mozilla.nsIWeakReference; |
67 |
+import org.eclipse.swt.internal.mozilla.nsIWebBrowser; |
68 |
+import org.eclipse.swt.internal.mozilla.nsIWebBrowserChrome; |
69 |
+import org.eclipse.swt.internal.mozilla.nsIWebBrowserChromeFocus; |
70 |
+import org.eclipse.swt.internal.mozilla.nsIWebBrowserFocus; |
71 |
+import org.eclipse.swt.internal.mozilla.nsIWebBrowserStream; |
72 |
+import org.eclipse.swt.internal.mozilla.nsIWebNavigation; |
73 |
+import org.eclipse.swt.internal.mozilla.nsIWebProgress; |
74 |
+import org.eclipse.swt.internal.mozilla.nsIWebProgressListener; |
75 |
+import org.eclipse.swt.internal.mozilla.nsIWindowWatcher; |
76 |
+import org.eclipse.swt.layout.FillLayout; |
77 |
+import org.eclipse.swt.widgets.Composite; |
78 |
+import org.eclipse.swt.widgets.Display; |
79 |
+import org.eclipse.swt.widgets.Event; |
80 |
+import org.eclipse.swt.widgets.Label; |
81 |
+import org.eclipse.swt.widgets.Listener; |
82 |
+import org.eclipse.swt.widgets.Menu; |
83 |
+import org.eclipse.swt.widgets.Shell; |
84 |
+import org.eclipse.swt.widgets.Widget; |
85 |
|
86 |
/** |
87 |
* Instances of this class implement the browser user interface |
88 |
@@ -175,40 +235,9 @@ |
89 |
* - mozilla17profile/mozilla17profile-gcc should succeed for mozilla 1.7.x and firefox |
90 |
* - mozilla18profile/mozilla18profile-gcc should succeed for mozilla 1.8.x (seamonkey) |
91 |
*/ |
92 |
- try { |
93 |
- Library.loadLibrary ("swt-mozilla14-profile"); //$NON-NLS-1$ |
94 |
- usingProfile = true; |
95 |
- } catch (UnsatisfiedLinkError e1) { |
96 |
- try { |
97 |
- Library.loadLibrary ("swt-mozilla17-profile"); //$NON-NLS-1$ |
98 |
- usingProfile = true; |
99 |
- } catch (UnsatisfiedLinkError e2) { |
100 |
- try { |
101 |
- Library.loadLibrary ("swt-mozilla14-profile-gcc3"); //$NON-NLS-1$ |
102 |
- usingProfile = true; |
103 |
- } catch (UnsatisfiedLinkError e3) { |
104 |
- try { |
105 |
- Library.loadLibrary ("swt-mozilla17-profile-gcc3"); //$NON-NLS-1$ |
106 |
- usingProfile = true; |
107 |
- } catch (UnsatisfiedLinkError e4) { |
108 |
- try { |
109 |
- Library.loadLibrary ("swt-mozilla18-profile"); //$NON-NLS-1$ |
110 |
- usingProfile = true; |
111 |
- } catch (UnsatisfiedLinkError e5) { |
112 |
- try { |
113 |
- Library.loadLibrary ("swt-mozilla18-profile-gcc3"); //$NON-NLS-1$ |
114 |
- usingProfile = true; |
115 |
- } catch (UnsatisfiedLinkError e6) { |
116 |
- /* |
117 |
- * fail silently, the Browser will still work without profile support |
118 |
- * but will abort any attempts to navigate to HTTPS pages |
119 |
- */ |
120 |
- } |
121 |
- } |
122 |
- } |
123 |
- } |
124 |
- } |
125 |
- } |
126 |
+ //Library.loadLibrary("swt-mozilla17-profile"); |
127 |
+ // We build the profile stuff without the need for a separate DSO |
128 |
+ usingProfile = true; |
129 |
|
130 |
int /*long*/[] retVal = new int /*long*/[1]; |
131 |
nsEmbedString pathString = new nsEmbedString(mozillaPath); |
132 |
@@ -218,11 +247,11 @@ |
133 |
if (retVal[0] == 0) error(XPCOM.NS_ERROR_NULL_POINTER); |
134 |
|
135 |
nsILocalFile localFile = new nsILocalFile(retVal[0]); |
136 |
- rc = XPCOM.NS_InitEmbedding(localFile.getAddress(), 0); |
137 |
+ rc = XPCOM.NS_InitXPCOM3(0, localFile.getAddress(), 0, 0, 0); |
138 |
localFile.Release(); |
139 |
if (rc != XPCOM.NS_OK) { |
140 |
dispose(); |
141 |
- SWT.error(SWT.ERROR_NO_HANDLES, null, " [NS_InitEmbedding "+mozillaPath+" error "+rc+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
142 |
+ SWT.error(SWT.ERROR_NO_HANDLES, null, " [NS_InitXPCOM3 "+mozillaPath+" error "+rc+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
143 |
} |
144 |
|
145 |
rc = XPCOM.NS_GetComponentManager(result); |
146 |
@@ -283,7 +312,7 @@ |
147 |
rc = properties.Get(buffer, nsIFile.NS_IFILE_IID, result); |
148 |
if (rc != XPCOM.NS_OK) error(rc); |
149 |
if (result[0] == 0) error(XPCOM.NS_NOINTERFACE); |
150 |
- properties.Release(); |
151 |
+ // properties.Release() is now after the Set below |
152 |
|
153 |
nsIFile profileDir = new nsIFile(result[0]); |
154 |
result[0] = 0; |
155 |
@@ -305,24 +334,15 @@ |
156 |
pathString.dispose(); // |
157 |
|
158 |
profileDir = new nsIFile(result[0]); |
159 |
- result[0] = 0; |
160 |
- |
161 |
- rc = XPCOM_PROFILE.NS_NewProfileDirServiceProvider(true, result); |
162 |
+ |
163 |
+ // Set the profile dir property so that it's initialized for |
164 |
+ // things like password manager and https |
165 |
+ buffer = Converter.wcsToMbcs(null, XPCOM.NS_APP_USER_PROFILE_50_DIR, true); |
166 |
+ rc = properties.Set(buffer, profileDir.getAddress()); |
167 |
if (rc != XPCOM.NS_OK) error(rc); |
168 |
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE); |
169 |
- |
170 |
- final int /*long*/ dirServiceProvider = result[0]; |
171 |
+ properties.Release(); |
172 |
+ |
173 |
result[0] = 0; |
174 |
- rc = XPCOM_PROFILE.ProfileDirServiceProvider_Register(dirServiceProvider); |
175 |
- if (rc != XPCOM.NS_OK) error(rc); |
176 |
- rc = XPCOM_PROFILE.ProfileDirServiceProvider_SetProfileDir(dirServiceProvider, profileDir.getAddress()); |
177 |
- if (rc != XPCOM.NS_OK) error(rc); |
178 |
- |
179 |
- getDisplay().addListener(SWT.Dispose, new Listener() { |
180 |
- public void handleEvent(Event e) { |
181 |
- XPCOM_PROFILE.ProfileDirServiceProvider_Shutdown(dirServiceProvider); |
182 |
- } |
183 |
- }); |
184 |
} |
185 |
|
186 |
/* |