Mercurial > projects > dwt-linux
annotate dwt/browser/Mozilla.d @ 348:9a4d7706df52
Test Update to fix linux XPCOM interface issues
author | John Reimer <terminal.node@gmail.com> |
---|---|
date | Fri, 31 Oct 2008 21:46:44 -0700 |
parents | 2e591eb01162 |
children | 373b48b9eaf0 |
rev | line source |
---|---|
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1 /******************************************************************************* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2003, 2007 IBM Corporation and others. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3 * All rights reserved. This program and the accompanying materials |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
5 * which accompanies this distribution, and is available at |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
6 * http://www.eclipse.org/legal/epl-v10.html |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
7 * |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
8 * Contributors: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
9 * IBM Corporation - initial API and implementation |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
10 * Port to the D programming language: |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
11 * John Reimer <terminal.node@gmail.com> |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
12 *******************************************************************************/ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
13 module dwt.browser.Mozilla; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
14 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
15 import dwt.dwthelper.utils; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
16 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
17 import tango.text.locale.Core; // Necessary for Region/Culture/Locale code |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
18 import tango.text.convert.Format; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
19 import tango.io.Console; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
20 import tango.sys.Environment; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
21 import tango.stdc.string; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
22 |
340 | 23 import dwt.internal.c.gtk; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
24 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
25 import dwt.DWT; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
26 import dwt.DWTError; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
27 import dwt.graphics.Device; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
28 import dwt.graphics.Point; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
29 import dwt.graphics.Rectangle; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
30 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
31 import dwt.browser.Browser; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
32 import dwt.browser.WebBrowser; |
340 | 33 import dwt.browser.MozillaDelegate; |
34 import dwt.browser.AppFileLocProvider; | |
35 import dwt.browser.WindowCreator2; | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
36 import dwt.browser.PromptService2Factory; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
37 import dwt.browser.HelperAppLauncherDialogFactory; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
38 import dwt.browser.DownloadFactory; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
39 import dwt.browser.DownloadFactory_1_8; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
40 import dwt.browser.FilePickerFactory; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
41 import dwt.browser.FilePickerFactory_1_8; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
42 import dwt.browser.InputStream; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
43 import dwt.browser.StatusTextEvent; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
44 import dwt.browser.ProgressEvent; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
45 import dwt.browser.LocationEvent; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
46 import dwt.browser.WindowEvent; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
47 import dwt.browser.TitleEvent; |
340 | 48 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
49 import dwt.internal.Compatibility; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
50 import dwt.internal.LONG; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
51 import dwt.internal.Library; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
52 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
53 import XPCOM = dwt.internal.mozilla.XPCOM; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
54 import XPCOMInit = dwt.internal.mozilla.XPCOMInit; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
55 |
340 | 56 import dwt.internal.mozilla.Common; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
57 import dwt.internal.mozilla.nsEmbedString; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
58 import dwt.internal.mozilla.nsIAppShell; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
59 import dwt.internal.mozilla.nsIBaseWindow; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
60 import dwt.internal.mozilla.nsICategoryManager; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
61 import dwt.internal.mozilla.nsIComponentManager; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
62 import dwt.internal.mozilla.nsIComponentRegistrar; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
63 import dwt.internal.mozilla.nsIContextMenuListener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
64 import dwt.internal.mozilla.nsICookie; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
65 import dwt.internal.mozilla.nsICookieManager; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
66 import dwt.internal.mozilla.nsID; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
67 import dwt.internal.mozilla.nsIDOMNode; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
68 import dwt.internal.mozilla.nsIDOMEvent; |
340 | 69 import dwt.internal.mozilla.nsIDOMEventListener; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
70 import dwt.internal.mozilla.nsIDOMEventTarget; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
71 import dwt.internal.mozilla.nsIDOMKeyEvent; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
72 import dwt.internal.mozilla.nsIDOMMouseEvent; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
73 import dwt.internal.mozilla.nsIDOMSerializer; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
74 import dwt.internal.mozilla.nsIDOMSerializer_1_7; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
75 import dwt.internal.mozilla.nsIDOMWindow; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
76 import dwt.internal.mozilla.nsIDOMWindowCollection; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
77 import dwt.internal.mozilla.nsIDOMDocument; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
78 import dwt.internal.mozilla.nsIDirectoryService; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
79 import dwt.internal.mozilla.nsIDocShell; |
340 | 80 //import dwt.internal.mozilla.nsIDocShell_1_8; |
81 //import dwt.internal.mozilla.nsIDocShell_1_9; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
82 import dwt.internal.mozilla.nsIEmbeddingSiteWindow; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
83 import dwt.internal.mozilla.nsIFile; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
84 import dwt.internal.mozilla.nsIFactory; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
85 import dwt.internal.mozilla.nsIIOService; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
86 import dwt.internal.mozilla.nsIInterfaceRequestor; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
87 import dwt.internal.mozilla.nsIJSContextStack; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
88 import dwt.internal.mozilla.nsILocalFile; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
89 import dwt.internal.mozilla.nsIObserverService; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
90 import dwt.internal.mozilla.nsIPrefBranch; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
91 import dwt.internal.mozilla.nsIPrefLocalizedString; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
92 import dwt.internal.mozilla.nsIPrefService; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
93 import dwt.internal.mozilla.nsIProperties; |
286 | 94 import dwt.internal.mozilla.nsIRequest; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
95 import dwt.internal.mozilla.nsIServiceManager; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
96 import dwt.internal.mozilla.nsISimpleEnumerator; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
97 import dwt.internal.mozilla.nsIStreamListener; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
98 import dwt.internal.mozilla.nsISupports; |
340 | 99 //import dwt.internal.mozilla.nsISupportsWeakReference; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
100 import dwt.internal.mozilla.nsITooltipListener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
101 import dwt.internal.mozilla.nsIURI; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
102 import dwt.internal.mozilla.nsIURIContentListener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
103 import dwt.internal.mozilla.nsIWeakReference; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
104 import dwt.internal.mozilla.nsIWebBrowser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
105 import dwt.internal.mozilla.nsIWebBrowserChrome; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
106 import dwt.internal.mozilla.nsIWebBrowserChromeFocus; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
107 import dwt.internal.mozilla.nsIWebBrowserFocus; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
108 import dwt.internal.mozilla.nsIWebNavigation; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
109 import dwt.internal.mozilla.nsIWebNavigationInfo; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
110 import dwt.internal.mozilla.nsIWebProgress; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
111 import dwt.internal.mozilla.nsIWebProgressListener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
112 import dwt.internal.mozilla.nsIWindowWatcher; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
113 import dwt.internal.mozilla.nsIWindowCreator; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
114 import dwt.internal.mozilla.nsStringAPI; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
115 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
116 import dwt.layout.FillLayout; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
117 import dwt.widgets.Composite; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
118 import dwt.widgets.Display; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
119 import dwt.widgets.Event; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
120 import dwt.widgets.Label; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
121 import dwt.widgets.Listener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
122 import dwt.widgets.Menu; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
123 import dwt.widgets.Shell; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
124 import dwt.widgets.Control; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
125 |
286 | 126 class Mozilla : WebBrowser, |
127 nsIWeakReference, | |
128 nsIWebProgressListener, | |
129 nsIWebBrowserChrome, | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
130 nsIWebBrowserChromeFocus, |
286 | 131 nsIEmbeddingSiteWindow, |
132 nsIInterfaceRequestor, | |
133 nsISupportsWeakReference, | |
134 nsIContextMenuListener, | |
340 | 135 nsIURIContentListener, |
286 | 136 nsITooltipListener, |
340 | 137 nsIDOMEventListener { |
286 | 138 |
139 GtkWidget* embedHandle; | |
140 nsIWebBrowser webBrowser; | |
141 Object webBrowserObject; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
142 MozillaDelegate mozDelegate; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
143 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
144 int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
145 int refCount, lastKeyCode, lastCharCode; |
286 | 146 nsIRequest request; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
147 Point location, size; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
148 bool visible, isChild, ignoreDispose, awaitingNavigate; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
149 Shell tip = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
150 Listener listener; |
286 | 151 nsIDOMWindow[] unhookedDOMWindows; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
152 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
153 static nsIAppShell AppShell; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
154 static AppFileLocProvider LocationProvider; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
155 static WindowCreator2 WindowCreator; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
156 static int BrowserCount; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
157 static bool Initialized, IsPre_1_8, PerformedVersionCheck, XPCOMWasGlued, XPCOMInitWasGlued; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
158 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
159 /* XULRunner detect constants */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
160 static final String GRERANGE_LOWER = "1.8.1.2"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
161 static final String GRERANGE_LOWER_FALLBACK = "1.8"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
162 static final bool LowerRangeInclusive = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
163 static final String GRERANGE_UPPER = "1.9.*"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
164 static final bool UpperRangeInclusive = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
165 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
166 static final int MAX_PORT = 65535; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
167 static final String SEPARATOR_OS = System.getProperty ("file.separator"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
168 static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
169 static final String DISPOSE_LISTENER_HOOKED = "dwt.browser.Mozilla.disposeListenerHooked"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
170 static final String PREFIX_JAVASCRIPT = "javascript:"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
171 static final String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
172 static final String PREFERENCE_DISABLEOPENDURINGLOAD = "dom.disable_open_during_load"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
173 static final String PREFERENCE_DISABLEWINDOWSTATUSCHANGE = "dom.disable_window_status_change"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
174 static final String PREFERENCE_LANGUAGES = "intl.accept_languages"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
175 static final String PREFERENCE_PROXYHOST_FTP = "network.proxy.ftp"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
176 static final String PREFERENCE_PROXYPORT_FTP = "network.proxy.ftp_port"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
177 static final String PREFERENCE_PROXYHOST_HTTP = "network.proxy.http"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
178 static final String PREFERENCE_PROXYPORT_HTTP = "network.proxy.http_port"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
179 static final String PREFERENCE_PROXYHOST_SSL = "network.proxy.ssl"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
180 static final String PREFERENCE_PROXYPORT_SSL = "network.proxy.ssl_port"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
181 static final String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
182 static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
183 static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$ |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
184 static String PROFILE_DIR; //= SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; //$NON-NLS-1$ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
185 static final String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
186 static final String PROPERTY_PROXYPORT = "network.proxy_port"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
187 static final String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
188 static final String SEPARATOR_LOCALE = "-"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
189 static final String SHUTDOWN_PERSIST = "shutdown-persist"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
190 static final String STARTUP = "startup"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
191 static final String TOKENIZER_LOCALE = ","; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
192 static final String URI_FROMMEMORY = "file:///"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
193 static final String XULRUNNER_PATH = "dwt.browser.XULRunnerPath"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
194 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
195 // TEMPORARY CODE |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
196 static final String GRE_INITIALIZED = "dwt.browser.XULRunnerInitialized"; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
197 |
286 | 198 static this () { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
199 PROFILE_DIR = SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; |
340 | 200 MozillaClearSessions = new class() Runnable { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
201 public void run () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
202 if (!Initialized) return; |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
203 nsIServiceManager serviceManager; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
204 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
205 if (rc !is XPCOM.NS_OK) error (rc); |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
206 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
207 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
208 //result[0] = 0; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
209 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_COOKIEMANAGER_CONTRACTID, true); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
210 nsICookieManager manager; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
211 rc = serviceManager.GetServiceByContractID (XPCOM.NS_COOKIEMANAGER_CONTRACTID.ptr, &nsICookieManager.IID, cast(void**)&manager); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
212 if (rc !is XPCOM.NS_OK) error (rc); |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
213 if (manager is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
214 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
215 |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
216 //nsICookieManager manager = new nsICookieManager (result[0]); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
217 //result[0] = 0; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
218 nsISimpleEnumerator enumerator; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
219 rc = manager.GetEnumerator (&enumerator); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
220 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
221 manager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
222 |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
223 //nsISimpleEnumerator enumerator = new nsISimpleEnumerator (result[0]); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
224 PRBool moreElements; /* PRBool */ |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
225 rc = enumerator.HasMoreElements (&moreElements); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
226 if (rc !is XPCOM.NS_OK) error (rc); |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
227 while (moreElements !is 0) { |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
228 //result[0] = 0; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
229 nsICookie cookie; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
230 rc = enumerator.GetNext (cast(nsISupports*)&cookie); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
231 if (rc !is XPCOM.NS_OK) error (rc); |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
232 //nsICookie cookie = new nsICookie (result[0]); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
233 PRUint64 expires; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
234 rc = cookie.GetExpires (&expires); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
235 if (expires is 0) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
236 /* indicates a session cookie */ |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
237 scope auto domain = new nsEmbedCString; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
238 scope auto name = new nsEmbedCString; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
239 scope auto path = new nsEmbedCString; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
240 cookie.GetHost (cast(nsACString*)domain); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
241 cookie.GetName (cast(nsACString*)name); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
242 cookie.GetPath (cast(nsACString*)path); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
243 rc = manager.Remove (cast(nsACString*)domain, cast(nsACString*)name, cast(nsACString*)path, 0); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
244 //XPCOM.nsEmbedCString_delete (domain); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
245 //XPCOM.nsEmbedCString_delete (name); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
246 //XPCOM.nsEmbedCString_delete (path); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
247 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
248 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
249 cookie.Release (); |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
250 rc = enumerator.HasMoreElements (&moreElements); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
251 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
252 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
253 enumerator.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
254 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
255 }; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
256 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
257 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
258 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
259 public void create (Composite parent, int style) { |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
260 mozDelegate = new MozillaDelegate (super.browser); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
261 Display display = parent.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
262 |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
263 //int /*long*/[] result = new int /*long*/[1]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
264 if (!Initialized) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
265 bool initLoaded = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
266 bool IsXULRunner = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
267 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
268 String greInitialized = System.getProperty (GRE_INITIALIZED); |
340 | 269 if ("true" == greInitialized) { //$NON-NLS-1$ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
270 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
271 * Another browser has already initialized xulrunner in this process, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
272 * so just bind to it instead of trying to initialize a new one. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
273 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
274 Initialized = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
275 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
276 String mozillaPath = System.getProperty (XULRUNNER_PATH); |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
277 if (mozillaPath is null) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
278 // we don't need to load an initial library in DWT, so set to "true" |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
279 initLoaded = true; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
280 /+ |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
281 if (mozillaPath is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
282 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
283 String libName = mozDelegate.getSWTInitLibraryName (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
284 Library.loadLibrary (libName); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
285 initLoaded = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
286 } catch (UnsatisfiedLinkError e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
287 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
288 * If this library failed to load then do not attempt to detect a |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
289 * xulrunner to use. The Browser may still be usable if MOZILLA_FIVE_HOME |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
290 * points at a GRE. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
291 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
292 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
293 +/ |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
294 } else { |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
295 mozillaPath ~= SEPARATOR_OS ~ mozDelegate.getLibraryName (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
296 IsXULRunner = true; |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
297 } |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
298 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
299 if (initLoaded) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
300 /* attempt to discover a XULRunner to use as the GRE */ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
301 XPCOMInit.GREVersionRange range; |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
302 //byte[] bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER, true); |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
303 //int /*long*/ lower = C.malloc (bytes.length); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
304 //C.memmove (lower, bytes, bytes.length); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
305 range.lower = GRERANGE_LOWER.ptr; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
306 range.lowerInclusive = LowerRangeInclusive; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
307 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
308 //bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_UPPER, true); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
309 //int /*long*/ upper = C.malloc (bytes.length); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
310 //C.memmove (upper, bytes, bytes.length); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
311 range.upper = GRERANGE_UPPER.ptr; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
312 range.upperInclusive = UpperRangeInclusive; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
313 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
314 //int length = XPCOMInit.PATH_MAX; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
315 //int /*long*/ greBuffer = C.malloc (length); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
316 char[] greBuffer = new char[XPCOMInit.PATH_MAX]; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
317 //int /*long*/ propertiesPtr = C.malloc (2 * C.PTR_SIZEOF); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
318 int rc = XPCOMInit.GRE_GetGREPathWithProperties (&range, 1, null, 0, greBuffer.ptr, greBuffer.length); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
319 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
320 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
321 * A XULRunner was not found that supports wrapping of XPCOM handles as JavaXPCOM objects. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
322 * Drop the lower version bound and try to detect an earlier XULRunner installation. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
323 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
324 if (rc !is XPCOM.NS_OK) { |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
325 //C.free (lower); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
326 //bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER_FALLBACK, true); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
327 //lower = C.malloc (bytes.length); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
328 //C.memmove (lower, bytes, bytes.length); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
329 range.lower = GRERANGE_LOWER_FALLBACK.ptr; |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
330 rc = XPCOMInit.GRE_GetGREPathWithProperties (&range, 1, null, 0, greBuffer.ptr, greBuffer.length); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
331 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
332 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
333 //C.free (lower); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
334 //C.free (upper); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
335 //C.free (propertiesPtr); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
336 if (rc is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
337 /* indicates that a XULRunner was found */ |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
338 //length = C.strlen (greBuffer); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
339 //bytes = new byte[length]; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
340 //C.memmove (bytes, greBuffer, length); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
341 //mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, bytes)); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
342 mozillaPath = greBuffer; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
343 IsXULRunner = mozillaPath.length > 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
344 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
345 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
346 * Test whether the detected XULRunner can be used as the GRE before loading swt's |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
347 * XULRunner library. If it cannot be used then fall back to attempting to use |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
348 * the GRE pointed to by MOZILLA_FIVE_HOME. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
349 * |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
350 * One case where this will fail is attempting to use a 64-bit xulrunner while swt |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
351 * is running in 32-bit mode, or vice versa. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
352 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
353 if (IsXULRunner) { |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
354 // byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
355 rc = XPCOMInit.XPCOMGlueStartup (mozillaPath.ptr); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
356 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
357 IsXULRunner = false; /* failed */ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
358 //mozillaPath = mozillaPath[0 .. locatePrior( mozillaPath, SEPARATOR_OS )]; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
359 mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS)); |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
360 if (Device.DEBUG) Cerr ("cannot use detected XULRunner: ") (mozillaPath).newline; //$NON-NLS-1$ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
361 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
362 XPCOMInitWasGlued = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
363 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
364 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
365 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
366 //C.free (greBuffer); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
367 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
368 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
369 if (IsXULRunner) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
370 if (Device.DEBUG) Cerr ("XULRunner path: ") (mozillaPath).newline; //$NON-NLS-1$ |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
371 /+ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
372 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
373 Library.loadLibrary ("swt-xulrunner"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
374 } catch (UnsatisfiedLinkError e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
375 DWT.error (DWT.ERROR_NO_HANDLES, e); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
376 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
377 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
378 byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true); |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
379 int rc = XPCOM.XPCOMGlueStartup (path); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
380 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
381 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
382 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
383 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
384 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
385 +/ // No need for double layer initialization in DWT; XPCOMInit was glued |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
386 // At this stage we know that XULRunner is available, but we don't know |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
387 // TODO: determine if |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
388 XPCOMWasGlued = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
389 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
390 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
391 * Remove the trailing xpcom lib name from mozillaPath because the |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
392 * Mozilla.initialize and NS_InitXPCOM2 invocations require a directory name only. |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
393 */ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
394 mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS)); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
395 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
396 if ((style & DWT.MOZILLA) !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
397 browser.dispose (); |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
398 String errorString = (mozillaPath !is null && mozillaPath.length > 0) ? |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
399 " [Failed to use detected XULRunner: " ~ mozillaPath ~ "]" : |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
400 " [Could not detect registered XULRunner to use]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
401 DWT.error (DWT.ERROR_NO_HANDLES, null, errorString); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
402 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
403 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
404 /* attempt to use the GRE pointed at by MOZILLA_FIVE_HOME */ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
405 auto mozFiveHome = Environment.get(XPCOM.MOZILLA_FIVE_HOME); |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
406 if (mozFiveHome !is null) { |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
407 //int length = C.strlen (ptr); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
408 //byte[] buffer = new byte[length]; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
409 //C.memmove (buffer, ptr, length); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
410 mozillaPath = mozFiveHome; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
411 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
412 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
413 DWT.error (DWT.ERROR_NO_HANDLES, null, " [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
414 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
415 if (Device.DEBUG) Cerr ("Mozilla path: ") (mozillaPath).newline; //$NON-NLS-1$ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
416 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
417 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
418 * Note. Embedding a Mozilla GTK1.2 causes a crash. The workaround |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
419 * is to check the version of GTK used by Mozilla by looking for |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
420 * the libwidget_gtk.so library used by Mozilla GTK1.2. Mozilla GTK2 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
421 * uses the libwidget_gtk2.so library. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
422 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
423 if (Compatibility.fileExists (mozillaPath, "components/libwidget_gtk.so")) { //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
424 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
425 DWT.error (DWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
426 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
427 /+ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
428 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
429 Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
430 } catch (UnsatisfiedLinkError e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
431 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
432 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
433 * The initial loadLibrary attempt may have failed as a result of the user's |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
434 * system not having libstdc++.so.6 installed, so try to load the alternate |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
435 * swt mozilla library that depends on libswtc++.so.5 instead. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
436 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
437 Library.loadLibrary ("swt-mozilla-gcc3"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
438 } catch (UnsatisfiedLinkError ex) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
439 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
440 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
441 * Print the error from the first failed attempt since at this point it's |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
442 * known that the failure was not due to the libstdc++.so.6 dependency. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
443 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
444 DWT.error (DWT.ERROR_NO_HANDLES, e, " [MOZILLA_FIVE_HOME='" + mozillaPath + "']"); //$NON-NLS-1$ //$NON-NLS-2$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
445 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
446 } |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
447 +/ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
448 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
449 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
450 if (!Initialized) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
451 nsILocalFile localFile; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
452 scope auto pathString = new nsEmbedString (mozillaPath.toString16()); |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
453 nsresult rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
454 //pathString.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
455 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
456 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
457 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
458 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
459 if (localFile is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
460 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
461 error (XPCOM.NS_ERROR_NULL_POINTER); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
462 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
463 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
464 LocationProvider = new AppFileLocProvider (mozillaPath); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
465 LocationProvider.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
466 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
467 //nsIFile localFile = new nsILocalFile (retVal[0]); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
468 nsIDirectoryServiceProvider directoryServiceProvider; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
469 rc = LocationProvider.QueryInterface( &nsIDirectoryServiceProvider.IID, cast(void**)&directoryServiceProvider); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
470 if (rc !is XPCOM.NS_OK) { |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
471 browser.dispose(); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
472 error(rc); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
473 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
474 rc = XPCOM.NS_InitXPCOM2 (null, cast(nsIFile)localFile, directoryServiceProvider); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
475 localFile.Release (); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
476 LocationProvider.Release(); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
477 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
478 browser.dispose (); |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
479 DWT.error (DWT.ERROR_NO_HANDLES, null, Format(" [MOZILLA_FIVE_HOME may not point at an embeddable GRE] [NS_InitEmbedding {0} error {1} ] ", mozillaPath, rc ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
480 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
481 System.setProperty (GRE_INITIALIZED, "true"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
482 if (IsXULRunner) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
483 System.setProperty (XULRUNNER_PATH, mozillaPath); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
484 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
485 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
486 /+ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
487 /* If JavaXPCOM is detected then attempt to initialize it with the XULRunner being used */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
488 if (IsXULRunner) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
489 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
490 Class clazz = Class.forName ("org.mozilla.xpcom.Mozilla"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
491 Method method = clazz.getMethod ("getInstance", new Class[0]); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
492 Object mozilla = method.invoke (null, new Object[0]); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
493 method = clazz.getMethod ("getComponentManager", new Class[0]); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
494 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
495 method.invoke (mozilla, new Object[0]); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
496 } catch (InvocationTargetException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
497 /* indicates that JavaXPCOM has not been initialized yet */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
498 Class fileClass = Class.forName ("java.io.File"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
499 method = clazz.getMethod ("initialize", new Class[] {fileClass}); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
500 Constructor constructor = fileClass.getDeclaredConstructor (new Class[] {String.class}); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
501 Object argument = constructor.newInstance (new Object[] {mozillaPath}); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
502 method.invoke (mozilla, new Object[] {argument}); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
503 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
504 } catch (ClassNotFoundException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
505 /* JavaXPCOM is not on the classpath */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
506 } catch (NoSuchMethodException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
507 /* the JavaXPCOM on the classpath does not implement initialize() */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
508 } catch (IllegalArgumentException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
509 } catch (IllegalAccessException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
510 } catch (InvocationTargetException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
511 } catch (InstantiationException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
512 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
513 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
514 +/ |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
515 nsIComponentManager componentManager; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
516 int rc = XPCOM.NS_GetComponentManager (&componentManager); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
517 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
518 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
519 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
520 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
521 if (componentManager is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
522 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
523 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
524 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
525 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
526 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
527 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
528 if (mozDelegate.needsSpinup ()) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
529 /* nsIAppShell is discontinued as of xulrunner 1.9, so do not fail if it is not found */ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
530 rc = componentManager.CreateInstance (&XPCOM.NS_APPSHELL_CID, null, &nsIAppShell.IID, cast(void**)&AppShell); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
531 if (rc !is XPCOM.NS_ERROR_NO_INTERFACE) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
532 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
533 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
534 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
535 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
536 if (AppShell is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
537 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
538 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
539 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
540 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
541 //AppShell = new nsIAppShell (result[0]); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
542 rc = AppShell.Create (null, null); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
543 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
544 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
545 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
546 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
547 rc = AppShell.Spinup (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
548 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
549 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
550 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
551 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
552 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
553 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
554 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
555 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
556 WindowCreator = new WindowCreator2; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
557 WindowCreator.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
558 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
559 nsIServiceManager serviceManager; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
560 rc = XPCOM.NS_GetServiceManager (&serviceManager); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
561 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
562 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
563 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
564 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
565 if (serviceManager is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
566 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
567 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
568 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
569 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
570 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
571 //result[0] = 0; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
572 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
573 nsIWindowWatcher windowWatcher; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
574 rc = serviceManager.GetServiceByContractID (XPCOM.NS_WINDOWWATCHER_CONTRACTID.ptr, &nsIWindowWatcher.IID, cast(void**)&windowWatcher); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
575 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
576 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
577 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
578 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
579 if (windowWatcher is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
580 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
581 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
582 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
583 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
584 //nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
585 //result[0] = 0; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
586 rc = windowWatcher.SetWindowCreator (cast(nsIWindowCreator)WindowCreator); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
587 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
588 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
589 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
590 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
591 windowWatcher.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
592 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
593 /* compute the profile directory and set it on the AppFileLocProvider */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
594 if (LocationProvider !is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
595 nsIDirectoryService directoryService; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
596 //byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
597 rc = serviceManager.GetServiceByContractID (XPCOM.NS_DIRECTORYSERVICE_CONTRACTID.ptr, &nsIDirectoryService.IID, cast(void**)&directoryService); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
598 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
599 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
600 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
601 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
602 if (directoryService is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
603 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
604 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
605 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
606 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
607 //nsIDirectoryService directoryService = new nsIDirectoryService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
608 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
609 nsIProperties properties; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
610 rc = directoryService.QueryInterface (&nsIProperties.IID, cast(void**)&properties); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
611 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
612 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
613 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
614 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
615 if (properties is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
616 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
617 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
618 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
619 directoryService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
620 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
621 //nsIProperties properties = new nsIProperties (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
622 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
623 //buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_APP_APPLICATION_REGISTRY_DIR, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
624 nsIFile profileDir; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
625 rc = properties.Get (XPCOM.NS_APP_APPLICATION_REGISTRY_DIR.ptr, &nsIFile.IID, cast(void**)&profileDir); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
626 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
627 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
628 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
629 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
630 if (profileDir is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
631 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
632 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
633 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
634 properties.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
635 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
636 //nsIFile profileDir = new nsIFile (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
637 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
638 scope auto path = new nsEmbedCString; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
639 rc = profileDir.GetNativePath (cast(nsACString*)path); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
640 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
641 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
642 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
643 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
644 //int length = XPCOM.nsEmbedCString_Length (path); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
645 //int /*long*/ ptr = XPCOM.nsEmbedCString_get (path); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
646 //buffer = new byte [length]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
647 //XPCOM.memmove (buffer, ptr, length); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
648 String profilePath = path.toString() ~ PROFILE_DIR; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
649 LocationProvider.setProfilePath (profilePath); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
650 LocationProvider.isXULRunner = IsXULRunner; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
651 //XPCOM.nsEmbedCString_delete (path); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
652 profileDir.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
653 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
654 /* notify observers of a new profile directory being used */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
655 //buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
656 nsIObserverService observerService; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
657 rc = serviceManager.GetServiceByContractID (XPCOM.NS_OBSERVER_CONTRACTID.ptr, &nsIObserverService.IID, cast(void**)&observerService); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
658 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
659 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
660 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
661 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
662 if (observerService is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
663 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
664 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
665 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
666 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
667 //nsIObserverService observerService = new nsIObserverService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
668 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
669 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_DO_CHANGE, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
670 //length = STARTUP.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
671 //char[] chars = new char [length + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
672 //STARTUP.getChars (0, length, chars, 0); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
673 wchar* chars = STARTUP.toString16().toString16z(); |
335 | 674 rc = observerService.NotifyObservers (null, PROFILE_DO_CHANGE.ptr, chars); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
675 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
676 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
677 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
678 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
679 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_AFTER_CHANGE, true); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
680 rc = observerService.NotifyObservers (null, PROFILE_AFTER_CHANGE.ptr, chars); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
681 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
682 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
683 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
684 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
685 observerService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
686 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
687 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
688 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
689 * As a result of using a common profile the user cannot change their locale |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
690 * and charset. The fix for this is to set mozilla's locale and charset |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
691 * preference values according to the user's current locale and charset. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
692 */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
693 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFSERVICE_CONTRACTID, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
694 nsIPrefService prefService; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
695 rc = serviceManager.GetServiceByContractID (XPCOM.NS_PREFSERVICE_CONTRACTID.ptr, &nsIPrefService.IID, cast(void**)&prefService); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
696 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
697 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
698 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
699 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
700 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
701 if (serviceManager is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
702 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
703 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
704 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
705 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
706 //nsIPrefService prefService = new nsIPrefService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
707 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
708 char[1] buffer = new char[1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
709 nsIPrefBranch prefBranch; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
710 rc = prefService.GetBranch (buffer.ptr, &prefBranch); /* empty buffer denotes root preference level */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
711 prefService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
712 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
713 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
714 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
715 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
716 if (prefBranch is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
717 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
718 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
719 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
720 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
721 //nsIPrefBranch prefBranch = new nsIPrefBranch (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
722 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
723 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
724 /* get Mozilla's current locale preference value */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
725 String prefLocales = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
726 nsIPrefLocalizedString localizedString = null; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
727 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_LANGUAGES, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
728 rc = prefBranch.GetComplexValue (PREFERENCE_LANGUAGES.ptr, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
729 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
730 * Feature of Debian. For some reason attempting to query for the current locale |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
731 * preference fails on Debian. The workaround for this is to assume a value of |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
732 * "en-us,en" since this is typically the default value when mozilla is used without |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
733 * a profile. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
734 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
735 if (rc !is XPCOM.NS_OK) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
736 prefLocales = "en-us,en" ~ TOKENIZER_LOCALE; //$NON-NLS-1$ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
737 } else { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
738 if (localizedString is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
739 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
740 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
741 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
742 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
743 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
744 PRUnichar* tmpChars; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
745 rc = localizedString.ToString (&tmpChars); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
746 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
747 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
748 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
749 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
750 if (tmpChars is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
751 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
752 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
753 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
754 int span = XPCOM.strlen_PRUnichar (tmpChars); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
755 //char[] dest = new char[length]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
756 //XPCOM.memmove (dest, result[0], length * 2); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
757 prefLocales = Utf.toString(tmpChars[0 .. span]) ~ TOKENIZER_LOCALE; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
758 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
759 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
760 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
761 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
762 * construct the new locale preference value by prepending the |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
763 * user's current locale and language to the original value |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
764 */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
765 //Culture locale = Culture.current; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
766 //Region region = Region.current; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
767 //Locale locale = Locale.getDefault (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
768 String language = Culture.current.twoLetterLanguageName (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
769 String country = Region.current.twoLetterRegionName (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
770 String stringBuffer = language.dup; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
771 stringBuffer ~= SEPARATOR_LOCALE; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
772 stringBuffer ~= country.toLowerCase (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
773 stringBuffer ~= TOKENIZER_LOCALE; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
774 stringBuffer ~= language; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
775 stringBuffer ~= TOKENIZER_LOCALE; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
776 String newLocales = stringBuffer.dup; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
777 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
778 int start, end = -1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
779 do { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
780 start = end + 1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
781 end = prefLocales.indexOf (TOKENIZER_LOCALE, start); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
782 String token; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
783 if (end is -1) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
784 token = prefLocales.substring (start); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
785 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
786 token = prefLocales.substring (start, end); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
787 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
788 if (token.length () > 0) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
789 token = (token ~ TOKENIZER_LOCALE).trim (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
790 /* ensure that duplicate locale values are not added */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
791 if (newLocales.indexOf (token) is -1) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
792 stringBuffer ~= token; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
793 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
794 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
795 } while (end !is -1); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
796 newLocales[] = stringBuffer[]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
797 if (!newLocales.equals (prefLocales)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
798 /* write the new locale value */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
799 newLocales = newLocales.substring (0, newLocales.length () - TOKENIZER_LOCALE.length ()); /* remove trailing tokenizer */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
800 //int span = newLocales.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
801 //char[] charBuffer = new char[span + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
802 //newLocales.getChars (0, span, charBuffer, 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
803 if (localizedString is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
804 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
805 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
806 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
807 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
808 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
809 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
810 if (localizedString is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
811 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
812 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
813 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
814 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
815 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
816 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
817 localizedString.SetDataWithLength (newLocales.length, newLocales.toString16().toString16z()); |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
818 rc = prefBranch.SetComplexValue (PREFERENCE_LANGUAGES.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
819 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
820 if (localizedString !is null) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
821 localizedString.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
822 localizedString = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
823 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
824 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
825 /* get Mozilla's current charset preference value */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
826 String prefCharset = null; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
827 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_CHARSET, true); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
828 rc = prefBranch.GetComplexValue (PREFERENCE_CHARSET.ptr, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
829 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
830 * Feature of Debian. For some reason attempting to query for the current charset |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
831 * preference fails on Debian. The workaround for this is to assume a value of |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
832 * "ISO-8859-1" since this is typically the default value when mozilla is used |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
833 * without a profile. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
834 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
835 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
836 prefCharset = "ISO-8859-1"; //$NON_NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
837 } else { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
838 if (localizedString is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
839 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
840 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
841 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
842 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
843 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
844 PRUnichar* tmpChar; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
845 rc = localizedString.ToString (&tmpChar); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
846 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
847 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
848 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
849 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
850 if (tmpChar is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
851 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
852 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
853 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
854 int span = XPCOM.strlen_PRUnichar (tmpChar); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
855 //char[] dest = new char[length]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
856 //XPCOM.memmove (dest, result[0], length * 2); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
857 prefCharset = Utf.toString(tmpChar[0 .. span]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
858 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
859 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
860 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
861 String newCharset = System.getProperty ("file.encoding"); // $NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
862 if (!newCharset.equals (prefCharset)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
863 /* write the new charset value */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
864 //int length = newCharset.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
865 //char[] charBuffer = new char[length + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
866 //newCharset.getChars (0, length, charBuffer, 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
867 if (localizedString is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
868 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
869 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
870 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
871 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
872 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
873 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
874 if (localizedString is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
875 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
876 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
877 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
878 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
879 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
880 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
881 localizedString.SetDataWithLength (newCharset.length, newCharset.toString16().toString16z()); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
882 rc = prefBranch.SetComplexValue (PREFERENCE_CHARSET.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
883 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
884 if (localizedString !is null) localizedString.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
885 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
886 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
887 * Check for proxy values set as documented java properties and update mozilla's |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
888 * preferences with these values if needed. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
889 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
890 String proxyHost = System.getProperty (PROPERTY_PROXYHOST); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
891 String proxyPortString = System.getProperty (PROPERTY_PROXYPORT); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
892 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
893 int port = -1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
894 if (proxyPortString !is null) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
895 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
896 int value = Integer.valueOf (proxyPortString).intValue (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
897 if (0 <= value && value <= MAX_PORT) port = value; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
898 } catch (NumberFormatException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
899 /* do nothing, java property has non-integer value */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
900 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
901 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
902 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
903 if (proxyHost !is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
904 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
905 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
906 if (rc !is XPCOM.NS_OK) error (rc); |
340 | 907 if (localizedString is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
908 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
909 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
910 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
911 //int length = proxyHost.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
912 //char[] charBuffer = new char[length + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
913 //proxyHost.getChars (0, length, charBuffer, 0); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
914 rc = localizedString.SetDataWithLength (proxyHost.length, proxyHost.toString16().toString16z()); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
915 if (rc !is XPCOM.NS_OK) error (rc); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
916 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_FTP, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
917 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_FTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
918 if (rc !is XPCOM.NS_OK) error (rc); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
919 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_HTTP, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
920 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_HTTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
921 if (rc !is XPCOM.NS_OK) error (rc); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
922 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_SSL, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
923 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_SSL.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
924 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
925 localizedString.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
926 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
927 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
928 if (port !is -1) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
929 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_FTP, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
930 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_FTP.ptr, port); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
931 if (rc !is XPCOM.NS_OK) error (rc); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
932 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_HTTP, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
933 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_HTTP.ptr, port); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
934 if (rc !is XPCOM.NS_OK) error (rc); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
935 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_SSL, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
936 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_SSL.ptr, port); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
937 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
938 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
939 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
940 if (proxyHost !is null || port !is -1) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
941 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYTYPE, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
942 rc = prefBranch.SetIntPref (PREFERENCE_PROXYTYPE.ptr, 1); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
943 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
944 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
945 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
946 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
947 * Ensure that windows that are shown during page loads are not blocked. Firefox may |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
948 * try to block these by default since such windows are often unwelcome, but this |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
949 * assumption should not be made in the Browser's context. Since the Browser client |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
950 * is responsible for creating the new Browser and Shell in an OpenWindowListener, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
951 * they should decide whether the new window is unwelcome or not and act accordingly. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
952 */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
953 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEOPENDURINGLOAD, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
954 rc = prefBranch.SetBoolPref (PREFERENCE_DISABLEOPENDURINGLOAD.ptr, 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
955 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
956 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
957 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
958 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
959 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
960 /* Ensure that the status text can be set through means like javascript */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
961 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEWINDOWSTATUSCHANGE, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
962 rc = prefBranch.SetBoolPref (PREFERENCE_DISABLEWINDOWSTATUSCHANGE.ptr, 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
963 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
964 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
965 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
966 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
967 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
968 prefBranch.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
969 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
970 PromptService2Factory factory = new PromptService2Factory (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
971 factory.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
972 |
335 | 973 nsIComponentRegistrar componentRegistrar; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
974 rc = componentManager.QueryInterface (&nsIComponentRegistrar.IID, cast(void**)&componentRegistrar); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
975 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
976 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
977 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
978 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
979 if (componentRegistrar is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
980 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
981 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
982 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
983 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
984 //nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
985 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
986 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true); |
335 | 987 String aClassName = "Prompt Service"; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
988 //byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "Prompt Service", true); //$NON-NLS-1$ |
335 | 989 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
990 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_PROMPTSERVICE_CID, aClassName.ptr, XPCOM.NS_PROMPTSERVICE_CONTRACTID.ptr, cast(nsIFactory)factory); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
991 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
992 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
993 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
994 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
995 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
996 factory.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
997 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
998 HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
999 dialogFactory.AddRef (); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1000 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true); |
335 | 1001 aClassName = "Helper App Launcher Dialog"; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1002 //aClassName = MozillaDelegate.wcsToMbcs (null, "Helper App Launcher Dialog", true); //$NON-NLS-1$ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1003 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName.ptr, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID.ptr, cast(nsIFactory)dialogFactory); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1004 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1005 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1006 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1007 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1008 dialogFactory.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1009 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1010 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1011 * This Download factory will be used if the GRE version is < 1.8. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1012 * If the GRE version is 1.8.x then the Download factory that is registered later for |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1013 * contract "Transfer" will be used. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1014 * If the GRE version is >= 1.9 then no Download factory is registered because this |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1015 * functionality is provided by the GRE. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1016 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1017 DownloadFactory downloadFactory = new DownloadFactory (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1018 downloadFactory.AddRef (); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1019 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOWNLOAD_CONTRACTID, true); |
335 | 1020 aClassName = "Download"; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1021 //aClassName = MozillaDelegate.wcsToMbcs (null, "Download", true); //$NON-NLS-1$ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1022 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_DOWNLOAD_CID, aClassName.ptr, XPCOM.NS_DOWNLOAD_CONTRACTID.ptr, cast(nsIFactory)downloadFactory); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1023 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1024 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1025 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1026 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1027 downloadFactory.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1028 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1029 FilePickerFactory pickerFactory = IsXULRunner ? new FilePickerFactory_1_8 () : new FilePickerFactory (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1030 pickerFactory.AddRef (); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1031 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_FILEPICKER_CONTRACTID, true); |
335 | 1032 aClassName = "FilePicker"; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1033 //aClassName = MozillaDelegate.wcsToMbcs (null, "FilePicker", true); //$NON-NLS-1$ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1034 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_FILEPICKER_CID, aClassName.ptr, XPCOM.NS_FILEPICKER_CONTRACTID.ptr, cast(nsIFactory)pickerFactory); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1035 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1036 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1037 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1038 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1039 pickerFactory.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1040 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1041 componentRegistrar.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1042 componentManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1043 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1044 Initialized = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1045 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1046 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1047 if (display.getData (DISPOSE_LISTENER_HOOKED) is null) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1048 display.setData (DISPOSE_LISTENER_HOOKED, stringcast(DISPOSE_LISTENER_HOOKED)); |
340 | 1049 display.addListener (DWT.Dispose, new class() Listener { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1050 public void handleEvent (Event event) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1051 if (BrowserCount > 0) return; /* another display is still active */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1052 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1053 nsIServiceManager serviceManager; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1054 //int /*long*/[] result = new int /*long*/[1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1055 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1056 if (rc !is XPCOM.NS_OK) error (rc); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1057 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1058 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1059 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1060 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1061 //byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1062 nsIObserverService observerService; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1063 rc = serviceManager.GetServiceByContractID (XPCOM.NS_OBSERVER_CONTRACTID.ptr, &nsIObserverService.IID, cast(void**)&observerService); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1064 if (rc !is XPCOM.NS_OK) error (rc); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1065 if (observerService is null) error (XPCOM.NS_NOINTERFACE); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1066 |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1067 //nsIObserverService observerService = new nsIObserverService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1068 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1069 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_BEFORE_CHANGE, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1070 //int length = SHUTDOWN_PERSIST.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1071 //char[] chars = new char [length + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1072 //SHUTDOWN_PERSIST.getChars (0, length, chars, 0); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1073 rc = observerService.NotifyObservers (null, PROFILE_BEFORE_CHANGE.ptr, SHUTDOWN_PERSIST.toString16().toString16z()); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1074 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1075 observerService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1076 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1077 if (LocationProvider !is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1078 String prefsLocation = LocationProvider.profilePath ~ AppFileLocProvider.PREFERENCES_FILE; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1079 scope auto pathString = new nsEmbedString (prefsLocation.toString16()); |
335 | 1080 nsILocalFile localFile; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1081 rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1082 if (rc !is XPCOM.NS_OK) Mozilla.error (rc); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1083 if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1084 //pathString.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1085 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1086 //nsILocalFile localFile = new nsILocalFile (result [0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1087 //result[0] = 0; |
335 | 1088 nsIFile prefFile; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1089 rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&prefFile); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1090 if (rc !is XPCOM.NS_OK) Mozilla.error (rc); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1091 if (prefFile is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1092 localFile.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1093 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1094 //nsIFile prefFile = new nsIFile (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1095 //result[0] = 0; |
335 | 1096 nsIPrefService prefService; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1097 //buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFSERVICE_CONTRACTID, true); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1098 rc = serviceManager.GetServiceByContractID (XPCOM.NS_PREFSERVICE_CONTRACTID.ptr, &nsIPrefService.IID, cast(void**)&prefService); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1099 if (rc !is XPCOM.NS_OK) error (rc); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1100 if (prefService is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1101 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1102 //nsIPrefService prefService = new nsIPrefService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1103 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1104 rc = prefService.SavePrefFile(prefFile); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1105 prefService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1106 prefFile.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1107 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1108 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1109 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1110 if (XPCOMWasGlued) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1111 // TODO: is there a difference between two startup methhods? Glue functions are same. |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1112 XPCOMInit.XPCOMGlueShutdown (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1113 XPCOMWasGlued = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1114 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1115 if (XPCOMInitWasGlued) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1116 XPCOMInit.XPCOMGlueShutdown (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1117 XPCOMInitWasGlued = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1118 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1119 Initialized = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1120 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1121 }); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1122 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1123 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1124 BrowserCount++; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1125 nsIComponentManager componentManager; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1126 int rc = XPCOM.NS_GetComponentManager (&componentManager); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1127 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1128 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1129 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1130 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1131 if (componentManager is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1132 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1133 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1134 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1135 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1136 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1137 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1138 nsIWebBrowser webBrowser; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1139 nsID NS_IWEBBROWSER_CID = { 0xF1EAC761, 0x87E9, 0x11d3, [0xAF, 0x80, 0x00, 0xA0, 0x24, 0xFF, 0xC0, 0x8C] }; //$NON-NLS-1$ |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1140 rc = componentManager.CreateInstance (&NS_IWEBBROWSER_CID, null, &nsIWebBrowser.IID, cast(void**)&webBrowser); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1141 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1142 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1143 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1144 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1145 if (webBrowser is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1146 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1147 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1148 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1149 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1150 //webBrowser = new nsIWebBrowser (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1151 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1152 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1153 //createCOMInterfaces (); |
335 | 1154 this.AddRef (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1155 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1156 /***** CAREFUL HERE: check to make sure this is correct XPCOM |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1157 ***** connection for webBrowserChrome. -JJR |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1158 *****/ |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1159 nsIWebBrowserChrome webBrowserChrome; //represents the this Mozilla internal interface |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1160 |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1161 rc = this.QueryInterface(&nsIWebBrowserChrome.IID, cast(void**)&webBrowserChrome ); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1162 if (rc !is XPCOM.NS_OK) |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1163 Mozilla.error (rc); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1164 if (webBrowserChrome is null) |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1165 Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1166 |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1167 rc = webBrowser.SetContainerWindow ( webBrowserChrome ); // set chrome to self |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1168 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1169 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1170 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1171 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1172 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1173 nsIBaseWindow baseWindow; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1174 rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1175 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1176 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1177 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1178 } |
340 | 1179 if (baseWindow is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1180 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1181 error (XPCOM.NS_ERROR_NO_INTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1182 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1183 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1184 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1185 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1186 Rectangle rect = browser.getClientArea (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1187 if (rect.isEmpty ()) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1188 rect.width = 1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1189 rect.height = 1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1190 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1191 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1192 embedHandle = mozDelegate.getHandle (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1193 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1194 rc = baseWindow.InitWindow (cast(void*)embedHandle, null, 0, 0, rect.width, rect.height); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1195 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1196 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1197 error (XPCOM.NS_ERROR_FAILURE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1198 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1199 rc = baseWindow.Create (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1200 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1201 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1202 error (XPCOM.NS_ERROR_FAILURE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1203 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1204 rc = baseWindow.SetVisibility (1); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1205 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1206 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1207 error (XPCOM.NS_ERROR_FAILURE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1208 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1209 baseWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1210 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1211 if (!PerformedVersionCheck) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1212 PerformedVersionCheck = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1213 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1214 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1215 * Check for the availability of the pre-1.8 implementation of nsIDocShell |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1216 * to determine if the GRE's version is < 1.8. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1217 */ |
335 | 1218 nsIInterfaceRequestor interfaceRequestor; |
1219 rc = webBrowser.QueryInterface (&nsIInterfaceRequestor.IID, cast(void**)&interfaceRequestor); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1220 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1221 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1222 error (XPCOM.NS_ERROR_FAILURE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1223 } |
335 | 1224 if (interfaceRequestor is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1225 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1226 error (XPCOM.NS_ERROR_NO_INTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1227 } |
335 | 1228 //nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); |
1229 //result[0] = 0; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1230 |
335 | 1231 nsIDocShell docShell; |
1232 rc = interfaceRequestor.GetInterface (&nsIDocShell.IID, cast(void**)&docShell); | |
1233 if (rc is XPCOM.NS_OK && docShell !is null) { | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1234 IsPre_1_8 = true; |
335 | 1235 docShell.Release (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1236 } |
335 | 1237 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1238 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1239 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1240 * A Download factory for contract "Transfer" must be registered iff the GRE's version is 1.8.x. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1241 * Check for the availability of the 1.8 implementation of nsIDocShell to determine if the |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1242 * GRE's version is 1.8.x. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1243 * If the GRE version is < 1.8 then the previously-registered Download factory for contract |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1244 * "Download" will be used. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1245 * If the GRE version is >= 1.9 then no Download factory is registered because this |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1246 * functionality is provided by the GRE. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1247 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1248 if (!IsPre_1_8) { |
335 | 1249 nsIDocShell_1_8 docShell_1_8; |
1250 rc = interfaceRequestor.GetInterface (&nsIDocShell_1_8.IID, cast(void**)&docShell_1_8); | |
1251 if (rc is XPCOM.NS_OK && docShell_1_8 !is null) { /* 1.8 */ | |
1252 docShell_1_8.Release (); | |
1253 //result[0] = 0; | |
1254 nsIComponentRegistrar componentRegistrar; | |
1255 rc = componentManager.QueryInterface (&nsIComponentRegistrar.IID, cast(void**)&componentRegistrar); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1256 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1257 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1258 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1259 } |
335 | 1260 if (componentRegistrar is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1261 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1262 error (XPCOM.NS_NOINTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1263 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1264 |
335 | 1265 // nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1266 DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1267 downloadFactory_1_8.AddRef (); |
335 | 1268 // byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true); |
1269 | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1270 String aClassName = "Transfer"; //$NON-NLS-1$ |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1271 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_DOWNLOAD_CID, aClassName.ptr, XPCOM.NS_TRANSFER_CONTRACTID.ptr, cast(nsIFactory)downloadFactory_1_8); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1272 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1273 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1274 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1275 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1276 downloadFactory_1_8.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1277 componentRegistrar.Release (); |
335 | 1278 } else { /* >= 1.9 */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1279 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1280 * Bug in XULRunner 1.9. Mozilla no longer clears its background before initial content has |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1281 * been set. As a result embedders appear broken if they do not immediately navigate to a url. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1282 * The workaround for this is to navigate to about:blank immediately so that the background is |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1283 * cleared, but do not fire any corresponding events or allow Browser API calls to reveal this. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1284 * Once the client does a proper navigate with either setUrl() or setText() then resume as |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1285 * normal. The Mozilla bug for this is https://bugzilla.mozilla.org/show_bug.cgi?id=415789. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1286 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1287 awaitingNavigate = true; |
335 | 1288 nsIWebNavigation webNavigation; |
1289 rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1290 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1291 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1292 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1293 } |
335 | 1294 if (webNavigation is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1295 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1296 error (XPCOM.NS_ERROR_NO_INTERFACE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1297 } |
335 | 1298 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1299 //char[] uri = new char[ABOUT_BLANK.length () + 1]; | |
1300 //ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uri, 0); | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1301 rc = webNavigation.LoadURI (ABOUT_BLANK.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1302 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1303 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1304 } |
335 | 1305 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1306 interfaceRequestor.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1307 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1308 componentManager.Release (); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1309 /* |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1310 // REMOVE: not necessary |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1311 nsIWeakReference weakReference; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1312 |
335 | 1313 rc = this.QueryInterface(&nsIWeakReference.IID, cast(void**)&weakReference); |
1314 if (rc !is XPCOM.NS_OK) { | |
1315 browser.dispose(); | |
1316 error(rc); | |
1317 } | |
1318 if (weakReference is null) { | |
1319 browser.dispose(); | |
1320 error(XPCOM.NS_ERROR_NO_INTERFACE); | |
1321 } | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1322 */ |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1323 rc = webBrowser.AddWebBrowserListener (cast(nsIWeakReference)this, &nsIWebProgressListener.IID); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1324 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1325 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1326 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1327 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1328 |
337 | 1329 // TODO: Find appropriate place to "Release" uriContentListener -JJR |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1330 nsIURIContentListener uriContentListener; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1331 this.QueryInterface(&nsIURIContentListener.IID, cast(void**)&uriContentListener); |
335 | 1332 if (rc !is XPCOM.NS_OK) { |
1333 browser.dispose(); | |
340 | 1334 error(rc); |
335 | 1335 } |
340 | 1336 if (uriContentListener is null) { |
335 | 1337 browser.dispose(); |
1338 error(XPCOM.NS_ERROR_NO_INTERFACE); | |
1339 } | |
1340 | |
1341 rc = webBrowser.SetParentURIContentListener (uriContentListener); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1342 if (rc !is XPCOM.NS_OK) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1343 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1344 error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1345 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1346 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1347 mozDelegate.init (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1348 |
340 | 1349 listener = new class () Listener { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1350 public void handleEvent (Event event) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1351 Control control = cast(Control)this.outer.browser; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1352 Browser browser = this.outer.browser; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1353 switch (event.type) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1354 case DWT.Dispose: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1355 /* make this handler run after other dispose listeners */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1356 if (ignoreDispose) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1357 ignoreDispose = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1358 break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1359 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1360 ignoreDispose = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1361 browser.notifyListeners (event.type, event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1362 event.type = DWT.NONE; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1363 onDispose (event.display); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1364 break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1365 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1366 case DWT.Resize: onResize (); break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1367 case DWT.FocusIn: Activate (); break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1368 case DWT.Activate: Activate (); break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1369 case DWT.Deactivate: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1370 Display display = event.display; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1371 if (control is display.getFocusControl ()) Deactivate (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1372 break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1373 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1374 case DWT.Show: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1375 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1376 * Feature in GTK Mozilla. Mozilla does not show up when |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1377 * its container (a GTK fixed handle) is made visible |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1378 * after having been hidden. The workaround is to reset |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1379 * its size after the container has been made visible. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1380 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1381 Display display = event.display; |
340 | 1382 display.asyncExec(new class () Runnable { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1383 public void run() { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1384 if (browser.isDisposed ()) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1385 onResize (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1386 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1387 }); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1388 break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1389 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1390 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1391 } |
340 | 1392 }; |
1393 int[] folderEvents = [ | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1394 DWT.Dispose, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1395 DWT.Resize, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1396 DWT.FocusIn, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1397 DWT.Activate, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1398 DWT.Deactivate, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1399 DWT.Show, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1400 DWT.KeyDown // needed to make browser traversable |
340 | 1401 ]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1402 for (int i = 0; i < folderEvents.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1403 browser.addListener (folderEvents[i], listener); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1404 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1405 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1406 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1407 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1408 public bool back () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1409 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1410 |
335 | 1411 //int /*long*/[] result = new int /*long*/[1]; |
1412 nsIWebNavigation webNavigation; | |
1413 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1414 if (rc !is XPCOM.NS_OK) error (rc); |
335 | 1415 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1416 |
335 | 1417 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1418 rc = webNavigation.GoBack (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1419 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1420 return rc is XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1421 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1422 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1423 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1424 public bool execute (String script) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1425 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1426 |
335 | 1427 String url = PREFIX_JAVASCRIPT ~ script ~ ";void(0);"; //$NON-NLS-1$ |
1428 //int /*long*/[] result = new int /*long*/[1]; | |
1429 nsIWebNavigation webNavigation; | |
1430 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1431 if (rc !is XPCOM.NS_OK) error (rc); |
335 | 1432 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1433 |
335 | 1434 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1435 //char[] arg = url.toCharArray (); | |
1436 //char[] c = new char[arg.length+1]; | |
1437 //System.arraycopy (arg, 0, c, 0, arg.length); | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1438 rc = webNavigation.LoadURI (url.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1439 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1440 return rc is XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1441 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1442 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1443 extern(D) |
298
eec6ddb07873
More xpcom/mozilla port
John Reimer<terminal.node@gmail.com>
parents:
286
diff
changeset
|
1444 static Browser findBrowser (void* handle) { |
eec6ddb07873
More xpcom/mozilla port
John Reimer<terminal.node@gmail.com>
parents:
286
diff
changeset
|
1445 return MozillaDelegate.findBrowser (cast(GtkWidget*)handle); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1446 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1447 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1448 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1449 public bool forward () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1450 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1451 |
335 | 1452 //int /*long*/[] result = new int /*long*/[1]; |
1453 nsIWebNavigation webNavigation; | |
1454 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1455 if (rc !is XPCOM.NS_OK) error (rc); |
335 | 1456 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1457 |
335 | 1458 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1459 rc = webNavigation.GoForward (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1460 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1461 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1462 return rc is XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1463 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1464 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1465 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1466 public String getText () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1467 if (awaitingNavigate) return ""; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1468 |
335 | 1469 //int /*long*/[] result = new int /*long*/[1]; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1470 nsIDOMWindow window; |
335 | 1471 int rc = webBrowser.GetContentDOMWindow (&window); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1472 if (rc !is XPCOM.NS_OK) error (rc); |
335 | 1473 if (window is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1474 |
335 | 1475 //nsIDOMWindow window = new nsIDOMWindow (result[0]); |
1476 //result[0] = 0; | |
1477 nsIDOMDocument document; | |
1478 rc = window.GetDocument (&document); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1479 if (rc !is XPCOM.NS_OK) error (rc); |
335 | 1480 if (document is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1481 window.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1482 |
335 | 1483 //int /*long*/ document = result[0]; |
1484 //result[0] = 0; | |
1485 nsIComponentManager componentManager; | |
1486 rc = XPCOM.NS_GetComponentManager (&componentManager); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1487 if (rc !is XPCOM.NS_OK) error (rc); |
335 | 1488 if (componentManager is null) error (XPCOM.NS_NOINTERFACE); |
1489 | |
1490 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); | |
1491 //result[0] = 0; | |
1492 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOMSERIALIZER_CONTRACTID, true); | |
1493 String chars = null; | |
1494 nsIDOMSerializer_1_7 serializer_1_7; | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1495 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer_1_7.IID, cast(void**)&serializer_1_7); |
335 | 1496 if (rc is XPCOM.NS_OK) { /* mozilla >= 1.7 */ |
1497 if (serializer_1_7 is null) error (XPCOM.NS_NOINTERFACE); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1498 |
335 | 1499 //nsIDOMSerializer_1_7 serializer = new nsIDOMSerializer_1_7 (result[0]); |
1500 //result[0] = 0; | |
1501 scope auto string = new nsEmbedString; | |
1502 rc = serializer_1_7.SerializeToString (cast(nsIDOMNode)document, cast(nsAString*) string); | |
1503 serializer_1_7.Release (); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1504 |
335 | 1505 //int length = XPCOM.nsEmbedString_Length (string); |
1506 //int /*long*/ buffer = XPCOM.nsEmbedString_get (string); | |
1507 //chars = new char[length]; | |
1508 //XPCOM.memmove (chars, buffer, length * 2); | |
1509 //XPCOM.nsEmbedString_delete (string); | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1510 chars = string.toString(); |
335 | 1511 } else { /* mozilla < 1.7 */ |
1512 nsIDOMSerializer serializer; | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1513 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer.IID, cast(void**)&serializer); |
335 | 1514 if (rc !is XPCOM.NS_OK) error (rc); |
1515 if (serializer is null) error (XPCOM.NS_NOINTERFACE); | |
1516 // TODO: Lookup SerializeToString contract. Find out if the string must provide it's own memory to the method. -JJR | |
1517 PRUnichar* string; | |
1518 //nsIDOMSerializer serializer = new nsIDOMSerializer (result[0]); | |
1519 //result[0] = 0; | |
1520 rc = serializer.SerializeToString (cast(nsIDOMNode)document, &string ); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1521 serializer.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1522 |
335 | 1523 //int length = XPCOM.strlen_PRUnichar (string); |
1524 //chars = new char[length]; | |
1525 //XPCOM.memmove (chars, result[0], length * 2); | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1526 chars = Utf.toString(fromString16z(string)); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1527 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1528 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1529 componentManager.Release (); |
335 | 1530 document.Release (); |
1531 return chars.dup; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1532 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1533 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1534 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1535 public String getUrl () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1536 if (awaitingNavigate) return ""; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1537 |
337 | 1538 //int /*long*/[] result = new int /*long*/[1]; |
1539 nsIWebNavigation webNavigation; | |
1540 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1541 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1542 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1543 |
337 | 1544 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1545 nsIURI aCurrentURI; | |
1546 rc = webNavigation.GetCurrentURI (&aCurrentURI); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1547 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1548 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1549 |
337 | 1550 String location = null; |
1551 if (aCurrentURI !is null) { | |
1552 //nsIURI uri = new nsIURI (aCurrentURI[0]); | |
1553 scope auto aSpec = new nsEmbedCString; | |
1554 rc = aCurrentURI.GetSpec (cast(nsACString*)aSpec); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1555 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1556 //int length = XPCOM.nsEmbedCString_Length (aSpec); |
1557 //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); | |
1558 location = aSpec.toString; | |
1559 //XPCOM.memmove (dest, buffer, length); | |
1560 //XPCOM.nsEmbedCString_delete (aSpec); | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1561 aCurrentURI.Release (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1562 } |
337 | 1563 if (location is null) return ""; //$NON-NLS-1$ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1564 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1565 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1566 * If the URI indicates that the page is being rendered from memory |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1567 * (via setText()) then set it to about:blank to be consistent with IE. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1568 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1569 if (location.equals (URI_FROMMEMORY)) location = ABOUT_BLANK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1570 return location; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1571 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1572 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1573 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1574 public Object getWebBrowser () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1575 if ((browser.getStyle () & DWT.MOZILLA) is 0) return null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1576 if (webBrowserObject !is null) return webBrowserObject; |
337 | 1577 implMissing(__FILE__,__LINE__); |
1578 /+ | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1579 try { |
337 | 1580 // TODO: this references the JavaXPCOM browser... not sure what needs to be done here, |
1581 // but I don't think this method is necessary. | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1582 Class clazz = Class.forName ("org.mozilla.xpcom.Mozilla"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1583 Method method = clazz.getMethod ("getInstance", new Class[0]); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1584 Object mozilla = method.invoke (null, new Object[0]); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1585 method = clazz.getMethod ("wrapXPCOMObject", new Class[] {Long.TYPE, String.class}); //$NON-NLS-1$ |
337 | 1586 webBrowserObject = webBrowser.getAddress ()), nsIWebBrowser.NS_IWEBBROWSER_IID_STR}); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1587 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1588 * The following AddRef() is needed to offset the automatic Release() that |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1589 * will be performed by JavaXPCOM when webBrowserObject is finalized. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1590 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1591 webBrowser.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1592 return webBrowserObject; |
337 | 1593 } catch (ClassNotFoundException e) { |
1594 } catch (NoSuchMethodException e) { | |
1595 } catch (IllegalArgumentException e) { | |
1596 } catch (IllegalAccessException e) { | |
1597 } catch (InvocationTargetException e) { | |
1598 } | |
1599 +/ | |
1600 return null; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1601 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1602 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1603 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1604 public bool isBackEnabled () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1605 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1606 |
337 | 1607 //int /*long*/[] result = new int /*long*/[1]; |
1608 nsIWebNavigation webNavigation; | |
1609 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1610 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1611 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1612 |
337 | 1613 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1614 PRBool aCanGoBack; /* PRBool */ | |
1615 rc = webNavigation.GetCanGoBack (&aCanGoBack); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1616 webNavigation.Release (); |
337 | 1617 return aCanGoBack !is 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1618 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1619 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1620 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1621 public bool isForwardEnabled () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1622 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1623 |
337 | 1624 //int /*long*/[] result = new int /*long*/[1]; |
1625 nsIWebNavigation webNavigation; | |
1626 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1627 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1628 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1629 |
337 | 1630 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1631 PRBool aCanGoForward; /* PRBool */ | |
1632 rc = webNavigation.GetCanGoForward (&aCanGoForward); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1633 webNavigation.Release (); |
337 | 1634 return aCanGoForward !is 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1635 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1636 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1637 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1638 static String error (int code) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1639 throw new DWTError ("XPCOM error " ~ Integer.toString(code)); //$NON-NLS-1$ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1640 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1641 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1642 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1643 void onDispose (Display display) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1644 int rc = webBrowser.RemoveWebBrowserListener (cast(nsIWeakReference)this, &nsIWebProgressListener.IID); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1645 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1646 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1647 rc = webBrowser.SetParentURIContentListener (null); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1648 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1649 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1650 unhookDOMListeners (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1651 if (listener !is null) { |
337 | 1652 int[] folderEvents = [ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1653 DWT.Dispose, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1654 DWT.Resize, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1655 DWT.FocusIn, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1656 DWT.Activate, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1657 DWT.Deactivate, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1658 DWT.Show, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1659 DWT.KeyDown, |
337 | 1660 ]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1661 for (int i = 0; i < folderEvents.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1662 browser.removeListener (folderEvents[i], listener); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1663 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1664 listener = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1665 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1666 |
337 | 1667 //int /*long*/[] result = new int /*long*/[1]; |
1668 nsIBaseWindow baseWindow; | |
1669 rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1670 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1671 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1672 |
337 | 1673 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1674 rc = baseWindow.Destroy (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1675 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1676 baseWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1677 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1678 Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1679 webBrowser.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1680 webBrowser = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1681 webBrowserObject = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1682 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1683 if (tip !is null && !tip.isDisposed ()) tip.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1684 tip = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1685 location = size = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1686 |
337 | 1687 //Enumeration elements = unhookedDOMWindows.elements (); |
1688 foreach (win ; unhookedDOMWindows) { | |
1689 //LONG ptrObject = (LONG)elements.nextElement (); | |
1690 win.Release (); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1691 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1692 unhookedDOMWindows = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1693 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1694 mozDelegate.onDispose (embedHandle); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1695 mozDelegate = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1696 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1697 embedHandle = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1698 BrowserCount--; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1699 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1700 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1701 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1702 void Activate () { |
337 | 1703 //int /*long*/[] result = new int /*long*/[1]; |
1704 nsIWebBrowserFocus webBrowserFocus; | |
1705 int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1706 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1707 if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1708 |
337 | 1709 //nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1710 rc = webBrowserFocus.Activate (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1711 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1712 webBrowserFocus.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1713 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1714 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1715 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1716 void Deactivate () { |
337 | 1717 //int /*long*/[] result = new int /*long*/[1]; |
1718 nsIWebBrowserFocus webBrowserFocus; | |
1719 int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1720 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1721 if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1722 |
337 | 1723 //nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1724 rc = webBrowserFocus.Deactivate (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1725 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1726 webBrowserFocus.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1727 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1728 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1729 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1730 void onResize () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1731 Rectangle rect = browser.getClientArea (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1732 int width = Math.max (1, rect.width); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1733 int height = Math.max (1, rect.height); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1734 |
337 | 1735 //int /*long*/[] result = new int /*long*/[1]; |
1736 nsIBaseWindow baseWindow; | |
1737 int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1738 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1739 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1740 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1741 mozDelegate.setSize (embedHandle, width, height); |
337 | 1742 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1743 rc = baseWindow.SetPositionAndSize (0, 0, width, height, 1); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1744 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1745 baseWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1746 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1747 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1748 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1749 public void refresh () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1750 if (awaitingNavigate) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1751 |
337 | 1752 //int /*long*/[] result = new int /*long*/[1]; |
1753 nsIWebNavigation webNavigation; | |
1754 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1755 if (rc !is XPCOM.NS_OK) error(rc); |
337 | 1756 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1757 |
337 | 1758 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1759 rc = webNavigation.Reload (nsIWebNavigation.LOAD_FLAGS_NONE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1760 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1761 if (rc is XPCOM.NS_OK) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1762 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1763 * Feature in Mozilla. Reload returns an error code NS_ERROR_INVALID_POINTER |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1764 * when it is called immediately after a request to load a new document using |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1765 * LoadURI. The workaround is to ignore this error code. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1766 * |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1767 * Feature in Mozilla. Attempting to reload a file that no longer exists |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1768 * returns an error code of NS_ERROR_FILE_NOT_FOUND. This is equivalent to |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1769 * attempting to load a non-existent local url, which is not a Browser error, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1770 * so this error code should be ignored. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1771 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1772 if (rc !is XPCOM.NS_ERROR_INVALID_POINTER && rc !is XPCOM.NS_ERROR_FILE_NOT_FOUND) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1773 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1774 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1775 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1776 public bool setText (String html) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1777 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1778 * Feature in Mozilla. The focus memory of Mozilla must be |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1779 * properly managed through the nsIWebBrowserFocus interface. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1780 * In particular, nsIWebBrowserFocus.deactivate must be called |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1781 * when the focus moves from the browser (or one of its children |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1782 * managed by Mozilla to another widget. We currently do not |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1783 * get notified when a widget takes focus away from the Browser. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1784 * As a result, deactivate is not properly called. This causes |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1785 * Mozilla to retake focus the next time a document is loaded. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1786 * This breaks the case where the HTML loaded in the Browser |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1787 * varies while the user enters characters in a text widget. The text |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1788 * widget loses focus every time new content is loaded. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1789 * The current workaround is to call deactivate everytime if |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1790 * the browser currently does not have focus. A better workaround |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1791 * would be to have a way to call deactivate when the Browser |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1792 * or one of its children loses focus. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1793 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1794 if (browser !is browser.getDisplay ().getFocusControl ()) Deactivate (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1795 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1796 /* convert the String containing HTML to an array of bytes with UTF-8 data */ |
337 | 1797 /+ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1798 byte[] data = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1799 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1800 data = html.getBytes ("UTF-8"); //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1801 } catch (UnsupportedEncodingException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1802 return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1803 } |
337 | 1804 +/ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1805 awaitingNavigate = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1806 |
337 | 1807 //byte[] contentTypeBuffer = MozillaDelegate.wcsToMbcs (null, "text/html", true); // $NON-NLS-1$ |
1808 scope auto aContentType = new nsEmbedCString ("text/html"); | |
1809 //byte[] contentCharsetBuffer = MozillaDelegate.wcsToMbcs (null, "UTF-8", true); //$NON-NLS-1$ | |
1810 scope auto aContentCharset = new nsEmbedCString ("UTF-8"); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1811 |
337 | 1812 //int /*long*/[] result = new int /*long*/[1]; |
1813 nsIServiceManager serviceManager; | |
1814 int rc = XPCOM.NS_GetServiceManager (&serviceManager); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1815 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1816 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1817 |
337 | 1818 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
1819 //result[0] = 0; | |
1820 nsIIOService ioService; | |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1821 rc = serviceManager.GetService (&XPCOM.NS_IOSERVICE_CID, &nsIIOService.IID, cast(void**)&ioService); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1822 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1823 if (ioService is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1824 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1825 |
337 | 1826 //nsIIOService ioService = new nsIIOService (result[0]); |
1827 //result[0] = 0; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1828 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1829 * Note. Mozilla ignores LINK tags used to load CSS stylesheets |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1830 * when the URI protocol for the nsInputStreamChannel |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1831 * is about:blank. The fix is to specify the file protocol. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1832 */ |
337 | 1833 //byte[] aString = MozillaDelegate.wcsToMbcs (null, URI_FROMMEMORY, false); |
1834 scope auto aSpec = new nsEmbedCString(URI_FROMMEMORY); | |
1835 nsIURI uri; | |
1836 rc = ioService.NewURI (cast(nsACString*)aSpec, null, null, &uri); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1837 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1838 if (uri is null) error (XPCOM.NS_NOINTERFACE); |
1839 //XPCOM.nsEmbedCString_delete (aSpec); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1840 ioService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1841 |
337 | 1842 //nsIURI uri = new nsIURI (result[0]); |
1843 //result[0] = 0; | |
1844 nsIInterfaceRequestor interfaceRequestor; | |
1845 rc = webBrowser.QueryInterface (&nsIInterfaceRequestor.IID, cast(void**)&interfaceRequestor); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1846 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1847 if (interfaceRequestor is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
1848 //nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); | |
1849 //result[0] = 0; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1850 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1851 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1852 * Feature in Mozilla. LoadStream invokes the nsIInputStream argument |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1853 * through a different thread. The callback mechanism must attach |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1854 * a non java thread to the JVM otherwise the nsIInputStream Read and |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1855 * Close methods never get called. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1856 */ |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1857 |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1858 // Using fully qualified name for disambiguation with dwthelper InputStream -JJR |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1859 auto inputStream = new dwt.browser.InputStream.InputStream (cast(byte[])html); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1860 inputStream.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1861 |
337 | 1862 nsIDocShell_1_9 docShell_1_9; |
1863 rc = interfaceRequestor.GetInterface (&nsIDocShell_1_9.IID, cast(void**)&docShell_1_9); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1864 if (rc is XPCOM.NS_OK) { |
337 | 1865 if (docShell_1_9 is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
1866 //nsIDocShell_1_9 docShell = new nsIDocShell_1_9 (result[0]); | |
1867 rc = docShell_1_9.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); | |
1868 docShell_1_9.Release (); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1869 } else { |
337 | 1870 //result[0] = 0; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1871 nsIDocShell_1_8 docShell_1_8; |
337 | 1872 rc = interfaceRequestor.GetInterface (&nsIDocShell_1_8.IID, cast(void**)&docShell_1_8); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1873 if (rc is XPCOM.NS_OK) { |
337 | 1874 if (docShell_1_8 is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
1875 //nsIDocShell_1_8 docShell = new nsIDocShell_1_8 (result[0]); | |
1876 rc = docShell_1_8.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); | |
1877 docShell_1_8.Release (); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1878 } else { |
337 | 1879 //result[0] = 0; |
1880 nsIDocShell docShell; | |
1881 rc = interfaceRequestor.GetInterface (&nsIDocShell.IID, cast(void**)&docShell); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1882 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1883 if (docShell is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
1884 //nsIDocShell docShell = new nsIDocShell (result[0]); | |
1885 rc = docShell.LoadStream (inputStream, uri, cast(nsACString*) aContentType, cast(nsACString*)aContentCharset, null); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1886 docShell.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1887 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1888 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1889 if (rc !is XPCOM.NS_OK) error (rc); |
337 | 1890 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1891 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1892 inputStream.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1893 interfaceRequestor.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1894 uri.Release (); |
337 | 1895 //XPCOM.nsEmbedCString_delete (aContentCharset); |
1896 //XPCOM.nsEmbedCString_delete (aContentType); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1897 return true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1898 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1899 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1900 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1901 public bool setUrl (String url) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1902 awaitingNavigate = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1903 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1904 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1905 nsIWebNavigation webNavigation; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1906 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1907 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1908 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1909 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1910 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1911 //char[] uri = new char[url.length () + 1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1912 //url.getChars (0, url.length (), uri, 0); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1913 rc = webNavigation.LoadURI (url.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1914 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1915 return rc is XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1916 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1917 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1918 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1919 public void stop () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1920 if (awaitingNavigate) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1921 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1922 nsIWebNavigation webNavigation; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1923 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1924 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1925 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1926 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1927 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1928 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1929 rc = webNavigation.Stop (nsIWebNavigation.STOP_ALL); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1930 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1931 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1932 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1933 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1934 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1935 void hookDOMListeners (nsIDOMEventTarget target, bool isTop) { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1936 scope auto string = new nsEmbedString (XPCOM.DOMEVENT_FOCUS.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1937 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1938 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1939 string = new nsEmbedString (XPCOM.DOMEVENT_UNLOAD.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1940 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1941 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1942 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDOWN.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1943 target.AddEventListener (cast(nsAString*)string,cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1944 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1945 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEUP.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1946 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1947 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1948 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEMOVE.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1949 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1950 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1951 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEWHEEL.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1952 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1953 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1954 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDRAG.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1955 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1956 //string.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1957 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1958 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1959 * Only hook mouseover and mouseout if the target is a top-level frame, so that mouse moves |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1960 * between frames will not generate events. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1961 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1962 if (isTop && mozDelegate.hookEnterExit ()) { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1963 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOVER.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1964 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1965 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1966 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOUT.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1967 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1968 //string.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1969 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1970 |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1971 string = new nsEmbedString (XPCOM.DOMEVENT_KEYDOWN.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1972 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1973 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1974 string = new nsEmbedString (XPCOM.DOMEVENT_KEYPRESS.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1975 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1976 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1977 string = new nsEmbedString (XPCOM.DOMEVENT_KEYUP.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1978 target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1979 //string.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1980 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1981 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1982 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1983 void unhookDOMListeners () { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1984 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1985 nsIDOMWindow window; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1986 int rc = webBrowser.GetContentDOMWindow (&window); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1987 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1988 if (window is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1989 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1990 //nsIDOMWindow window = new nsIDOMWindow (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1991 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1992 nsIDOMEventTarget target; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1993 rc = window.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1994 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1995 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1996 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1997 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1998 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1999 unhookDOMListeners (target); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2000 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2001 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2002 /* Listeners must be unhooked in pages contained in frames */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2003 nsIDOMWindowCollection frames; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2004 rc = window.GetFrames (&frames); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2005 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2006 if (frames is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2007 //nsIDOMWindowCollection frames = new nsIDOMWindowCollection (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2008 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2009 PRUint32 count; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2010 rc = frames.GetLength (&count); /* PRUint32 */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2011 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2012 //int count = frameCount[0]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2013 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2014 if (count > 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2015 nsIDOMWindow frame; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2016 for (int i = 0; i < count; i++) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2017 rc = frames.Item (i, &frame); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2018 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2019 if (frame is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2020 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2021 //nsIDOMWindow frame = new nsIDOMWindow (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2022 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2023 rc = frame.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2024 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2025 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2026 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2027 //target = new nsIDOMEventTarget (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2028 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2029 unhookDOMListeners (target); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2030 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2031 frame.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2032 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2033 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2034 frames.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2035 window.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2036 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2037 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2038 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2039 void unhookDOMListeners (nsIDOMEventTarget target) { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2040 scope auto string = new nsEmbedString (XPCOM.DOMEVENT_FOCUS.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2041 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2042 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2043 string = new nsEmbedString (XPCOM.DOMEVENT_UNLOAD.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2044 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2045 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2046 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDOWN.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2047 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2048 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2049 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEUP.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2050 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2051 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2052 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEMOVE.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2053 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2054 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2055 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEWHEEL.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2056 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2057 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2058 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDRAG.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2059 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2060 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2061 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOVER.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2062 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2063 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2064 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOUT.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2065 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2066 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2067 string = new nsEmbedString (XPCOM.DOMEVENT_KEYDOWN.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2068 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2069 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2070 string = new nsEmbedString (XPCOM.DOMEVENT_KEYPRESS.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2071 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2072 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2073 string = new nsEmbedString (XPCOM.DOMEVENT_KEYUP.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2074 target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2075 //string.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2076 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2077 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2078 /* nsISupports */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2079 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2080 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2081 nsresult QueryInterface (nsID* riid, void** ppvObject) { |
286 | 2082 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2083 |
286 | 2084 if (*riid == nsISupports.IID) { |
2085 *ppvObject = cast(void*)cast(nsISupports)this; | |
2086 AddRef (); | |
2087 return XPCOM.NS_OK; | |
2088 } | |
2089 if (*riid == nsIWeakReference.IID) { | |
2090 *ppvObject = cast(void*)cast(nsIWeakReference)this; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2091 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2092 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2093 } |
286 | 2094 if (*riid == nsIWebProgressListener.IID) { |
2095 *ppvObject = cast(void*)cast(nsIWebProgressListener)this; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2096 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2097 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2098 } |
286 | 2099 if (*riid == nsIWebBrowserChrome.IID) { |
2100 *ppvObject = cast(void*)cast(nsIWebBrowserChrome)this; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2101 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2102 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2103 } |
286 | 2104 if (*riid == nsIWebBrowserChromeFocus.IID) { |
2105 *ppvObject = cast(void*)cast(nsIWebBrowserChromeFocus)this; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2106 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2107 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2108 } |
286 | 2109 if (*riid == nsIEmbeddingSiteWindow.IID) { |
2110 *ppvObject = cast(void*)cast(nsIEmbeddingSiteWindow)this; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2111 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2112 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2113 } |
286 | 2114 if (*riid == nsIInterfaceRequestor.IID) { |
2115 *ppvObject = cast(void*)cast(nsIInterfaceRequestor)this; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2116 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2117 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2118 } |
286 | 2119 if (*riid == nsISupportsWeakReference.IID) { |
2120 *ppvObject = cast(void*)cast(nsISupportsWeakReference)this; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2121 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2122 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2123 } |
286 | 2124 if (*riid == nsIContextMenuListener.IID) { |
2125 *ppvObject = cast(void*)cast(nsIContextMenuListener)this; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2126 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2127 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2128 } |
286 | 2129 if (*riid == nsIURIContentListener.IID) { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2130 *ppvObject = cast(void*)cast(nsIURIContentListener)this; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2131 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2132 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2133 } |
340 | 2134 if (*riid == nsITooltipListener.IID) { |
286 | 2135 *ppvObject = cast(void*)cast(nsITooltipListener)this; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2136 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2137 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2138 } |
286 | 2139 *ppvObject = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2140 return XPCOM.NS_ERROR_NO_INTERFACE; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2141 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2142 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2143 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2144 nsrefcnt AddRef () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2145 refCount++; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2146 return refCount; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2147 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2148 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2149 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2150 nsrefcnt Release () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2151 refCount--; |
286 | 2152 if (refCount is 0) return 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2153 return refCount; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2154 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2155 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2156 /* nsIWeakReference */ |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2157 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2158 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2159 nsresult QueryReferent (nsID* riid, void** ppvObject) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2160 return QueryInterface (riid, ppvObject); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2161 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2162 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2163 /* nsIInterfaceRequestor */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2164 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2165 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2166 nsresult GetInterface ( nsID* riid, void** ppvObject) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2167 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2168 //nsID guid = new nsID (); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2169 //XPCOM.memmove (guid, riid, nsID.sizeof); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2170 if (*riid == nsIDOMWindow.IID) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2171 nsIDOMWindow aContentDOMWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2172 //int /*long*/[] aContentDOMWindow = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2173 int rc = webBrowser.GetContentDOMWindow (&aContentDOMWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2174 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2175 if (aContentDOMWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2176 *ppvObject = cast(void*)aContentDOMWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2177 //XPCOM.memmove (ppvObject, aContentDOMWindow, C.PTR_SIZEOF); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2178 return rc; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2179 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2180 return QueryInterface (riid, ppvObject); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2181 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2182 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2183 extern(System) |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2184 nsresult GetWeakReference (nsIWeakReference* ppvObject) { |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2185 *ppvObject = cast(nsIWeakReference)this; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2186 //XPCOM.memmove (ppvObject, new int /*long*/[] {weakReference.getAddress ()}, C.PTR_SIZEOF); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2187 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2188 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2189 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2190 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2191 /* nsIWebProgressListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2192 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2193 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2194 nsresult OnStateChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 aStateFlags, nsresult aStatus) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2195 if ((aStateFlags & nsIWebProgressListener.STATE_IS_DOCUMENT) is 0) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2196 if ((aStateFlags & nsIWebProgressListener.STATE_START) !is 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2197 if (request is null) request = aRequest; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2198 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2199 if (!awaitingNavigate) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2200 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2201 * Add the page's nsIDOMWindow to the collection of windows that will |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2202 * have DOM listeners added to them later on in the page loading |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2203 * process. These listeners cannot be added yet because the |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2204 * nsIDOMWindow is not ready to take them at this stage. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2205 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2206 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2207 nsIDOMWindow window; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2208 //nsIWebProgress progress = new nsIWebProgress (aWebProgress); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2209 int rc = aWebProgress.GetDOMWindow (&window); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2210 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2211 if (window is null) error (XPCOM.NS_NOINTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2212 unhookedDOMWindows ~= window; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2213 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2214 } else if ((aStateFlags & nsIWebProgressListener.STATE_REDIRECTING) !is 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2215 if (request is aRequest) request = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2216 } else if ((aStateFlags & nsIWebProgressListener.STATE_STOP) !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2217 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2218 * If this page's nsIDOMWindow handle is still in unhookedDOMWindows then |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2219 * add its DOM listeners now. It's possible for this to happen since |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2220 * there is no guarantee that a STATE_TRANSFERRING state change will be |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2221 * received for every window in a page, which is when these listeners |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2222 * are typically added. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2223 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2224 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2225 //nsIWebProgress progress = new nsIWebProgress (aWebProgress); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2226 nsIDOMWindow domWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2227 int rc = aWebProgress.GetDOMWindow (&domWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2228 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2229 if (domWindow is null) error (XPCOM.NS_NOINTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2230 //nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2231 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2232 //LONG ptrObject = new LONG (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2233 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2234 int index = unhookedDOMWindows.arrayIndexOf (domWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2235 if (index !is -1) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2236 nsIDOMWindow contentWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2237 rc = webBrowser.GetContentDOMWindow (&contentWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2238 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2239 if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2240 bool isTop = contentWindow is domWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2241 contentWindow.Release (); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2242 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2243 nsIDOMEventTarget target; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2244 rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2245 if (rc !is XPCOM.NS_OK) error (rc); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2246 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2247 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2248 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2249 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2250 hookDOMListeners (target, isTop); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2251 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2252 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2253 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2254 * Remove and unreference the nsIDOMWindow from the collection of windows |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2255 * that are waiting to have DOM listeners hooked on them. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2256 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2257 unhookedDOMWindows = unhookedDOMWindows.arrayIndexRemove (index); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2258 domWindow.Release (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2259 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2260 domWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2261 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2262 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2263 * Feature in Mozilla. When a request is redirected (STATE_REDIRECTING), |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2264 * it never reaches the state STATE_STOP and it is replaced with a new request. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2265 * The new request is received when it is in the state STATE_STOP. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2266 * To handle this case, the variable request is set to 0 when the corresponding |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2267 * request is redirected. The following request received with the state STATE_STOP |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2268 * - the new request resulting from the redirection - is used to send |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2269 * the ProgressListener.completed event. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2270 */ |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2271 if (request is aRequest || request is null) { |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2272 request = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2273 if (!awaitingNavigate) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2274 StatusTextEvent event = new StatusTextEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2275 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2276 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2277 event.text = ""; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2278 for (int i = 0; i < statusTextListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2279 statusTextListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2280 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2281 ProgressEvent event2 = new ProgressEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2282 event2.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2283 event2.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2284 for (int i = 0; i < progressListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2285 progressListeners[i].completed (event2); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2286 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2287 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2288 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2289 } else if ((aStateFlags & nsIWebProgressListener.STATE_TRANSFERRING) !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2290 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2291 * Hook DOM listeners to the page's nsIDOMWindow here because this is |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2292 * the earliest opportunity to do so. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2293 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2294 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2295 // nsIWebProgress progress = new nsIWebProgress (aWebProgress); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2296 nsIDOMWindow domWindow; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2297 int rc = aWebProgress.GetDOMWindow (&domWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2298 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2299 if (domWindow is null) error (XPCOM.NS_NOINTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2300 //nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2301 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2302 //LONG ptrObject = new LONG (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2303 //result[0] = 0; |
340 | 2304 int index = unhookedDOMWindows.arrayIndexOf ( domWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2305 if (index !is -1) { |
340 | 2306 nsIDOMWindow contentWindow; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2307 rc = webBrowser.GetContentDOMWindow (&contentWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2308 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2309 if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2310 bool isTop = contentWindow is domWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2311 contentWindow.Release (); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2312 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2313 nsIDOMEventTarget target; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2314 rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2315 if (rc !is XPCOM.NS_OK) error (rc); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2316 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2317 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2318 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2319 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2320 hookDOMListeners (target, isTop); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2321 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2322 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2323 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2324 * Remove and unreference the nsIDOMWindow from the collection of windows |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2325 * that are waiting to have DOM listeners hooked on them. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2326 */ |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2327 unhookedDOMWindows = unhookedDOMWindows.arrayIndexRemove(index); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2328 domWindow.Release (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2329 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2330 domWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2331 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2332 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2333 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2334 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2335 extern(System) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2336 nsresult OnProgressChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2337 if (awaitingNavigate || super.progressListeners.length is 0) return XPCOM.NS_OK; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2338 ProgressEvent event = new ProgressEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2339 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2340 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2341 event.current = aCurTotalProgress; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2342 event.total = aMaxTotalProgress; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2343 for (int i = 0; i < super.progressListeners.length; i++) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2344 super.progressListeners[i].changed (event); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2345 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2346 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2347 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2348 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2349 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2350 nsresult OnLocationChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2351 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2352 * Feature in Mozilla. When a page is loaded via setText before a previous |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2353 * setText page load has completed, the expected OnStateChange STATE_STOP for the |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2354 * original setText never arrives because it gets replaced by the OnStateChange |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2355 * STATE_STOP for the new request. This results in the request field never being |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2356 * cleared because the original request's OnStateChange STATE_STOP is still expected |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2357 * (but never arrives). To handle this case, the request field is updated to the new |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2358 * overriding request since its OnStateChange STATE_STOP will be received next. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2359 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2360 if (request !is null && request !is aRequest) request = aRequest; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2361 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2362 if (awaitingNavigate || locationListeners.length is 0) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2363 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2364 //nsIWebProgress webProgress = new nsIWebProgress (aWebProgress); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2365 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2366 nsIDOMWindow domWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2367 //int /*long*/[] aDOMWindow = new int /*long*/[1]; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2368 int rc = aWebProgress.GetDOMWindow (&domWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2369 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2370 if (domWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2371 |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2372 //nsIDOMWindow domWindow = new nsIDOMWindow (aDOMWindow[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2373 //int /*long*/[] aTop = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2374 nsIDOMWindow topWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2375 rc = domWindow.GetTop (&topWindow); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2376 if (rc !is XPCOM.NS_OK) error (rc); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2377 if (topWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2378 domWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2379 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2380 //nsIDOMWindow topWindow = new nsIDOMWindow (aTop[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2381 topWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2382 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2383 //nsIURI location = new nsIURI (aLocation); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2384 scope auto aSpec = new nsEmbedCString; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2385 aLocation.GetSpec (cast(nsACString*)aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2386 //int length = XPCOM.nsEmbedCString_Length (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2387 //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2388 //byte[] dest = new byte[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2389 //XPCOM.memmove (dest, buffer, length); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2390 //XPCOM.nsEmbedCString_delete (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2391 String url = aSpec.toString; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2392 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2393 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2394 * As of Mozilla 1.8, the first time that a page is displayed, regardless of |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2395 * whether it's via Browser.setURL() or Browser.setText(), the GRE navigates |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2396 * to about:blank and fires the corresponding navigation events. Do not send |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2397 * this event on to the user since it is not expected. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2398 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2399 if (!IsPre_1_8 && aRequest is null && url.startsWith (ABOUT_BLANK)) return XPCOM.NS_OK; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2400 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2401 LocationEvent event = new LocationEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2402 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2403 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2404 event.location = url; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2405 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2406 * If the URI indicates that the page is being rendered from memory |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2407 * (via setText()) then set it to about:blank to be consistent with IE. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2408 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2409 if (event.location.equals (URI_FROMMEMORY)) event.location = ABOUT_BLANK; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2410 event.top = topWindow is domWindow; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2411 for (int i = 0; i < locationListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2412 locationListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2413 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2414 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2415 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2416 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2417 extern(System) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2418 nsresult OnStatusChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsresult aStatus, PRUnichar* aMessage) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2419 if (awaitingNavigate || statusTextListeners.length is 0) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2420 StatusTextEvent event = new StatusTextEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2421 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2422 event.widget = browser; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2423 //int length = XPCOM.strlen_PRUnichar (aMessage); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2424 //char[] dest = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2425 //XPCOM.memmove (dest, aMessage, length * 2); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2426 event.text = Utf.toString(fromString16z(aMessage)); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2427 for (int i = 0; i < statusTextListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2428 statusTextListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2429 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2430 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2431 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2432 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2433 extern(System) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2434 nsresult OnSecurityChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 state) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2435 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2436 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2437 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2438 /* nsIWebBrowserChrome */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2439 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2440 extern(System) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2441 nsresult SetStatus (PRUint32 statusType, PRUnichar* status) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2442 if (awaitingNavigate || statusTextListeners.length is 0) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2443 StatusTextEvent event = new StatusTextEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2444 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2445 event.widget = browser; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2446 //int length = XPCOM.strlen_PRUnichar (status); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2447 //char[] dest = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2448 //XPCOM.memmove (dest, status, length * 2); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2449 //String string = new String (dest); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2450 event.text = Utf.toString(fromString16z(status)); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2451 for (int i = 0; i < statusTextListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2452 statusTextListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2453 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2454 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2455 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2456 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2457 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2458 nsresult GetWebBrowser (nsIWebBrowser* aWebBrowser) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2459 //int /*long*/[] ret = new int /*long*/[1]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2460 if (webBrowser !is null) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2461 webBrowser.AddRef (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2462 *aWebBrowser = webBrowser; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2463 } |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2464 //XPCOM.memmove (aWebBrowser, ret, C.PTR_SIZEOF); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2465 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2466 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2467 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2468 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2469 nsresult SetWebBrowser (nsIWebBrowser aWebBrowser) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2470 if (webBrowser !is null) webBrowser.Release (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2471 webBrowser = aWebBrowser !is null ? cast(nsIWebBrowser)cast(void*)aWebBrowser : null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2472 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2473 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2474 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2475 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2476 nsresult GetChromeFlags (PRUint32* aChromeFlags) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2477 //int[] ret = new int[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2478 *aChromeFlags = chromeFlags; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2479 //XPCOM.memmove (aChromeFlags, ret, 4); /* PRUint32 */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2480 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2481 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2482 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2483 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2484 nsresult SetChromeFlags (PRUint32 aChromeFlags) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2485 chromeFlags = aChromeFlags; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2486 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2487 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2488 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2489 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2490 nsresult DestroyBrowserWindow () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2491 WindowEvent newEvent = new WindowEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2492 newEvent.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2493 newEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2494 for (int i = 0; i < closeWindowListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2495 closeWindowListeners[i].close (newEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2496 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2497 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2498 * Note on Mozilla. The DestroyBrowserWindow notification cannot be cancelled. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2499 * The browser widget cannot be used after this notification has been received. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2500 * The application is advised to close the window hosting the browser widget. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2501 * The browser widget must be disposed in all cases. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2502 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2503 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2504 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2505 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2506 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2507 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2508 nsresult SizeBrowserTo (PRInt32 aCX, PRInt32 aCY) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2509 size = new Point (aCX, aCY); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2510 bool isChrome = (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) !is 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2511 if (isChrome) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2512 Shell shell = browser.getShell (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2513 shell.setSize (shell.computeSize (size.x, size.y)); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2514 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2515 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2516 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2517 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2518 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2519 nsresult ShowAsModal () { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2520 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2521 nsIServiceManager serviceManager; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2522 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2523 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2524 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2525 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2526 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2527 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2528 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2529 nsIJSContextStack stack; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2530 rc = serviceManager.GetServiceByContractID (XPCOM.NS_CONTEXTSTACK_CONTRACTID.ptr, &nsIJSContextStack.IID, cast(void**)&stack); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2531 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2532 if (stack is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2533 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2534 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2535 //nsIJSContextStack stack = new nsIJSContextStack (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2536 //result[0] = 0; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2537 rc = stack.Push (null); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2538 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2539 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2540 Shell shell = browser.getShell (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2541 Display display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2542 while (!shell.isDisposed ()) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2543 if (!display.readAndDispatch ()) display.sleep (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2544 } |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2545 JSContext* result; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2546 rc = stack.Pop (&result); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2547 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2548 stack.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2549 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2550 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2551 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2552 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2553 nsresult IsWindowModal (PRBool* retval) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2554 *retval = (chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) !is 0 ? 1 : 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2555 //XPCOM.memmove (retval, new int[] {result}, 4); /* PRBool */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2556 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2557 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2558 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2559 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2560 nsresult ExitModalEventLoop (nsresult aStatus) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2561 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2562 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2563 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2564 /* nsIEmbeddingSiteWindow */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2565 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2566 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2567 nsresult SetDimensions (PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2568 if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_POSITION) !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2569 location = new Point (x, y); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2570 browser.getShell ().setLocation (x, y); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2571 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2572 if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_SIZE_INNER) !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2573 browser.setSize (cx, cy); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2574 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2575 if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_SIZE_OUTER) !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2576 browser.getShell ().setSize (cx, cy); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2577 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2578 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2579 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2580 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2581 extern(System) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2582 nsresult GetDimensions (PRUint32 flags, PRInt32* x, PRInt32* y, PRInt32* cx, PRInt32* cy) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2583 if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_POSITION) !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2584 Point location = browser.getShell ().getLocation (); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2585 if (x !is null) *x = location.x; /* PRInt32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2586 if (y !is null) *y = location.y; /* PRInt32 */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2587 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2588 if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_SIZE_INNER) !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2589 Point size = browser.getSize (); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2590 if (cx !is null) *cx = size.x; /* PRInt32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2591 if (cy !is null) *cy = size.y; /* PRInt32 */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2592 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2593 if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_SIZE_OUTER) !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2594 Point size = browser.getShell().getSize (); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2595 if (cx !is null) *cx = size.x; /* PRInt32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2596 if (cy !is null) *cy = size.y; /* PRInt32 */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2597 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2598 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2599 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2600 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2601 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2602 nsresult SetFocus () { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2603 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2604 nsIBaseWindow baseWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2605 int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2606 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2607 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2608 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2609 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2610 rc = baseWindow.SetFocus (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2611 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2612 baseWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2613 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2614 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2615 * Note. Mozilla notifies here that one of the children took |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2616 * focus. This could or should be used to fire an DWT.FOCUS_IN |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2617 * event on Browser focus listeners. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2618 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2619 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2620 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2621 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2622 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2623 nsresult GetVisibility (PRBool* aVisibility) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2624 bool visible = browser.isVisible () && !browser.getShell ().getMinimized (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2625 *aVisibility = visible ? 1 : 0; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2626 //XPCOM.memmove (aVisibility, new int[] {visible ? 1 : 0}, 4); /* PRBool */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2627 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2628 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2629 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2630 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2631 nsresult SetVisibility (PRBool aVisibility) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2632 if (isChild) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2633 WindowEvent event = new WindowEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2634 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2635 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2636 if (aVisibility !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2637 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2638 * Bug in Mozilla. When the JavaScript window.open is executed, Mozilla |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2639 * fires multiple SetVisibility 1 notifications. The workaround is |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2640 * to ignore subsequent notifications. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2641 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2642 if (!visible) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2643 visible = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2644 event.location = location; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2645 event.size = size; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2646 event.addressBar = (chromeFlags & nsIWebBrowserChrome.CHROME_LOCATIONBAR) !is 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2647 event.menuBar = (chromeFlags & nsIWebBrowserChrome.CHROME_MENUBAR) !is 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2648 event.statusBar = (chromeFlags & nsIWebBrowserChrome.CHROME_STATUSBAR) !is 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2649 event.toolBar = (chromeFlags & nsIWebBrowserChrome.CHROME_TOOLBAR) !is 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2650 for (int i = 0; i < visibilityWindowListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2651 visibilityWindowListeners[i].show (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2652 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2653 location = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2654 size = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2655 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2656 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2657 visible = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2658 for (int i = 0; i < visibilityWindowListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2659 visibilityWindowListeners[i].hide (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2660 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2661 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2662 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2663 visible = aVisibility !is 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2664 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2665 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2666 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2667 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2668 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2669 nsresult GetTitle (PRUnichar** aTitle) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2670 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2671 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2672 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2673 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2674 nsresult SetTitle (PRUnichar* aTitle) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2675 if (awaitingNavigate || titleListeners.length is 0) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2676 TitleEvent event = new TitleEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2677 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2678 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2679 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2680 * To be consistent with other platforms the title event should |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2681 * contain the page's url if the page does not contain a <title> |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2682 * tag. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2683 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2684 int length = XPCOM.strlen_PRUnichar (aTitle); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2685 if (length > 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2686 //char[] dest = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2687 //XPCOM.memmove (dest, aTitle, length * 2); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2688 event.title = Utf.toString(fromString16z(aTitle)); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2689 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2690 event.title = getUrl (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2691 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2692 for (int i = 0; i < titleListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2693 titleListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2694 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2695 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2696 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2697 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2698 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2699 nsresult GetSiteWindow (void** aSiteWindow) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2700 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2701 * Note. The handle is expected to be an HWND on Windows and |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2702 * a GtkWidget* on GTK. This callback is invoked on Windows |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2703 * when the javascript window.print is invoked and the print |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2704 * dialog comes up. If no handle is returned, the print dialog |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2705 * does not come up on this platform. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2706 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2707 *aSiteWindow = cast(void*) embedHandle; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2708 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2709 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2710 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2711 /* nsIWebBrowserChromeFocus */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2712 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2713 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2714 nsresult FocusNextElement () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2715 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2716 * Bug in Mozilla embedding API. Mozilla takes back the focus after sending |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2717 * this event. This prevents tabbing out of Mozilla. This behaviour can be reproduced |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2718 * with the Mozilla application TestGtkEmbed. The workaround is to |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2719 * send the traversal notification after this callback returns. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2720 */ |
340 | 2721 browser.getDisplay ().asyncExec (new class() Runnable { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2722 public void run () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2723 if (browser.isDisposed ()) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2724 browser.traverse (DWT.TRAVERSE_TAB_NEXT); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2725 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2726 }); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2727 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2728 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2729 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2730 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2731 nsresult FocusPrevElement () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2732 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2733 * Bug in Mozilla embedding API. Mozilla takes back the focus after sending |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2734 * this event. This prevents tabbing out of Mozilla. This behaviour can be reproduced |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2735 * with the Mozilla application TestGtkEmbed. The workaround is to |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2736 * send the traversal notification after this callback returns. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2737 */ |
340 | 2738 browser.getDisplay ().asyncExec (new class() Runnable { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2739 public void run () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2740 if (browser.isDisposed ()) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2741 browser.traverse (DWT.TRAVERSE_TAB_PREVIOUS); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2742 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2743 }); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2744 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2745 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2746 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2747 /* nsIContextMenuListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2748 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2749 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2750 nsresult OnShowContextMenu (PRUint32 aContextFlags, nsIDOMEvent aEvent, nsIDOMNode aNode) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2751 if (awaitingNavigate) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2752 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2753 //nsIDOMEvent domEvent = new nsIDOMEvent (aEvent); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2754 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2755 nsIDOMMouseEvent domMouseEvent; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2756 int rc = aEvent.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2757 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2758 if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2759 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2760 //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2761 PRInt32 aScreenX, aScreenY; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2762 rc = domMouseEvent.GetScreenX (&aScreenX); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2763 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2764 rc = domMouseEvent.GetScreenY (&aScreenY); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2765 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2766 domMouseEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2767 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2768 Event event; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2769 event.x = aScreenX; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2770 event.y = aScreenY; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2771 browser.notifyListeners (DWT.MenuDetect, event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2772 if (!event.doit) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2773 Menu menu = browser.getMenu (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2774 if (menu !is null && !menu.isDisposed ()) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2775 if (aScreenX !is event.x || aScreenY !is event.y) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2776 menu.setLocation (event.x, event.y); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2777 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2778 menu.setVisible (true); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2779 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2780 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2781 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2782 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2783 /* nsIURIContentListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2784 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2785 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2786 nsresult OnStartURIOpen (nsIURI aURI, PRBool* retval) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2787 if (awaitingNavigate || locationListeners.length is 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2788 *retval = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2789 //XPCOM.memmove (retval, new int[] {0}, 4); /* PRBool */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2790 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2791 } |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2792 //nsIURI location = new nsIURI (aURI); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2793 scope auto aSpec = new nsEmbedCString; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2794 aURI.GetSpec (cast(nsACString*)aSpec); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2795 //int length = XPCOM.nsEmbedCString_Length (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2796 //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2797 //buffer = XPCOM.nsEmbedCString_get (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2798 //byte[] dest = new byte[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2799 //XPCOM.memmove (dest, buffer, length); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2800 //XPCOM.nsEmbedCString_delete (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2801 String value = aSpec.toString; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2802 bool doit = true; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2803 if (request is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2804 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2805 * listeners should not be notified of internal transitions like "javascipt:..." |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2806 * because this is an implementation side-effect, not a true navigate |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2807 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2808 if (!value.startsWith (PREFIX_JAVASCRIPT)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2809 LocationEvent event = new LocationEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2810 event.display = browser.getDisplay(); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2811 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2812 event.location = value; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2813 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2814 * If the URI indicates that the page is being rendered from memory |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2815 * (via setText()) then set it to about:blank to be consistent with IE. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2816 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2817 if (event.location.equals (URI_FROMMEMORY)) event.location = ABOUT_BLANK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2818 event.doit = doit; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2819 for (int i = 0; i < locationListeners.length; i++) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2820 locationListeners[i].changing (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2821 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2822 doit = event.doit && !browser.isDisposed(); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2823 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2824 } |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2825 *retval = doit ? 0 : 1; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2826 //XPCOM.memmove (retval, new int[] {doit ? 0 : 1}, 4); /* PRBool */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2827 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2828 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2829 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2830 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2831 nsresult DoContent (char* aContentType, PRBool aIsContentPreferred, nsIRequest aRequest, nsIStreamListener* aContentHandler, PRBool* retval) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2832 return XPCOM.NS_ERROR_NOT_IMPLEMENTED; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2833 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2834 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2835 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2836 nsresult IsPreferred (char* aContentType, char** aDesiredContentType, PRBool* retval) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2837 bool preferred = false; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2838 auto size = strlen (aContentType); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2839 if (size > 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2840 //byte[] typeBytes = new byte[size + 1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2841 //XPCOM.memmove (typeBytes, aContentType, size); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2842 String contentType = fromStringz(aContentType); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2843 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2844 /* do not attempt to handle known problematic content types */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2845 if (!contentType.equals (XPCOM.CONTENT_MAYBETEXT) && !contentType.equals (XPCOM.CONTENT_MULTIPART)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2846 /* determine whether browser can handle the content type */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2847 // int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2848 nsIServiceManager serviceManager; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2849 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2850 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2851 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2852 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2853 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2854 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2855 /* First try to use the nsIWebNavigationInfo if it's available (>= mozilla 1.8) */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2856 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WEBNAVIGATIONINFO_CONTRACTID, true); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2857 nsIWebNavigationInfo info; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2858 rc = serviceManager.GetServiceByContractID (XPCOM.NS_WEBNAVIGATIONINFO_CONTRACTID.ptr, &nsIWebNavigationInfo.IID, cast(void**)&info); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2859 if (rc is 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2860 //byte[] bytes = MozillaDelegate.wcsToMbcs (null, contentType, true); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2861 scope auto typePtr = new nsEmbedCString(contentType); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2862 //nsIWebNavigationInfo info = new nsIWebNavigationInfo (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2863 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2864 PRUint32 isSupportedResult; /* PRUint32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2865 rc = info.IsTypeSupported (cast(nsACString*)typePtr, null, &isSupportedResult); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2866 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2867 info.Release (); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2868 //XPCOM.nsEmbedCString_delete (typePtr); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2869 preferred = isSupportedResult !is 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2870 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2871 /* nsIWebNavigationInfo is not available, so do the type lookup */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2872 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2873 nsICategoryManager categoryManager; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2874 rc = serviceManager.GetService (&XPCOM.NS_CATEGORYMANAGER_CID, &nsICategoryManager.IID, cast(void**)&categoryManager); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2875 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2876 if (categoryManager is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2877 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2878 //nsICategoryManager categoryManager = new nsICategoryManager (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2879 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2880 char* categoryBytes = "Gecko-Content-Viewers"; //$NON-NLS-1$ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2881 char* result; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2882 rc = categoryManager.GetCategoryEntry (categoryBytes, aContentType, &result); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2883 categoryManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2884 /* if no viewer for the content type is registered then rc is XPCOM.NS_ERROR_NOT_AVAILABLE */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2885 preferred = rc is XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2886 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2887 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2888 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2889 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2890 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2891 *retval = preferred ? 1 : 0; /* PRBool */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2892 if (preferred) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2893 *aDesiredContentType = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2894 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2895 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2896 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2897 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2898 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2899 nsresult CanHandleContent (char* aContentType, PRBool aIsContentPreferred, char** aDesiredContentType, PRBool* retval) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2900 return XPCOM.NS_ERROR_NOT_IMPLEMENTED; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2901 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2902 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2903 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2904 nsresult GetLoadCookie (nsISupports* aLoadCookie) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2905 return XPCOM.NS_ERROR_NOT_IMPLEMENTED; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2906 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2907 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2908 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2909 nsresult SetLoadCookie (nsISupports aLoadCookie) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2910 return XPCOM.NS_ERROR_NOT_IMPLEMENTED; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2911 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2912 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2913 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2914 nsresult GetParentContentListener (nsIURIContentListener* aParentContentListener) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2915 return XPCOM.NS_ERROR_NOT_IMPLEMENTED; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2916 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2917 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2918 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2919 nsresult SetParentContentListener (nsIURIContentListener aParentContentListener) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2920 return XPCOM.NS_ERROR_NOT_IMPLEMENTED; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2921 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2922 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2923 /* nsITooltipListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2924 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2925 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2926 nsresult OnShowTooltip (PRInt32 aXCoords, PRInt32 aYCoords, PRUnichar* aTipText) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2927 if (awaitingNavigate) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2928 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2929 //int length = XPCOM.strlen_PRUnichar (aTipText); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2930 //char[] dest = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2931 //XPCOM.memmove (dest, aTipText, length * 2); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2932 String text = Utf.toString(fromString16z(aTipText)); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2933 if (tip !is null && !tip.isDisposed ()) tip.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2934 Display display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2935 Shell parent = browser.getShell (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2936 tip = new Shell (parent, DWT.ON_TOP); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2937 tip.setLayout (new FillLayout()); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2938 Label label = new Label (tip, DWT.CENTER); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2939 label.setForeground (display.getSystemColor (DWT.COLOR_INFO_FOREGROUND)); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2940 label.setBackground (display.getSystemColor (DWT.COLOR_INFO_BACKGROUND)); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2941 label.setText (text); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2942 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2943 * Bug in Mozilla embedded API. Tooltip coordinates are wrong for |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2944 * elements inside an inline frame (IFrame tag). The workaround is |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2945 * to position the tooltip based on the mouse cursor location. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2946 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2947 Point point = display.getCursorLocation (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2948 /* Assuming cursor is 21x21 because this is the size of |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2949 * the arrow cursor on Windows |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2950 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2951 point.y += 21; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2952 tip.setLocation (point); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2953 tip.pack (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2954 tip.setVisible (true); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2955 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2956 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2957 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2958 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2959 nsresult OnHideTooltip () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2960 if (tip !is null && !tip.isDisposed ()) tip.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2961 tip = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2962 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2963 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2964 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2965 /* nsIDOMEventListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2966 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2967 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2968 nsresult HandleEvent (nsIDOMEvent event) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2969 //nsIDOMEvent domEvent = new nsIDOMEvent (event); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2970 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2971 scope auto type = new nsEmbedString; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2972 int rc = event.GetType (cast(nsAString*)type); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2973 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2974 //int length = XPCOM.nsEmbedString_Length (type); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2975 //int /*long*/ buffer = XPCOM.nsEmbedString_get (type); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2976 //char[] chars = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2977 //XPCOM.memmove (chars, buffer, length * 2); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2978 String typeString = type.toString; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2979 //XPCOM.nsEmbedString_delete (type); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2980 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2981 if (XPCOM.DOMEVENT_UNLOAD.equals (typeString)) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2982 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2983 nsIDOMEventTarget target; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2984 rc = event.GetCurrentTarget (&target); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2985 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2986 if (target is null) error (XPCOM.NS_NOINTERFACE); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2987 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2988 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2989 unhookDOMListeners (target); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2990 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2991 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2992 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2993 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2994 if (XPCOM.DOMEVENT_FOCUS.equals (typeString)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2995 mozDelegate.handleFocus (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2996 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2997 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2998 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2999 if (XPCOM.DOMEVENT_KEYDOWN.equals (typeString)) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3000 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3001 nsIDOMKeyEvent domKeyEvent; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3002 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3003 if (rc !is XPCOM.NS_OK) error (rc); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
3004 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3005 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3006 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3007 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3008 PRUint32 aKeyCode; /* PRUint32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3009 rc = domKeyEvent.GetKeyCode (&aKeyCode); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3010 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3011 int keyCode = super.translateKey (aKeyCode); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3012 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3013 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3014 * if keyCode is lastKeyCode then either a repeating key like Shift |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3015 * is being held or a key for which key events are not sent has been |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3016 * pressed. In both of these cases a KeyDown should not be sent. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3017 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3018 if (keyCode !is lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3019 lastKeyCode = keyCode; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3020 switch (keyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3021 case DWT.SHIFT: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3022 case DWT.CONTROL: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3023 case DWT.ALT: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3024 case DWT.CAPS_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3025 case DWT.NUM_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3026 case DWT.SCROLL_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3027 case DWT.COMMAND: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3028 /* keypress events will not be received for these keys, so send KeyDowns for them now */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3029 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3030 rc = domKeyEvent.GetAltKey (&aAltKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3031 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3032 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3033 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3034 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3035 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3036 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3037 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3038 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3039 Event keyEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3040 keyEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3041 keyEvent.type = DWT.KeyDown; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3042 keyEvent.keyCode = keyCode; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3043 keyEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3044 keyEvent.stateMask &= ~keyCode; /* remove current keydown if it's a state key */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3045 browser.notifyListeners (keyEvent.type, keyEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3046 if (!keyEvent.doit) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3047 event.PreventDefault (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3048 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3049 break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3050 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3051 default: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3052 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3053 * If the keydown has Meta (but not Meta+Ctrl) as a modifier then send a KeyDown event for it here |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3054 * because a corresponding keypress event will not be received for it from the DOM. If the keydown |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3055 * does not have Meta as a modifier, or has Meta+Ctrl as a modifier, then then do nothing here |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3056 * because its KeyDown event will be sent from the keypress listener. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3057 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3058 PRBool aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3059 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3060 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3061 if (aMetaKey !is 0) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3062 PRBool aCtrlKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3063 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3064 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3065 if (aCtrlKey is 0) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3066 PRBool aAltKey, aShiftKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3067 rc = domKeyEvent.GetAltKey (&aAltKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3068 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3069 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3070 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3071 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3072 Event keyEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3073 keyEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3074 keyEvent.type = DWT.KeyDown; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3075 keyEvent.keyCode = lastKeyCode; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3076 keyEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0? DWT.CTRL : 0) | (aShiftKey !is 0? DWT.SHIFT : 0) | (aMetaKey !is 0? DWT.COMMAND : 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3077 browser.notifyListeners (keyEvent.type, keyEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3078 if (!keyEvent.doit) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3079 event.PreventDefault (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3080 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3081 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3082 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3083 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3084 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3085 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3086 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3087 domKeyEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3088 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3089 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3090 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3091 if (XPCOM.DOMEVENT_KEYPRESS.equals (typeString)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3092 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3093 * if keydown could not determine a keycode for this key then it's a |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3094 * key for which key events are not sent (eg.- the Windows key) |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3095 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3096 if (lastKeyCode is 0) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3097 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3098 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3099 * On linux only, unexpected keypress events are received for some |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3100 * modifier keys. The workaround is to ignore these events since |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3101 * KeyDown events are sent for these keys in the keydown listener. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3102 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3103 switch (lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3104 case DWT.CAPS_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3105 case DWT.NUM_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3106 case DWT.SCROLL_LOCK: return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3107 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3108 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3109 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3110 nsIDOMKeyEvent domKeyEvent; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3111 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3112 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3113 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3114 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3115 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3116 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3117 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3118 rc = domKeyEvent.GetAltKey (&aAltKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3119 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3120 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3121 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3122 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3123 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3124 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3125 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3126 domKeyEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3127 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3128 PRUint32 aCharCode; /* PRUint32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3129 rc = domKeyEvent.GetCharCode (&aCharCode); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3130 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3131 lastCharCode = aCharCode; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3132 if (lastCharCode is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3133 switch (lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3134 case DWT.TAB: lastCharCode = DWT.TAB; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3135 case DWT.CR: lastCharCode = DWT.CR; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3136 case DWT.BS: lastCharCode = DWT.BS; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3137 case DWT.ESC: lastCharCode = DWT.ESC; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3138 case DWT.DEL: lastCharCode = DWT.DEL; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3139 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3140 } |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3141 if (aCtrlKey !is 0 && (0 <= lastCharCode && lastCharCode <= 0x7F)) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3142 if ('a' <= lastCharCode && lastCharCode <= 'z') lastCharCode -= 'a' - 'A'; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3143 if (64 <= lastCharCode && lastCharCode <= 95) lastCharCode -= 64; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3144 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3145 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3146 Event keyEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3147 keyEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3148 keyEvent.type = DWT.KeyDown; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3149 keyEvent.keyCode = lastKeyCode; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3150 keyEvent.character = cast(wchar)lastCharCode; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3151 keyEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3152 browser.notifyListeners (keyEvent.type, keyEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3153 if (!keyEvent.doit) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3154 event.PreventDefault (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3155 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3156 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3157 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3158 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3159 if (XPCOM.DOMEVENT_KEYUP.equals (typeString)) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3160 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3161 nsIDOMKeyEvent domKeyEvent; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3162 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3163 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3164 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3165 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3166 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3167 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3168 PRUint32 aKeyCode; /* PRUint32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3169 rc = domKeyEvent.GetKeyCode (&aKeyCode); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3170 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3171 int keyCode = super.translateKey (aKeyCode); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3172 if (keyCode is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3173 /* indicates a key for which key events are not sent */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3174 domKeyEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3175 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3176 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3177 if (keyCode !is lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3178 /* keyup does not correspond to the last keydown */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3179 lastKeyCode = keyCode; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3180 lastCharCode = 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3181 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3182 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3183 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3184 rc = domKeyEvent.GetAltKey (&aAltKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3185 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3186 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3187 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3188 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3189 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3190 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3191 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3192 domKeyEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3193 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3194 Event keyEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3195 keyEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3196 keyEvent.type = DWT.KeyUp; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3197 keyEvent.keyCode = lastKeyCode; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3198 keyEvent.character = cast(wchar)lastCharCode; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3199 keyEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3200 switch (lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3201 case DWT.SHIFT: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3202 case DWT.CONTROL: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3203 case DWT.ALT: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3204 case DWT.COMMAND: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3205 keyEvent.stateMask |= lastKeyCode; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3206 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3207 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3208 browser.notifyListeners (keyEvent.type, keyEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3209 if (!keyEvent.doit) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3210 event.PreventDefault (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3211 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3212 lastKeyCode = lastCharCode = 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3213 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3214 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3215 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3216 /* mouse event */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3217 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3218 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3219 nsIDOMMouseEvent domMouseEvent; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3220 rc = event.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3221 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3222 if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3223 //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3224 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3225 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3226 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3227 * MouseOver and MouseOut events are fired any time the mouse enters or exits |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3228 * any element within the Browser. To ensure that DWT events are only |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3229 * fired for mouse movements into or out of the Browser, do not fire an |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3230 * event if the element being exited (on MouseOver) or entered (on MouseExit) |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3231 * is within the Browser. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3232 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3233 if (XPCOM.DOMEVENT_MOUSEOVER.equals (typeString) || XPCOM.DOMEVENT_MOUSEOUT.equals (typeString)) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3234 nsIDOMEventTarget eventTarget; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3235 rc = domMouseEvent.GetRelatedTarget (&eventTarget); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3236 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3237 if (eventTarget !is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3238 domMouseEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3239 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3240 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3241 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3242 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3243 PRInt32 aClientX, aClientY, aDetail; /* PRInt32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3244 rc = domMouseEvent.GetClientX (&aClientX); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3245 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3246 rc = domMouseEvent.GetClientY (&aClientY); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3247 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3248 rc = domMouseEvent.GetDetail (&aDetail); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3249 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3250 PRUint16 aButton; /* PRUint16 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3251 rc = domMouseEvent.GetButton (&aButton); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3252 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3253 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3254 rc = domMouseEvent.GetAltKey (&aAltKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3255 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3256 rc = domMouseEvent.GetCtrlKey (&aCtrlKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3257 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3258 rc = domMouseEvent.GetShiftKey (&aShiftKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3259 if (rc !is XPCOM.NS_OK) error (rc); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3260 rc = domMouseEvent.GetMetaKey (&aMetaKey); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3261 if (rc !is XPCOM.NS_OK) error (rc); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3262 domMouseEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3263 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3264 Event mouseEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3265 mouseEvent.widget = browser; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3266 mouseEvent.x = aClientX; mouseEvent.y = aClientY; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3267 mouseEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3268 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3269 if (XPCOM.DOMEVENT_MOUSEDOWN.equals (typeString)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3270 mozDelegate.handleMouseDown (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3271 mouseEvent.type = DWT.MouseDown; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3272 mouseEvent.button = aButton + 1; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3273 mouseEvent.count = aDetail; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3274 } else if (XPCOM.DOMEVENT_MOUSEUP.equals (typeString)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3275 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3276 * Bug on OSX. For some reason multiple mouseup events come from the DOM |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3277 * when button 3 is released on OSX. The first of these events has a count |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3278 * detail and the others do not. The workaround is to not fire received |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3279 * button 3 mouseup events that do not have a count since mouse events |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3280 * without a click count are not valid. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3281 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3282 int button = aButton + 1; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3283 int count = aDetail; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3284 if (count is 0 && button is 3) return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3285 mouseEvent.type = DWT.MouseUp; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3286 mouseEvent.button = button; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3287 mouseEvent.count = count; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3288 } else if (XPCOM.DOMEVENT_MOUSEMOVE.equals (typeString)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3289 mouseEvent.type = DWT.MouseMove; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3290 } else if (XPCOM.DOMEVENT_MOUSEWHEEL.equals (typeString)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3291 mouseEvent.type = DWT.MouseWheel; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3292 mouseEvent.count = -aDetail; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3293 } else if (XPCOM.DOMEVENT_MOUSEOVER.equals (typeString)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3294 mouseEvent.type = DWT.MouseEnter; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3295 } else if (XPCOM.DOMEVENT_MOUSEOUT.equals (typeString)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3296 mouseEvent.type = DWT.MouseExit; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3297 } else if (XPCOM.DOMEVENT_MOUSEDRAG.equals (typeString)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3298 mouseEvent.type = DWT.DragDetect; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3299 mouseEvent.button = aButton + 1; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3300 switch (mouseEvent.button) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3301 case 1: mouseEvent.stateMask |= DWT.BUTTON1; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3302 case 2: mouseEvent.stateMask |= DWT.BUTTON2; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3303 case 3: mouseEvent.stateMask |= DWT.BUTTON3; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3304 case 4: mouseEvent.stateMask |= DWT.BUTTON4; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3305 case 5: mouseEvent.stateMask |= DWT.BUTTON5; break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3306 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3307 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3308 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3309 browser.notifyListeners (mouseEvent.type, mouseEvent); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3310 if (aDetail is 2 && XPCOM.DOMEVENT_MOUSEDOWN.equals (typeString)) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3311 mouseEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3312 mouseEvent.widget = browser; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3313 mouseEvent.x = aClientX; mouseEvent.y = aClientY; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3314 mouseEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3315 mouseEvent.type = DWT.MouseDoubleClick; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3316 mouseEvent.button = aButton + 1; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3317 mouseEvent.count = aDetail; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3318 browser.notifyListeners (mouseEvent.type, mouseEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3319 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3320 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3321 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3322 } |