Mercurial > projects > dwt-linux
annotate dwt/browser/Mozilla.d @ 352:a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
author | John Reimer <terminal.node@gmail.com> |
---|---|
date | Tue, 04 Nov 2008 21:20:45 -0800 |
parents | 373b48b9eaf0 |
children | 59b54fea05d0 |
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 |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
18 import tango.io.Stdout; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
19 import tango.text.convert.Format; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
20 import tango.io.Console; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
21 import tango.sys.Environment; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
22 import tango.stdc.string; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
23 |
340 | 24 import dwt.internal.c.gtk; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
25 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
26 import dwt.DWT; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
27 import dwt.DWTError; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
28 import dwt.graphics.Device; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
29 import dwt.graphics.Point; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
30 import dwt.graphics.Rectangle; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
31 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
32 import dwt.browser.Browser; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
33 import dwt.browser.WebBrowser; |
340 | 34 import dwt.browser.MozillaDelegate; |
35 import dwt.browser.AppFileLocProvider; | |
36 import dwt.browser.WindowCreator2; | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
37 import dwt.browser.PromptService2Factory; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
38 import dwt.browser.HelperAppLauncherDialogFactory; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
39 import dwt.browser.DownloadFactory; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
40 import dwt.browser.DownloadFactory_1_8; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
41 import dwt.browser.FilePickerFactory; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
42 import dwt.browser.FilePickerFactory_1_8; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
43 import dwt.browser.InputStream; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
44 import dwt.browser.StatusTextEvent; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
45 import dwt.browser.ProgressEvent; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
46 import dwt.browser.LocationEvent; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
47 import dwt.browser.WindowEvent; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
48 import dwt.browser.TitleEvent; |
340 | 49 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
50 import dwt.internal.Compatibility; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
51 import dwt.internal.LONG; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
52 import dwt.internal.Library; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
53 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
54 import XPCOM = dwt.internal.mozilla.XPCOM; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
55 import XPCOMInit = dwt.internal.mozilla.XPCOMInit; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
56 |
340 | 57 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
|
58 import dwt.internal.mozilla.nsEmbedString; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
59 import dwt.internal.mozilla.nsIAppShell; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
60 import dwt.internal.mozilla.nsIBaseWindow; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
61 import dwt.internal.mozilla.nsICategoryManager; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
62 import dwt.internal.mozilla.nsIComponentManager; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
63 import dwt.internal.mozilla.nsIComponentRegistrar; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
64 import dwt.internal.mozilla.nsIContextMenuListener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
65 import dwt.internal.mozilla.nsICookie; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
66 import dwt.internal.mozilla.nsICookieManager; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
67 import dwt.internal.mozilla.nsID; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
68 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
|
69 import dwt.internal.mozilla.nsIDOMEvent; |
340 | 70 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
|
71 import dwt.internal.mozilla.nsIDOMEventTarget; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
72 import dwt.internal.mozilla.nsIDOMKeyEvent; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
73 import dwt.internal.mozilla.nsIDOMMouseEvent; |
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; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
75 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
|
76 import dwt.internal.mozilla.nsIDOMWindow; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
77 import dwt.internal.mozilla.nsIDOMWindowCollection; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
78 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
|
79 import dwt.internal.mozilla.nsIDirectoryService; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
80 import dwt.internal.mozilla.nsIDocShell; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
81 import dwt.internal.mozilla.nsIEmbeddingSiteWindow; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
82 import dwt.internal.mozilla.nsIFile; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
83 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
|
84 import dwt.internal.mozilla.nsIIOService; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
85 import dwt.internal.mozilla.nsIInterfaceRequestor; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
86 import dwt.internal.mozilla.nsIJSContextStack; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
87 import dwt.internal.mozilla.nsILocalFile; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
88 import dwt.internal.mozilla.nsIObserverService; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
89 import dwt.internal.mozilla.nsIPrefBranch; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
90 import dwt.internal.mozilla.nsIPrefLocalizedString; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
91 import dwt.internal.mozilla.nsIPrefService; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
92 import dwt.internal.mozilla.nsIProperties; |
286 | 93 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
|
94 import dwt.internal.mozilla.nsIServiceManager; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
95 import dwt.internal.mozilla.nsISimpleEnumerator; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
96 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
|
97 import dwt.internal.mozilla.nsISupports; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
98 import dwt.internal.mozilla.nsITooltipListener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
99 import dwt.internal.mozilla.nsIURI; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
100 import dwt.internal.mozilla.nsIURIContentListener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
101 import dwt.internal.mozilla.nsIWeakReference; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
102 import dwt.internal.mozilla.nsIWebBrowser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
103 import dwt.internal.mozilla.nsIWebBrowserChrome; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
104 import dwt.internal.mozilla.nsIWebBrowserChromeFocus; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
105 import dwt.internal.mozilla.nsIWebBrowserFocus; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
106 import dwt.internal.mozilla.nsIWebNavigation; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
107 import dwt.internal.mozilla.nsIWebNavigationInfo; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
108 import dwt.internal.mozilla.nsIWebProgress; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
109 import dwt.internal.mozilla.nsIWebProgressListener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
110 import dwt.internal.mozilla.nsIWindowWatcher; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
111 import dwt.internal.mozilla.nsIWindowCreator; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
112 import dwt.internal.mozilla.nsStringAPI; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
113 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
114 import dwt.layout.FillLayout; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
115 import dwt.widgets.Composite; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
116 import dwt.widgets.Display; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
117 import dwt.widgets.Event; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
118 import dwt.widgets.Label; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
119 import dwt.widgets.Listener; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
120 import dwt.widgets.Menu; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
121 import dwt.widgets.Shell; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
122 import dwt.widgets.Control; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
123 |
286 | 124 class Mozilla : WebBrowser, |
125 nsIWeakReference, | |
126 nsIWebProgressListener, | |
127 nsIWebBrowserChrome, | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
128 nsIWebBrowserChromeFocus, |
286 | 129 nsIEmbeddingSiteWindow, |
130 nsIInterfaceRequestor, | |
131 nsISupportsWeakReference, | |
132 nsIContextMenuListener, | |
340 | 133 nsIURIContentListener, |
286 | 134 nsITooltipListener, |
340 | 135 nsIDOMEventListener { |
286 | 136 |
137 GtkWidget* embedHandle; | |
138 nsIWebBrowser webBrowser; | |
139 Object webBrowserObject; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
140 MozillaDelegate mozDelegate; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
141 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
142 int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
143 int refCount, lastKeyCode, lastCharCode; |
286 | 144 nsIRequest request; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
145 Point location, size; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
146 bool visible, isChild, ignoreDispose, awaitingNavigate; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
147 Shell tip = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
148 Listener listener; |
286 | 149 nsIDOMWindow[] unhookedDOMWindows; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
150 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
151 static nsIAppShell AppShell; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
152 static AppFileLocProvider LocationProvider; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
153 static WindowCreator2 WindowCreator; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
154 static int BrowserCount; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
155 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
|
156 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
157 /* XULRunner detect constants */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
158 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
|
159 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
|
160 static final bool LowerRangeInclusive = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
161 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
|
162 static final bool UpperRangeInclusive = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
163 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
193 // TEMPORARY CODE |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
194 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
|
195 |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
196 this () { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
197 PROFILE_DIR = SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; |
340 | 198 MozillaClearSessions = new class() Runnable { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
199 public void run () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
200 if (!Initialized) return; |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
201 nsIServiceManager serviceManager; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
202 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
203 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
204 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
205 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
206 //result[0] = 0; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
207 //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
|
208 nsICookieManager manager; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
209 rc = serviceManager.GetServiceByContractID (XPCOM.NS_COOKIEMANAGER_CONTRACTID.ptr, &nsICookieManager.IID, cast(void**)&manager); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
210 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
211 if (manager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
212 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
213 |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
214 //nsICookieManager manager = new nsICookieManager (result[0]); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
215 //result[0] = 0; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
216 nsISimpleEnumerator enumerator; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
217 rc = manager.GetEnumerator (&enumerator); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
218 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
219 manager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
220 |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
221 //nsISimpleEnumerator enumerator = new nsISimpleEnumerator (result[0]); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
222 PRBool moreElements; /* PRBool */ |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
223 rc = enumerator.HasMoreElements (&moreElements); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
224 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
225 while (moreElements !is 0) { |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
226 //result[0] = 0; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
227 nsICookie cookie; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
228 rc = enumerator.GetNext (cast(nsISupports*)&cookie); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
229 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
230 //nsICookie cookie = new nsICookie (result[0]); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
231 PRUint64 expires; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
232 rc = cookie.GetExpires (&expires); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
233 if (expires is 0) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
234 /* indicates a session cookie */ |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
235 scope auto domain = new nsEmbedCString; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
236 scope auto name = new nsEmbedCString; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
237 scope auto path = new nsEmbedCString; |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
238 cookie.GetHost (cast(nsACString*)domain); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
239 cookie.GetName (cast(nsACString*)name); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
240 cookie.GetPath (cast(nsACString*)path); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
241 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
|
242 //XPCOM.nsEmbedCString_delete (domain); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
243 //XPCOM.nsEmbedCString_delete (name); |
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
244 //XPCOM.nsEmbedCString_delete (path); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
245 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
246 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
247 cookie.Release (); |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
248 rc = enumerator.HasMoreElements (&moreElements); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
249 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
250 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
251 enumerator.Release (); |
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 }; |
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 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
256 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
257 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
|
258 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
|
259 Display display = parent.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
260 |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
261 //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
|
262 if (!Initialized) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
263 bool initLoaded = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
264 bool IsXULRunner = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
265 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
266 String greInitialized = System.getProperty (GRE_INITIALIZED); |
340 | 267 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
|
268 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
269 * 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
|
270 * 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
|
271 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
272 Initialized = true; |
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 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
|
275 if (mozillaPath is null) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
276 // 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
|
277 initLoaded = true; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
278 /+ |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
279 if (mozillaPath is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
280 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
281 String libName = mozDelegate.getSWTInitLibraryName (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
282 Library.loadLibrary (libName); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
283 initLoaded = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
284 } catch (UnsatisfiedLinkError e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
285 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
286 * 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
|
287 * 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
|
288 * points at a GRE. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
289 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
290 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
291 +/ |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
292 } else { |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
293 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
|
294 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
|
295 } |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
296 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
297 if (initLoaded) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
298 /* 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
|
299 XPCOMInit.GREVersionRange range; |
304
16ba3d9cb209
Update XPCOM Interfaces; More Mozilla module work
John Reimer<terminal.node@gmail.com>
parents:
298
diff
changeset
|
300 //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
|
301 //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
|
302 //C.memmove (lower, bytes, bytes.length); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
303 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
|
304 range.lowerInclusive = LowerRangeInclusive; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
305 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
306 //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
|
307 //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
|
308 //C.memmove (upper, bytes, bytes.length); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
309 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
|
310 range.upperInclusive = UpperRangeInclusive; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
311 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
312 //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
|
313 //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
|
314 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
|
315 //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
|
316 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
|
317 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
318 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
319 * 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
|
320 * 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
|
321 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
322 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
|
323 //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
|
324 //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
|
325 //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
|
326 //C.memmove (lower, bytes, bytes.length); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
327 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
|
328 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
|
329 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
330 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
331 //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
|
332 //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
|
333 //C.free (propertiesPtr); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
334 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
|
335 /* 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
|
336 //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
|
337 //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
|
338 //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
|
339 //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
|
340 mozillaPath = greBuffer; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
341 IsXULRunner = mozillaPath.length > 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
342 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
343 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
344 * 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
|
345 * 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
|
346 * 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
|
347 * |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
348 * 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
|
349 * 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
|
350 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
351 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
|
352 // 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
|
353 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
|
354 if (rc !is XPCOM.NS_OK) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
355 mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS)); |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
356 if (Device.DEBUG) Cerr ("cannot use detected XULRunner: ") (mozillaPath).newline; //$NON-NLS-1$ |
352
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
357 |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
358 /* attempt to XPCOMGlueStartup the GRE pointed at by MOZILLA_FIVE_HOME */ |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
359 auto ptr = Environment.get(XPCOM.MOZILLA_FIVE_HOME); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
360 if (ptr is null) { |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
361 IsXULRunner = false; |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
362 } else { |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
363 //length = C.strlen (ptr); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
364 //byte[] buffer = new byte[length]; |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
365 //C.memmove (buffer, ptr, length); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
366 mozillaPath = ptr; |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
367 /* |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
368 * Attempting to XPCOMGlueStartup a mozilla-based GRE !is xulrunner can |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
369 * crash, so don't attempt unless the GRE appears to be xulrunner. |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
370 */ |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
371 if (mozillaPath.indexOf("xulrunner") is -1) { //$NON-NLS-1$ |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
372 IsXULRunner = false; |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
373 |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
374 } else { |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
375 mozillaPath ~= SEPARATOR_OS ~ mozDelegate.getLibraryName (); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
376 rc = XPCOMInit.XPCOMGlueStartup (toStringz(mozillaPath)); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
377 if (rc !is XPCOM.NS_OK) { |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
378 IsXULRunner = false; |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
379 mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS)); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
380 if (Device.DEBUG) Cerr ("failed to start as XULRunner: " )(mozillaPath).newline; //$NON-NLS-1$ |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
381 } |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
382 } |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
383 } |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
384 } |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
385 if (IsXULRunner) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
386 XPCOMInitWasGlued = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
387 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
388 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
389 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
390 //C.free (greBuffer); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
391 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
392 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
393 if (IsXULRunner) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
394 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
|
395 /+ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
396 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
397 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
|
398 } catch (UnsatisfiedLinkError e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
399 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
|
400 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
401 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
402 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
|
403 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
|
404 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
405 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
|
406 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
407 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
408 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
409 +/ // 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
|
410 // 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
|
411 // TODO: determine if |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
412 XPCOMWasGlued = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
413 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
414 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
415 * 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
|
416 * 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
|
417 */ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
418 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
|
419 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
420 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
|
421 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
|
422 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
|
423 " [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
|
424 " [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
|
425 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
|
426 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
427 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
428 /* 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
|
429 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
|
430 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
|
431 //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
|
432 //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
|
433 //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
|
434 mozillaPath = mozFiveHome; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
435 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
436 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
437 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
|
438 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
439 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
|
440 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
441 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
442 * 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
|
443 * 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
|
444 * 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
|
445 * 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
|
446 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
447 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
|
448 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
449 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
|
450 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
451 /+ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
452 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
453 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
|
454 } catch (UnsatisfiedLinkError e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
455 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
456 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
457 * 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
|
458 * 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
|
459 * 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
|
460 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
461 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
|
462 } catch (UnsatisfiedLinkError ex) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
463 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
464 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
465 * 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
|
466 * 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
|
467 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
468 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
|
469 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
470 } |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
471 +/ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
472 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
473 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
474 if (!Initialized) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
475 nsILocalFile localFile; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
476 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
|
477 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
|
478 //pathString.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
479 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
|
480 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
481 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
482 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
483 if (localFile is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
484 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
485 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
|
486 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
487 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
488 LocationProvider = new AppFileLocProvider (mozillaPath); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
489 LocationProvider.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
490 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
491 //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
|
492 nsIDirectoryServiceProvider directoryServiceProvider; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
493 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
|
494 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
|
495 browser.dispose(); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
496 error(rc); |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
497 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
498 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
|
499 localFile.Release (); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
500 LocationProvider.Release(); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
501 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
|
502 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
|
503 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
|
504 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
505 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
|
506 if (IsXULRunner) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
507 System.setProperty (XULRUNNER_PATH, mozillaPath); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
508 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
509 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
510 /+ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
511 /* 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
|
512 if (IsXULRunner) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
513 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
514 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
|
515 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
|
516 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
|
517 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
|
518 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
519 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
|
520 } catch (InvocationTargetException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
521 /* 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
|
522 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
|
523 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
|
524 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
|
525 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
|
526 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
|
527 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
528 } catch (ClassNotFoundException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
529 /* 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
|
530 } catch (NoSuchMethodException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
531 /* 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
|
532 } catch (IllegalArgumentException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
533 } catch (IllegalAccessException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
534 } catch (InvocationTargetException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
535 } catch (InstantiationException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
536 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
537 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
538 +/ |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
539 nsIComponentManager componentManager; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
540 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
|
541 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
|
542 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
543 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
544 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
545 if (componentManager is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
546 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
547 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
548 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
549 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
550 //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
|
551 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
552 if (mozDelegate.needsSpinup ()) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
553 /* 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
|
554 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
|
555 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
|
556 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
|
557 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
558 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
559 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
560 if (AppShell is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
561 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
562 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
563 } |
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 //AppShell = new nsIAppShell (result[0]); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
566 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
|
567 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
|
568 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
569 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
570 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
571 rc = AppShell.Spinup (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
572 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
|
573 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
574 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
575 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
576 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
577 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
578 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
579 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
580 WindowCreator = new WindowCreator2; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
581 WindowCreator.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
582 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
583 nsIServiceManager serviceManager; |
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
584 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
|
585 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
|
586 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
587 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
588 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
589 if (serviceManager is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
590 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
591 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
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 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
594 //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
|
595 //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
|
596 //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
|
597 nsIWindowWatcher windowWatcher; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
598 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
|
599 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
|
600 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
601 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
602 } |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
603 if (windowWatcher is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
604 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
605 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
606 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
607 |
305
c7c696cdfec2
Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
John Reimer<terminal.node@gmail.com>
parents:
304
diff
changeset
|
608 //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
|
609 //result[0] = 0; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
610 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
|
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 (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
613 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
614 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
615 windowWatcher.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
616 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
617 /* 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
|
618 if (LocationProvider !is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
619 nsIDirectoryService directoryService; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
620 //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
|
621 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
|
622 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
|
623 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
624 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
625 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
626 if (directoryService is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
627 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
628 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
629 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
630 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
631 //nsIDirectoryService directoryService = new nsIDirectoryService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
632 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
633 nsIProperties properties; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
634 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
|
635 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
|
636 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
637 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
638 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
639 if (properties is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
640 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
641 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
642 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
643 directoryService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
644 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
645 //nsIProperties properties = new nsIProperties (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
646 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
647 //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
|
648 nsIFile profileDir; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
649 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
|
650 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
|
651 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
652 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
653 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
654 if (profileDir is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
655 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
656 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
657 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
658 properties.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
659 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
660 //nsIFile profileDir = new nsIFile (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
661 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
662 scope auto path = new nsEmbedCString; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
663 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
|
664 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
|
665 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
666 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
667 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
668 //int length = XPCOM.nsEmbedCString_Length (path); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
669 //int /*long*/ ptr = XPCOM.nsEmbedCString_get (path); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
670 //buffer = new byte [length]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
671 //XPCOM.memmove (buffer, ptr, length); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
672 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
|
673 LocationProvider.setProfilePath (profilePath); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
674 LocationProvider.isXULRunner = IsXULRunner; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
675 //XPCOM.nsEmbedCString_delete (path); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
676 profileDir.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
677 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
678 /* 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
|
679 //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
|
680 nsIObserverService observerService; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
681 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
|
682 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
|
683 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
684 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
685 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
686 if (observerService is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
687 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
688 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
689 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
690 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
691 //nsIObserverService observerService = new nsIObserverService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
692 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
693 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_DO_CHANGE, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
694 //length = STARTUP.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
695 //char[] chars = new char [length + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
696 //STARTUP.getChars (0, length, chars, 0); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
697 wchar* chars = STARTUP.toString16().toString16z(); |
335 | 698 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
|
699 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
|
700 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
701 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
702 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
703 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_AFTER_CHANGE, true); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
704 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
|
705 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
|
706 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
707 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
708 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
709 observerService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
710 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
711 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
712 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
713 * 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
|
714 * 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
|
715 * 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
|
716 */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
717 //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
|
718 nsIPrefService prefService; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
719 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
|
720 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
721 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
|
722 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
723 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
724 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
725 if (serviceManager is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
726 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
727 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
728 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
729 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
730 //nsIPrefService prefService = new nsIPrefService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
731 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
732 char[1] buffer = new char[1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
733 nsIPrefBranch prefBranch; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
734 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
|
735 prefService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
736 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
|
737 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
738 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
739 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
740 if (prefBranch is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
741 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
742 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
743 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
744 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
745 //nsIPrefBranch prefBranch = new nsIPrefBranch (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
746 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
747 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
748 /* 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
|
749 String prefLocales = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
750 nsIPrefLocalizedString localizedString = null; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
751 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_LANGUAGES, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
752 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
|
753 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
754 * 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
|
755 * 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
|
756 * "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
|
757 * a profile. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
758 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
759 if (rc !is XPCOM.NS_OK) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
760 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
|
761 } else { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
762 if (localizedString is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
763 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
764 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
765 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
766 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
767 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
768 PRUnichar* tmpChars; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
769 rc = localizedString.ToString (&tmpChars); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
770 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
|
771 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
772 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
773 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
774 if (tmpChars is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
775 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
776 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
777 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
778 int span = XPCOM.strlen_PRUnichar (tmpChars); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
779 //char[] dest = new char[length]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
780 //XPCOM.memmove (dest, result[0], length * 2); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
781 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
|
782 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
783 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
784 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
785 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
786 * 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
|
787 * 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
|
788 */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
789 //Culture locale = Culture.current; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
790 //Region region = Region.current; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
791 //Locale locale = Locale.getDefault (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
792 String language = Culture.current.twoLetterLanguageName (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
793 String country = Region.current.twoLetterRegionName (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
794 String stringBuffer = language.dup; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
795 stringBuffer ~= SEPARATOR_LOCALE; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
796 stringBuffer ~= country.toLowerCase (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
797 stringBuffer ~= TOKENIZER_LOCALE; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
798 stringBuffer ~= language; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
799 stringBuffer ~= TOKENIZER_LOCALE; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
800 String newLocales = stringBuffer.dup; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
801 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
802 int start, end = -1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
803 do { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
804 start = end + 1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
805 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
|
806 String token; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
807 if (end is -1) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
808 token = prefLocales.substring (start); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
809 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
810 token = prefLocales.substring (start, end); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
811 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
812 if (token.length () > 0) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
813 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
|
814 /* 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
|
815 if (newLocales.indexOf (token) is -1) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
816 stringBuffer ~= token; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
817 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
818 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
819 } while (end !is -1); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
820 newLocales[] = stringBuffer[]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
821 if (!newLocales.equals (prefLocales)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
822 /* write the new locale value */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
823 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
|
824 //int span = newLocales.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
825 //char[] charBuffer = new char[span + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
826 //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
|
827 if (localizedString is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
828 //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
|
829 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
|
830 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
|
831 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
832 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
833 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
834 if (localizedString is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
835 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
836 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
837 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
838 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
839 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
840 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
841 localizedString.SetDataWithLength (newLocales.length, newLocales.toString16().toString16z()); |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
842 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
|
843 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
844 if (localizedString !is null) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
845 localizedString.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
846 localizedString = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
847 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
848 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
849 /* 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
|
850 String prefCharset = null; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
851 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_CHARSET, true); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
852 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
|
853 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
854 * 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
|
855 * 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
|
856 * "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
|
857 * without a profile. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
858 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
859 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
|
860 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
|
861 } else { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
862 if (localizedString is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
863 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
864 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
865 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
866 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
867 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
868 PRUnichar* tmpChar; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
869 rc = localizedString.ToString (&tmpChar); |
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 (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
872 error (rc, __FILE__, __LINE__); |
278
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 (tmpChar 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 (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
876 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
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 int span = XPCOM.strlen_PRUnichar (tmpChar); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
879 //char[] dest = new char[length]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
880 //XPCOM.memmove (dest, result[0], length * 2); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
881 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
|
882 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
883 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
884 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
885 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
|
886 if (!newCharset.equals (prefCharset)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
887 /* write the new charset value */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
888 //int length = newCharset.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
889 //char[] charBuffer = new char[length + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
890 //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
|
891 if (localizedString is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
892 //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
|
893 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
|
894 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
|
895 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
896 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
897 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
898 if (localizedString is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
899 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
900 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
901 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
902 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
903 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
904 } |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
905 localizedString.SetDataWithLength (newCharset.length, newCharset.toString16().toString16z()); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
906 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
|
907 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
908 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
|
909 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
910 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
911 * 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
|
912 * 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
|
913 */ |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
914 |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
915 // NOTE: in dwt, these properties don't exist so both keys will return null |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
916 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
|
917 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
|
918 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
919 int port = -1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
920 if (proxyPortString !is null) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
921 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
922 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
|
923 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
|
924 } catch (NumberFormatException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
925 /* 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
|
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 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
929 if (proxyHost !is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
930 //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
|
931 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
932 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
933 if (localizedString is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
934 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
935 //localizedString = new nsIPrefLocalizedString (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
936 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
937 //int length = proxyHost.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
938 //char[] charBuffer = new char[length + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
939 //proxyHost.getChars (0, length, charBuffer, 0); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
940 rc = localizedString.SetDataWithLength (proxyHost.length, proxyHost.toString16().toString16z()); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
941 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
942 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_FTP, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
943 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_FTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
944 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
945 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_HTTP, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
946 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_HTTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
947 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
948 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_SSL, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
949 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_SSL.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
950 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
951 localizedString.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
952 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
953 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
954 if (port !is -1) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
955 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_FTP, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
956 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_FTP.ptr, port); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
957 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
958 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_HTTP, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
959 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_HTTP.ptr, port); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
960 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
961 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_SSL, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
962 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_SSL.ptr, port); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
963 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
964 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
965 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
966 if (proxyHost !is null || port !is -1) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
967 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYTYPE, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
968 rc = prefBranch.SetIntPref (PREFERENCE_PROXYTYPE.ptr, 1); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
969 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
970 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
971 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
972 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
973 * 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
|
974 * 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
|
975 * 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
|
976 * 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
|
977 * 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
|
978 */ |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
979 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEOPENDURINGLOAD, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
980 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
|
981 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
|
982 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
983 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
984 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
985 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
986 /* 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
|
987 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEWINDOWSTATUSCHANGE, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
988 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
|
989 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
|
990 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
991 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
992 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
993 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
994 prefBranch.Release (); |
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 PromptService2Factory factory = new PromptService2Factory (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
997 factory.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
998 |
335 | 999 nsIComponentRegistrar componentRegistrar; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1000 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
|
1001 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
|
1002 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1003 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1004 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1005 if (componentRegistrar is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1006 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1007 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1008 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1009 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1010 //nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1011 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1012 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true); |
335 | 1013 String aClassName = "Prompt Service"; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1014 //byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "Prompt Service", true); //$NON-NLS-1$ |
335 | 1015 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1016 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
|
1017 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1018 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
|
1019 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1020 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1021 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1022 factory.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1023 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1024 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1025 * 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
|
1026 * 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
|
1027 * contract "Transfer" will be used. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1028 * 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
|
1029 * 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
|
1030 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1031 DownloadFactory downloadFactory = new DownloadFactory (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1032 downloadFactory.AddRef (); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1033 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOWNLOAD_CONTRACTID, true); |
335 | 1034 aClassName = "Download"; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1035 //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
|
1036 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
|
1037 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
|
1038 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1039 error (rc, __FILE__, __LINE__); |
278
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 downloadFactory.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1042 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1043 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
|
1044 pickerFactory.AddRef (); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1045 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_FILEPICKER_CONTRACTID, true); |
335 | 1046 aClassName = "FilePicker"; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1047 //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
|
1048 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
|
1049 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
|
1050 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1051 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1052 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1053 pickerFactory.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1054 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1055 componentRegistrar.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1056 componentManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1057 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1058 Initialized = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1059 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1060 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1061 if (display.getData (DISPOSE_LISTENER_HOOKED) is null) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1062 display.setData (DISPOSE_LISTENER_HOOKED, stringcast(DISPOSE_LISTENER_HOOKED)); |
340 | 1063 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
|
1064 public void handleEvent (Event event) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1065 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
|
1066 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1067 nsIServiceManager serviceManager; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1068 //int /*long*/[] result = new int /*long*/[1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1069 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1070 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1071 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1072 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1073 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1074 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1075 //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
|
1076 nsIObserverService observerService; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1077 rc = serviceManager.GetServiceByContractID (XPCOM.NS_OBSERVER_CONTRACTID.ptr, &nsIObserverService.IID, cast(void**)&observerService); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1078 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1079 if (observerService is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1080 |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1081 //nsIObserverService observerService = new nsIObserverService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1082 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1083 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_BEFORE_CHANGE, true); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1084 //int length = SHUTDOWN_PERSIST.length (); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1085 //char[] chars = new char [length + 1]; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1086 //SHUTDOWN_PERSIST.getChars (0, length, chars, 0); |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1087 rc = observerService.NotifyObservers (null, PROFILE_BEFORE_CHANGE.ptr, SHUTDOWN_PERSIST.toString16().toString16z()); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1088 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1089 observerService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1090 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1091 if (LocationProvider !is null) { |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1092 String prefsLocation = LocationProvider.profilePath ~ AppFileLocProvider.PREFERENCES_FILE; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1093 scope auto pathString = new nsEmbedString (prefsLocation.toString16()); |
335 | 1094 nsILocalFile localFile; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1095 rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1096 if (rc !is XPCOM.NS_OK) Mozilla.error (rc, __FILE__, __LINE__); |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1097 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
|
1098 //pathString.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1099 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1100 //nsILocalFile localFile = new nsILocalFile (result [0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1101 //result[0] = 0; |
335 | 1102 nsIFile prefFile; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1103 rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&prefFile); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1104 if (rc !is XPCOM.NS_OK) Mozilla.error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1105 if (prefFile is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1106 localFile.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1107 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1108 //nsIFile prefFile = new nsIFile (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1109 //result[0] = 0; |
335 | 1110 nsIPrefService prefService; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1111 //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
|
1112 rc = serviceManager.GetServiceByContractID (XPCOM.NS_PREFSERVICE_CONTRACTID.ptr, &nsIPrefService.IID, cast(void**)&prefService); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1113 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1114 if (prefService is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1115 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1116 //nsIPrefService prefService = new nsIPrefService (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1117 //result[0] = 0; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1118 rc = prefService.SavePrefFile(prefFile); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1119 prefService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1120 prefFile.Release (); |
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 serviceManager.Release (); |
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 if (XPCOMWasGlued) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1125 // TODO: is there a difference between two startup methhods? Glue functions are same. |
352
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1126 /* |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1127 * XULRunner 1.9 can crash on Windows if XPCOMGlueShutdown is invoked here, |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1128 * presumably because one or more of its unloaded symbols are referenced when |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1129 * this callback returns. The workaround is to delay invoking XPCOMGlueShutdown |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1130 * so that its symbols are still available once this callback returns. |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1131 */ |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1132 display.asyncExec (new class() Runnable { |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1133 public void run () { |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1134 XPCOMInit.XPCOMGlueShutdown (); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1135 } |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1136 }); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1137 XPCOMWasGlued = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1138 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1139 if (XPCOMInitWasGlued) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1140 XPCOMInit.XPCOMGlueShutdown (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1141 XPCOMInitWasGlued = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1142 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1143 Initialized = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1144 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1145 }); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1146 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1147 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1148 BrowserCount++; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1149 nsIComponentManager componentManager; |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1150 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
|
1151 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
|
1152 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1153 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1154 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1155 if (componentManager is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1156 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1157 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1158 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1159 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1160 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1161 //result[0] = 0; |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1162 //nsIWebBrowser webBrowser; |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1163 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
|
1164 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
|
1165 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
|
1166 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1167 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1168 } |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1169 if (webBrowser is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1170 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1171 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1172 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1173 |
335 | 1174 this.AddRef (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1175 |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1176 rc = webBrowser.SetContainerWindow ( cast(nsIWebBrowserChrome)this ); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1177 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
|
1178 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1179 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1180 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1181 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1182 nsIBaseWindow baseWindow; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1183 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
|
1184 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
|
1185 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1186 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1187 } |
340 | 1188 if (baseWindow is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1189 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1190 error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
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 |
333
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1193 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); |
8235a17d9255
Continued progress on Mozilla.d
John Reimer <terminal.node@gmail.com>
parents:
305
diff
changeset
|
1194 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1195 Rectangle rect = browser.getClientArea (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1196 if (rect.isEmpty ()) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1197 rect.width = 1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1198 rect.height = 1; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1199 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1200 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1201 embedHandle = mozDelegate.getHandle (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1202 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1203 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
|
1204 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
|
1205 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1206 error (XPCOM.NS_ERROR_FAILURE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1207 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1208 rc = baseWindow.Create (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1209 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
|
1210 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1211 error (XPCOM.NS_ERROR_FAILURE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1212 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1213 rc = baseWindow.SetVisibility (1); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1214 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
|
1215 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1216 error (XPCOM.NS_ERROR_FAILURE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1217 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1218 baseWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1219 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1220 if (!PerformedVersionCheck) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1221 PerformedVersionCheck = true; |
352
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1222 |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1223 nsIComponentRegistrar componentRegistrar; |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1224 rc = componentManager.QueryInterface (&nsIComponentRegistrar.IID, cast(void**)&componentRegistrar); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1225 if (rc !is XPCOM.NS_OK) { |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1226 browser.dispose (); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1227 error (rc, __FILE__,__LINE__); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1228 } |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1229 if (componentRegistrar is null) { |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1230 browser.dispose (); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1231 error (XPCOM.NS_NOINTERFACE,__FILE__,__LINE__); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1232 } |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1233 |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1234 HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory (); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1235 dialogFactory.AddRef (); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1236 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1237 String aClassName = "Helper App Launcher Dialog"; //$NON-NLS-1$ |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1238 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName.ptr, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID.ptr, cast(nsIFactory)dialogFactory); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1239 if (rc !is XPCOM.NS_OK) { |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1240 browser.dispose (); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1241 error (rc,__FILE__,__LINE__); |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1242 } |
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1243 dialogFactory.Release (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1244 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1245 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1246 * 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
|
1247 * 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
|
1248 */ |
335 | 1249 nsIInterfaceRequestor interfaceRequestor; |
1250 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
|
1251 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
|
1252 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1253 error (XPCOM.NS_ERROR_FAILURE); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1254 } |
335 | 1255 if (interfaceRequestor is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1256 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1257 error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1258 } |
335 | 1259 //nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); |
1260 //result[0] = 0; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1261 |
335 | 1262 nsIDocShell docShell; |
1263 rc = interfaceRequestor.GetInterface (&nsIDocShell.IID, cast(void**)&docShell); | |
1264 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
|
1265 IsPre_1_8 = true; |
335 | 1266 docShell.Release (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1267 } |
335 | 1268 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1269 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1270 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1271 * 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
|
1272 * 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
|
1273 * 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
|
1274 * 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
|
1275 * "Download" will be used. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1276 * 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
|
1277 * 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
|
1278 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1279 if (!IsPre_1_8) { |
335 | 1280 nsIDocShell_1_8 docShell_1_8; |
1281 rc = interfaceRequestor.GetInterface (&nsIDocShell_1_8.IID, cast(void**)&docShell_1_8); | |
1282 if (rc is XPCOM.NS_OK && docShell_1_8 !is null) { /* 1.8 */ | |
1283 docShell_1_8.Release (); | |
352
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1284 |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1285 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
|
1286 downloadFactory_1_8.AddRef (); |
335 | 1287 // byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true); |
1288 | |
352
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1289 aClassName = "Transfer"; //$NON-NLS-1$ |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1290 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
|
1291 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
|
1292 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1293 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1294 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1295 downloadFactory_1_8.Release (); |
335 | 1296 } else { /* >= 1.9 */ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1297 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1298 * 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
|
1299 * 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
|
1300 * 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
|
1301 * 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
|
1302 * 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
|
1303 * 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
|
1304 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1305 awaitingNavigate = true; |
335 | 1306 nsIWebNavigation webNavigation; |
1307 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
|
1308 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
|
1309 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1310 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1311 } |
335 | 1312 if (webNavigation is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1313 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1314 error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1315 } |
335 | 1316 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1317 //char[] uri = new char[ABOUT_BLANK.length () + 1]; | |
1318 //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
|
1319 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
|
1320 webNavigation.Release (); |
352
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1321 dialogFactory.isPre_1_9 = false; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1322 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1323 } |
335 | 1324 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1325 interfaceRequestor.Release (); |
352
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
1326 componentRegistrar.Release (); |
278
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 componentManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1329 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1330 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
|
1331 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
|
1332 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1333 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1334 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1335 |
337 | 1336 // TODO: Find appropriate place to "Release" uriContentListener -JJR |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1337 nsIURIContentListener uriContentListener; |
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1338 this.QueryInterface(&nsIURIContentListener.IID, cast(void**)&uriContentListener); |
335 | 1339 if (rc !is XPCOM.NS_OK) { |
1340 browser.dispose(); | |
340 | 1341 error(rc); |
335 | 1342 } |
340 | 1343 if (uriContentListener is null) { |
335 | 1344 browser.dispose(); |
1345 error(XPCOM.NS_ERROR_NO_INTERFACE); | |
1346 } | |
1347 | |
1348 rc = webBrowser.SetParentURIContentListener (uriContentListener); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1349 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
|
1350 browser.dispose (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1351 error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1352 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1353 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1354 mozDelegate.init (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1355 |
340 | 1356 listener = new class () Listener { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1357 public void handleEvent (Event event) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1358 Control control = cast(Control)this.outer.browser; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1359 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
|
1360 switch (event.type) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1361 case DWT.Dispose: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1362 /* 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
|
1363 if (ignoreDispose) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1364 ignoreDispose = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1365 break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1366 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1367 ignoreDispose = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1368 browser.notifyListeners (event.type, event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1369 event.type = DWT.NONE; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1370 onDispose (event.display); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1371 break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1372 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1373 case DWT.Resize: onResize (); break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1374 case DWT.FocusIn: Activate (); break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1375 case DWT.Activate: Activate (); break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1376 case DWT.Deactivate: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1377 Display display = event.display; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1378 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
|
1379 break; |
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 case DWT.Show: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1382 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1383 * 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
|
1384 * 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
|
1385 * 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
|
1386 * 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
|
1387 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1388 Display display = event.display; |
340 | 1389 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
|
1390 public void run() { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1391 if (browser.isDisposed ()) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1392 onResize (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1393 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1394 }); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1395 break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1396 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1397 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1398 } |
340 | 1399 }; |
1400 int[] folderEvents = [ | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1401 DWT.Dispose, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1402 DWT.Resize, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1403 DWT.FocusIn, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1404 DWT.Activate, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1405 DWT.Deactivate, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1406 DWT.Show, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1407 DWT.KeyDown // needed to make browser traversable |
340 | 1408 ]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1409 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
|
1410 browser.addListener (folderEvents[i], listener); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1411 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1412 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1413 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1414 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1415 public bool back () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1416 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1417 |
335 | 1418 //int /*long*/[] result = new int /*long*/[1]; |
1419 nsIWebNavigation webNavigation; | |
1420 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1421 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1422 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1423 |
335 | 1424 //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
|
1425 rc = webNavigation.GoBack (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1426 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1427 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
|
1428 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1429 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1430 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1431 public bool execute (String script) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1432 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1433 |
335 | 1434 String url = PREFIX_JAVASCRIPT ~ script ~ ";void(0);"; //$NON-NLS-1$ |
1435 //int /*long*/[] result = new int /*long*/[1]; | |
1436 nsIWebNavigation webNavigation; | |
1437 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1438 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1439 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1440 |
335 | 1441 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1442 //char[] arg = url.toCharArray (); | |
1443 //char[] c = new char[arg.length+1]; | |
1444 //System.arraycopy (arg, 0, c, 0, arg.length); | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1445 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
|
1446 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1447 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
|
1448 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1449 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1450 extern(D) |
298
eec6ddb07873
More xpcom/mozilla port
John Reimer<terminal.node@gmail.com>
parents:
286
diff
changeset
|
1451 static Browser findBrowser (void* handle) { |
eec6ddb07873
More xpcom/mozilla port
John Reimer<terminal.node@gmail.com>
parents:
286
diff
changeset
|
1452 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
|
1453 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1454 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1455 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1456 public bool forward () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1457 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1458 |
335 | 1459 //int /*long*/[] result = new int /*long*/[1]; |
1460 nsIWebNavigation webNavigation; | |
1461 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1462 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1463 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1464 |
335 | 1465 //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
|
1466 rc = webNavigation.GoForward (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1467 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1468 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1469 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
|
1470 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1471 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1472 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1473 public String getText () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1474 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
|
1475 |
335 | 1476 //int /*long*/[] result = new int /*long*/[1]; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1477 nsIDOMWindow window; |
335 | 1478 int rc = webBrowser.GetContentDOMWindow (&window); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1479 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1480 if (window is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1481 |
335 | 1482 //nsIDOMWindow window = new nsIDOMWindow (result[0]); |
1483 //result[0] = 0; | |
1484 nsIDOMDocument document; | |
1485 rc = window.GetDocument (&document); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1486 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1487 if (document is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1488 window.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1489 |
335 | 1490 //int /*long*/ document = result[0]; |
1491 //result[0] = 0; | |
1492 nsIComponentManager componentManager; | |
1493 rc = XPCOM.NS_GetComponentManager (&componentManager); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1494 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1495 if (componentManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
335 | 1496 |
1497 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); | |
1498 //result[0] = 0; | |
1499 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOMSERIALIZER_CONTRACTID, true); | |
1500 String chars = null; | |
1501 nsIDOMSerializer_1_7 serializer_1_7; | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1502 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer_1_7.IID, cast(void**)&serializer_1_7); |
335 | 1503 if (rc is XPCOM.NS_OK) { /* mozilla >= 1.7 */ |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1504 if (serializer_1_7 is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1505 |
335 | 1506 //nsIDOMSerializer_1_7 serializer = new nsIDOMSerializer_1_7 (result[0]); |
1507 //result[0] = 0; | |
1508 scope auto string = new nsEmbedString; | |
1509 rc = serializer_1_7.SerializeToString (cast(nsIDOMNode)document, cast(nsAString*) string); | |
1510 serializer_1_7.Release (); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1511 |
335 | 1512 //int length = XPCOM.nsEmbedString_Length (string); |
1513 //int /*long*/ buffer = XPCOM.nsEmbedString_get (string); | |
1514 //chars = new char[length]; | |
1515 //XPCOM.memmove (chars, buffer, length * 2); | |
1516 //XPCOM.nsEmbedString_delete (string); | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1517 chars = string.toString(); |
335 | 1518 } else { /* mozilla < 1.7 */ |
1519 nsIDOMSerializer serializer; | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1520 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer.IID, cast(void**)&serializer); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1521 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1522 if (serializer is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
335 | 1523 // TODO: Lookup SerializeToString contract. Find out if the string must provide it's own memory to the method. -JJR |
1524 PRUnichar* string; | |
1525 //nsIDOMSerializer serializer = new nsIDOMSerializer (result[0]); | |
1526 //result[0] = 0; | |
1527 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
|
1528 serializer.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1529 |
335 | 1530 //int length = XPCOM.strlen_PRUnichar (string); |
1531 //chars = new char[length]; | |
1532 //XPCOM.memmove (chars, result[0], length * 2); | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1533 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
|
1534 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1535 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1536 componentManager.Release (); |
335 | 1537 document.Release (); |
1538 return chars.dup; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1539 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1540 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1541 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1542 public String getUrl () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1543 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
|
1544 |
337 | 1545 //int /*long*/[] result = new int /*long*/[1]; |
1546 nsIWebNavigation webNavigation; | |
1547 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1548 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1549 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1550 |
337 | 1551 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1552 nsIURI aCurrentURI; | |
1553 rc = webNavigation.GetCurrentURI (&aCurrentURI); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1554 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1555 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1556 |
337 | 1557 String location = null; |
1558 if (aCurrentURI !is null) { | |
1559 //nsIURI uri = new nsIURI (aCurrentURI[0]); | |
1560 scope auto aSpec = new nsEmbedCString; | |
1561 rc = aCurrentURI.GetSpec (cast(nsACString*)aSpec); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1562 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
337 | 1563 //int length = XPCOM.nsEmbedCString_Length (aSpec); |
1564 //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); | |
1565 location = aSpec.toString; | |
1566 //XPCOM.memmove (dest, buffer, length); | |
1567 //XPCOM.nsEmbedCString_delete (aSpec); | |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1568 aCurrentURI.Release (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1569 } |
337 | 1570 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
|
1571 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1572 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1573 * 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
|
1574 * (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
|
1575 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1576 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
|
1577 return location; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1578 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1579 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1580 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1581 public Object getWebBrowser () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1582 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
|
1583 if (webBrowserObject !is null) return webBrowserObject; |
337 | 1584 implMissing(__FILE__,__LINE__); |
1585 /+ | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1586 try { |
337 | 1587 // TODO: this references the JavaXPCOM browser... not sure what needs to be done here, |
1588 // 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
|
1589 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
|
1590 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
|
1591 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
|
1592 method = clazz.getMethod ("wrapXPCOMObject", new Class[] {Long.TYPE, String.class}); //$NON-NLS-1$ |
337 | 1593 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
|
1594 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1595 * 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
|
1596 * 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
|
1597 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1598 webBrowser.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1599 return webBrowserObject; |
337 | 1600 } catch (ClassNotFoundException e) { |
1601 } catch (NoSuchMethodException e) { | |
1602 } catch (IllegalArgumentException e) { | |
1603 } catch (IllegalAccessException e) { | |
1604 } catch (InvocationTargetException e) { | |
1605 } | |
1606 +/ | |
1607 return null; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1608 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1609 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1610 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1611 public bool isBackEnabled () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1612 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1613 |
337 | 1614 //int /*long*/[] result = new int /*long*/[1]; |
1615 nsIWebNavigation webNavigation; | |
1616 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1617 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1618 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1619 |
337 | 1620 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1621 PRBool aCanGoBack; /* PRBool */ | |
1622 rc = webNavigation.GetCanGoBack (&aCanGoBack); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1623 webNavigation.Release (); |
337 | 1624 return aCanGoBack !is 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1625 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1626 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1627 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1628 public bool isForwardEnabled () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1629 if (awaitingNavigate) return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1630 |
337 | 1631 //int /*long*/[] result = new int /*long*/[1]; |
1632 nsIWebNavigation webNavigation; | |
1633 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1634 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1635 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1636 |
337 | 1637 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1638 PRBool aCanGoForward; /* PRBool */ | |
1639 rc = webNavigation.GetCanGoForward (&aCanGoForward); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1640 webNavigation.Release (); |
337 | 1641 return aCanGoForward !is 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1642 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1643 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1644 extern(D) |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1645 static void error (int code ) { |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1646 error ( code, "NOT GIVEN", 0 ); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1647 } |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1648 |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1649 extern(D) |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1650 static String error (int code, char[] file, int line) { |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1651 Stdout ("File: ")(file)(" Line: ")(line).newline; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1652 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
|
1653 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1654 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1655 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1656 void onDispose (Display display) { |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1657 int rc = webBrowser.RemoveWebBrowserListener (cast(nsIWeakReference)this, &nsIWebProgressListener.IID); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1658 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1659 |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
1660 rc = webBrowser.SetParentURIContentListener (null); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1661 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1662 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1663 unhookDOMListeners (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1664 if (listener !is null) { |
337 | 1665 int[] folderEvents = [ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1666 DWT.Dispose, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1667 DWT.Resize, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1668 DWT.FocusIn, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1669 DWT.Activate, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1670 DWT.Deactivate, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1671 DWT.Show, |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1672 DWT.KeyDown, |
337 | 1673 ]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1674 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
|
1675 browser.removeListener (folderEvents[i], listener); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1676 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1677 listener = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1678 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1679 |
337 | 1680 //int /*long*/[] result = new int /*long*/[1]; |
1681 nsIBaseWindow baseWindow; | |
1682 rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1683 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1684 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1685 |
337 | 1686 //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
|
1687 rc = baseWindow.Destroy (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1688 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1689 baseWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1690 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1691 Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1692 webBrowser.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1693 webBrowser = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1694 webBrowserObject = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1695 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1696 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
|
1697 tip = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1698 location = size = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1699 |
337 | 1700 //Enumeration elements = unhookedDOMWindows.elements (); |
1701 foreach (win ; unhookedDOMWindows) { | |
1702 //LONG ptrObject = (LONG)elements.nextElement (); | |
1703 win.Release (); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1704 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1705 unhookedDOMWindows = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1706 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1707 mozDelegate.onDispose (embedHandle); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1708 mozDelegate = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1709 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1710 embedHandle = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1711 BrowserCount--; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1712 } |
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 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1715 void Activate () { |
337 | 1716 //int /*long*/[] result = new int /*long*/[1]; |
1717 nsIWebBrowserFocus webBrowserFocus; | |
1718 int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1719 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1720 if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1721 |
337 | 1722 //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
|
1723 rc = webBrowserFocus.Activate (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1724 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1725 webBrowserFocus.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1726 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1727 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1728 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1729 void Deactivate () { |
337 | 1730 //int /*long*/[] result = new int /*long*/[1]; |
1731 nsIWebBrowserFocus webBrowserFocus; | |
1732 int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1733 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1734 if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1735 |
337 | 1736 //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
|
1737 rc = webBrowserFocus.Deactivate (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1738 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1739 webBrowserFocus.Release (); |
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 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1742 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1743 void onResize () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1744 Rectangle rect = browser.getClientArea (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1745 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
|
1746 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
|
1747 |
337 | 1748 //int /*long*/[] result = new int /*long*/[1]; |
1749 nsIBaseWindow baseWindow; | |
1750 int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1751 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1752 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1753 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1754 mozDelegate.setSize (embedHandle, width, height); |
337 | 1755 //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
|
1756 rc = baseWindow.SetPositionAndSize (0, 0, width, height, 1); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1757 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1758 baseWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1759 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1760 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1761 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1762 public void refresh () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1763 if (awaitingNavigate) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1764 |
337 | 1765 //int /*long*/[] result = new int /*long*/[1]; |
1766 nsIWebNavigation webNavigation; | |
1767 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
|
1768 if (rc !is XPCOM.NS_OK) error(rc); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1769 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1770 |
337 | 1771 //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
|
1772 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
|
1773 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1774 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
|
1775 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1776 * 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
|
1777 * 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
|
1778 * 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
|
1779 * |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1780 * 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
|
1781 * 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
|
1782 * 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
|
1783 * 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
|
1784 */ |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1785 if (rc !is XPCOM.NS_ERROR_INVALID_POINTER && rc !is XPCOM.NS_ERROR_FILE_NOT_FOUND) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1786 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1787 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1788 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1789 public bool setText (String html) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1790 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1791 * 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
|
1792 * 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
|
1793 * 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
|
1794 * 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
|
1795 * 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
|
1796 * 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
|
1797 * 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
|
1798 * 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
|
1799 * 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
|
1800 * 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
|
1801 * 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
|
1802 * 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
|
1803 * 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
|
1804 * 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
|
1805 * 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
|
1806 */ |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1807 if (browser !is browser.getDisplay().getFocusControl ()) { |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1808 Deactivate (); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1809 } |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1810 /* convert the String containing HTML to an array of bytes with UTF-8 data */ |
337 | 1811 /+ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1812 byte[] data = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1813 try { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1814 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
|
1815 } catch (UnsupportedEncodingException e) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1816 return false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1817 } |
337 | 1818 +/ |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1819 awaitingNavigate = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1820 |
337 | 1821 //byte[] contentTypeBuffer = MozillaDelegate.wcsToMbcs (null, "text/html", true); // $NON-NLS-1$ |
1822 scope auto aContentType = new nsEmbedCString ("text/html"); | |
1823 //byte[] contentCharsetBuffer = MozillaDelegate.wcsToMbcs (null, "UTF-8", true); //$NON-NLS-1$ | |
1824 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
|
1825 |
337 | 1826 //int /*long*/[] result = new int /*long*/[1]; |
1827 nsIServiceManager serviceManager; | |
1828 int rc = XPCOM.NS_GetServiceManager (&serviceManager); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1829 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1830 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1831 |
337 | 1832 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
1833 //result[0] = 0; | |
1834 nsIIOService ioService; | |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1835 rc = serviceManager.GetService (&XPCOM.NS_IOSERVICE_CID, &nsIIOService.IID, cast(void**)&ioService); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1836 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1837 if (ioService is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1838 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1839 |
337 | 1840 //nsIIOService ioService = new nsIIOService (result[0]); |
1841 //result[0] = 0; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1842 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1843 * 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
|
1844 * 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
|
1845 * 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
|
1846 */ |
337 | 1847 //byte[] aString = MozillaDelegate.wcsToMbcs (null, URI_FROMMEMORY, false); |
1848 scope auto aSpec = new nsEmbedCString(URI_FROMMEMORY); | |
1849 nsIURI uri; | |
1850 rc = ioService.NewURI (cast(nsACString*)aSpec, null, null, &uri); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1851 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1852 if (uri is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
337 | 1853 //XPCOM.nsEmbedCString_delete (aSpec); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1854 ioService.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1855 |
337 | 1856 //nsIURI uri = new nsIURI (result[0]); |
1857 //result[0] = 0; | |
1858 nsIInterfaceRequestor interfaceRequestor; | |
1859 rc = webBrowser.QueryInterface (&nsIInterfaceRequestor.IID, cast(void**)&interfaceRequestor); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1860 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1861 if (interfaceRequestor is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
337 | 1862 //nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); |
1863 //result[0] = 0; | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1864 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1865 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1866 * 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
|
1867 * 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
|
1868 * 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
|
1869 * Close methods never get called. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1870 */ |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1871 |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1872 // 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
|
1873 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
|
1874 inputStream.AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1875 |
337 | 1876 nsIDocShell_1_9 docShell_1_9; |
1877 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
|
1878 if (rc is XPCOM.NS_OK) { |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1879 if (docShell_1_9 is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
337 | 1880 //nsIDocShell_1_9 docShell = new nsIDocShell_1_9 (result[0]); |
1881 rc = docShell_1_9.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); | |
1882 docShell_1_9.Release (); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1883 } else { |
337 | 1884 //result[0] = 0; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1885 nsIDocShell_1_8 docShell_1_8; |
337 | 1886 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
|
1887 if (rc is XPCOM.NS_OK) { |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1888 if (docShell_1_8 is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
337 | 1889 //nsIDocShell_1_8 docShell = new nsIDocShell_1_8 (result[0]); |
1890 rc = docShell_1_8.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); | |
1891 docShell_1_8.Release (); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1892 } else { |
337 | 1893 //result[0] = 0; |
1894 nsIDocShell docShell; | |
1895 rc = interfaceRequestor.GetInterface (&nsIDocShell.IID, cast(void**)&docShell); | |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1896 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1897 if (docShell is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
337 | 1898 //nsIDocShell docShell = new nsIDocShell (result[0]); |
1899 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
|
1900 docShell.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1901 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1902 } |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1903 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
337 | 1904 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1905 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1906 inputStream.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1907 interfaceRequestor.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1908 uri.Release (); |
337 | 1909 //XPCOM.nsEmbedCString_delete (aContentCharset); |
1910 //XPCOM.nsEmbedCString_delete (aContentType); | |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1911 return true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1912 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1913 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1914 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1915 public bool setUrl (String url) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1916 awaitingNavigate = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1917 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1918 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1919 nsIWebNavigation webNavigation; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1920 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1921 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1922 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1923 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1924 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1925 //char[] uri = new char[url.length () + 1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1926 //url.getChars (0, url.length (), uri, 0); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1927 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
|
1928 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1929 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
|
1930 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1931 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1932 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1933 public void stop () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1934 if (awaitingNavigate) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1935 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1936 nsIWebNavigation webNavigation; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1937 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1938 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1939 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1940 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1941 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1942 //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
|
1943 rc = webNavigation.Stop (nsIWebNavigation.STOP_ALL); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
1944 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1945 webNavigation.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1946 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1947 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1948 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1949 void hookDOMListeners (nsIDOMEventTarget target, bool isTop) { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1950 scope auto string = new nsEmbedString (XPCOM.DOMEVENT_FOCUS.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1951 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
|
1952 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1953 string = new nsEmbedString (XPCOM.DOMEVENT_UNLOAD.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1954 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
|
1955 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1956 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDOWN.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1957 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
|
1958 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1959 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEUP.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1960 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
|
1961 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1962 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEMOVE.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1963 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
|
1964 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1965 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEWHEEL.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1966 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
|
1967 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1968 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDRAG.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1969 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
|
1970 //string.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1971 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1972 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1973 * 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
|
1974 * 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
|
1975 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1976 if (isTop && mozDelegate.hookEnterExit ()) { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1977 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOVER.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 (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1980 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOUT.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1981 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
|
1982 //string.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1983 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1984 |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1985 string = new nsEmbedString (XPCOM.DOMEVENT_KEYDOWN.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1986 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
|
1987 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1988 string = new nsEmbedString (XPCOM.DOMEVENT_KEYPRESS.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1989 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
|
1990 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1991 string = new nsEmbedString (XPCOM.DOMEVENT_KEYUP.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
1992 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
|
1993 //string.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1994 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1995 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
1996 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1997 void unhookDOMListeners () { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1998 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
1999 nsIDOMWindow window; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2000 int rc = webBrowser.GetContentDOMWindow (&window); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2001 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2002 if (window is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2003 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2004 //nsIDOMWindow window = new nsIDOMWindow (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2005 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2006 nsIDOMEventTarget target; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2007 rc = window.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2008 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2009 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2010 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2011 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2012 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2013 unhookDOMListeners (target); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2014 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2015 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2016 /* 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
|
2017 nsIDOMWindowCollection frames; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2018 rc = window.GetFrames (&frames); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2019 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2020 if (frames is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2021 //nsIDOMWindowCollection frames = new nsIDOMWindowCollection (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 PRUint32 count; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2024 rc = frames.GetLength (&count); /* PRUint32 */ |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2025 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2026 //int count = frameCount[0]; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2027 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2028 if (count > 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2029 nsIDOMWindow frame; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2030 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
|
2031 rc = frames.Item (i, &frame); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2032 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2033 if (frame is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2034 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2035 //nsIDOMWindow frame = new nsIDOMWindow (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2036 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2037 rc = frame.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2038 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2039 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2040 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2041 //target = new nsIDOMEventTarget (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2042 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2043 unhookDOMListeners (target); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2044 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2045 frame.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2046 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2047 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2048 frames.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2049 window.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2050 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2051 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2052 extern(D) |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2053 void unhookDOMListeners (nsIDOMEventTarget target) { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2054 scope auto string = new nsEmbedString (XPCOM.DOMEVENT_FOCUS.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2055 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
|
2056 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2057 string = new nsEmbedString (XPCOM.DOMEVENT_UNLOAD.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2058 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
|
2059 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2060 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDOWN.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2061 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
|
2062 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2063 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEUP.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2064 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
|
2065 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2066 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEMOVE.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2067 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
|
2068 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2069 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEWHEEL.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2070 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
|
2071 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2072 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDRAG.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2073 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
|
2074 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2075 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOVER.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2076 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
|
2077 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2078 string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOUT.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2079 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
|
2080 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2081 string = new nsEmbedString (XPCOM.DOMEVENT_KEYDOWN.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2082 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
|
2083 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2084 string = new nsEmbedString (XPCOM.DOMEVENT_KEYPRESS.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2085 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
|
2086 //string.dispose (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2087 string = new nsEmbedString (XPCOM.DOMEVENT_KEYUP.toString16()); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2088 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
|
2089 //string.dispose (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2090 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2091 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2092 /* nsISupports */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2093 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2094 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2095 nsresult QueryInterface (nsID* riid, void** ppvObject) { |
286 | 2096 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
|
2097 |
286 | 2098 if (*riid == nsISupports.IID) { |
2099 *ppvObject = cast(void*)cast(nsISupports)this; | |
2100 AddRef (); | |
2101 return XPCOM.NS_OK; | |
2102 } | |
2103 if (*riid == nsIWeakReference.IID) { | |
2104 *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
|
2105 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2106 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2107 } |
286 | 2108 if (*riid == nsIWebProgressListener.IID) { |
2109 *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
|
2110 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2111 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2112 } |
286 | 2113 if (*riid == nsIWebBrowserChrome.IID) { |
2114 *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
|
2115 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2116 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2117 } |
286 | 2118 if (*riid == nsIWebBrowserChromeFocus.IID) { |
2119 *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
|
2120 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2121 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2122 } |
286 | 2123 if (*riid == nsIEmbeddingSiteWindow.IID) { |
2124 *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
|
2125 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2126 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2127 } |
286 | 2128 if (*riid == nsIInterfaceRequestor.IID) { |
2129 *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
|
2130 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2131 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2132 } |
286 | 2133 if (*riid == nsISupportsWeakReference.IID) { |
2134 *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
|
2135 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2136 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2137 } |
286 | 2138 if (*riid == nsIContextMenuListener.IID) { |
2139 *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
|
2140 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2141 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2142 } |
286 | 2143 if (*riid == nsIURIContentListener.IID) { |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2144 *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
|
2145 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2146 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2147 } |
340 | 2148 if (*riid == nsITooltipListener.IID) { |
286 | 2149 *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
|
2150 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2151 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2152 } |
286 | 2153 *ppvObject = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2154 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
|
2155 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2156 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2157 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2158 nsrefcnt AddRef () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2159 refCount++; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2160 return refCount; |
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 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2163 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2164 nsrefcnt Release () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2165 refCount--; |
286 | 2166 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
|
2167 return refCount; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2168 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2169 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2170 /* nsIWeakReference */ |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2171 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2172 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2173 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
|
2174 return QueryInterface (riid, ppvObject); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2175 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2176 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2177 /* nsIInterfaceRequestor */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2178 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2179 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2180 nsresult GetInterface ( nsID* riid, void** ppvObject) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2181 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
|
2182 //nsID guid = new nsID (); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2183 //XPCOM.memmove (guid, riid, nsID.sizeof); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2184 if (*riid == nsIDOMWindow.IID) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2185 nsIDOMWindow aContentDOMWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2186 //int /*long*/[] aContentDOMWindow = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2187 int rc = webBrowser.GetContentDOMWindow (&aContentDOMWindow); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2188 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2189 if (aContentDOMWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2190 *ppvObject = cast(void*)aContentDOMWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2191 //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
|
2192 return rc; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2193 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2194 return QueryInterface (riid, ppvObject); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2195 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2196 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2197 extern(System) |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2198 nsresult GetWeakReference (nsIWeakReference* ppvObject) { |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2199 *ppvObject = cast(nsIWeakReference)this; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2200 //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
|
2201 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2202 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2203 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2204 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2205 /* nsIWebProgressListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2206 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2207 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2208 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
|
2209 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
|
2210 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
|
2211 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
|
2212 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2213 if (!awaitingNavigate) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2214 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2215 * 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
|
2216 * 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
|
2217 * 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
|
2218 * 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
|
2219 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2220 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2221 nsIDOMWindow window; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2222 //nsIWebProgress progress = new nsIWebProgress (aWebProgress); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2223 int rc = aWebProgress.GetDOMWindow (&window); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2224 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2225 if (window is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2226 unhookedDOMWindows ~= window; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2227 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2228 } 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
|
2229 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
|
2230 } 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
|
2231 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2232 * 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
|
2233 * 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
|
2234 * 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
|
2235 * 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
|
2236 * are typically added. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2237 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2238 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2239 //nsIWebProgress progress = new nsIWebProgress (aWebProgress); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2240 nsIDOMWindow domWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2241 int rc = aWebProgress.GetDOMWindow (&domWindow); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2242 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2243 if (domWindow is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2244 //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
|
2245 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2246 //LONG ptrObject = new LONG (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2247 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2248 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
|
2249 if (index !is -1) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2250 nsIDOMWindow contentWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2251 rc = webBrowser.GetContentDOMWindow (&contentWindow); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2252 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2253 if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2254 bool isTop = contentWindow is domWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2255 contentWindow.Release (); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2256 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2257 nsIDOMEventTarget target; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2258 rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2259 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2260 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2261 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2262 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2263 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2264 hookDOMListeners (target, isTop); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2265 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2266 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2267 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2268 * 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
|
2269 * 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
|
2270 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2271 unhookedDOMWindows = unhookedDOMWindows.arrayIndexRemove (index); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2272 domWindow.Release (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2273 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2274 domWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2275 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2276 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2277 * 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
|
2278 * 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
|
2279 * 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
|
2280 * 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
|
2281 * 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
|
2282 * - 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
|
2283 * the ProgressListener.completed event. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2284 */ |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2285 if (request is aRequest || request is null) { |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2286 request = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2287 if (!awaitingNavigate) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2288 StatusTextEvent event = new StatusTextEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2289 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2290 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2291 event.text = ""; //$NON-NLS-1$ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2292 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
|
2293 statusTextListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2294 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2295 ProgressEvent event2 = new ProgressEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2296 event2.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2297 event2.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2298 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
|
2299 progressListeners[i].completed (event2); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2300 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2301 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2302 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2303 } 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
|
2304 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2305 * 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
|
2306 * 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
|
2307 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2308 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2309 // nsIWebProgress progress = new nsIWebProgress (aWebProgress); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2310 nsIDOMWindow domWindow; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2311 int rc = aWebProgress.GetDOMWindow (&domWindow); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2312 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2313 if (domWindow is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2314 //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
|
2315 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2316 //LONG ptrObject = new LONG (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2317 //result[0] = 0; |
340 | 2318 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
|
2319 if (index !is -1) { |
340 | 2320 nsIDOMWindow contentWindow; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2321 rc = webBrowser.GetContentDOMWindow (&contentWindow); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2322 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2323 if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2324 bool isTop = contentWindow is domWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2325 contentWindow.Release (); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2326 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2327 nsIDOMEventTarget target; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2328 rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2329 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2330 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2331 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2332 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2333 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2334 hookDOMListeners (target, isTop); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2335 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2336 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2337 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2338 * 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
|
2339 * 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
|
2340 */ |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2341 unhookedDOMWindows = unhookedDOMWindows.arrayIndexRemove(index); |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2342 domWindow.Release (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2343 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2344 domWindow.Release (); |
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) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2350 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
|
2351 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
|
2352 ProgressEvent event = new ProgressEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2353 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2354 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2355 event.current = aCurTotalProgress; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2356 event.total = aMaxTotalProgress; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2357 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
|
2358 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
|
2359 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2360 return XPCOM.NS_OK; |
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 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2363 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2364 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
|
2365 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2366 * 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
|
2367 * 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
|
2368 * 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
|
2369 * 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
|
2370 * 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
|
2371 * (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
|
2372 * 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
|
2373 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2374 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
|
2375 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2376 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
|
2377 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2378 //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
|
2379 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2380 nsIDOMWindow domWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2381 //int /*long*/[] aDOMWindow = new int /*long*/[1]; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2382 int rc = aWebProgress.GetDOMWindow (&domWindow); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2383 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2384 if (domWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2385 |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2386 //nsIDOMWindow domWindow = new nsIDOMWindow (aDOMWindow[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2387 //int /*long*/[] aTop = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2388 nsIDOMWindow topWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2389 rc = domWindow.GetTop (&topWindow); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2390 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2391 if (topWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2392 domWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2393 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2394 //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
|
2395 topWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2396 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2397 //nsIURI location = new nsIURI (aLocation); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2398 scope auto aSpec = new nsEmbedCString; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2399 aLocation.GetSpec (cast(nsACString*)aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2400 //int length = XPCOM.nsEmbedCString_Length (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2401 //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2402 //byte[] dest = new byte[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2403 //XPCOM.memmove (dest, buffer, length); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2404 //XPCOM.nsEmbedCString_delete (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2405 String url = aSpec.toString; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2406 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2407 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2408 * 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
|
2409 * 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
|
2410 * 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
|
2411 * 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
|
2412 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2413 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
|
2414 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2415 LocationEvent event = new LocationEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2416 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2417 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2418 event.location = url; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2419 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2420 * 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
|
2421 * (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
|
2422 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2423 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
|
2424 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
|
2425 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
|
2426 locationListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2427 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2428 return XPCOM.NS_OK; |
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 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2431 extern(System) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2432 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
|
2433 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
|
2434 StatusTextEvent event = new StatusTextEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2435 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2436 event.widget = browser; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2437 //int length = XPCOM.strlen_PRUnichar (aMessage); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2438 //char[] dest = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2439 //XPCOM.memmove (dest, aMessage, length * 2); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2440 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
|
2441 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
|
2442 statusTextListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2443 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2444 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2445 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2446 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2447 extern(System) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2448 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
|
2449 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2450 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2451 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2452 /* nsIWebBrowserChrome */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2453 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2454 extern(System) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2455 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
|
2456 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
|
2457 StatusTextEvent event = new StatusTextEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2458 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2459 event.widget = browser; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2460 //int length = XPCOM.strlen_PRUnichar (status); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2461 //char[] dest = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2462 //XPCOM.memmove (dest, status, length * 2); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2463 //String string = new String (dest); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2464 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
|
2465 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
|
2466 statusTextListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2467 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2468 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2469 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2470 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2471 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2472 nsresult GetWebBrowser (nsIWebBrowser* aWebBrowser) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2473 //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
|
2474 if (webBrowser !is null) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2475 webBrowser.AddRef (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2476 *aWebBrowser = webBrowser; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2477 } |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2478 //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
|
2479 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2480 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2481 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2482 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2483 nsresult SetWebBrowser (nsIWebBrowser aWebBrowser) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2484 if (webBrowser !is null) webBrowser.Release (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2485 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
|
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 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2488 |
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 GetChromeFlags (PRUint32* aChromeFlags) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2491 //int[] ret = new int[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2492 *aChromeFlags = chromeFlags; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2493 //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
|
2494 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2495 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2496 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2497 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2498 nsresult SetChromeFlags (PRUint32 aChromeFlags) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2499 chromeFlags = aChromeFlags; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2500 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2501 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2502 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2503 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2504 nsresult DestroyBrowserWindow () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2505 WindowEvent newEvent = new WindowEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2506 newEvent.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2507 newEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2508 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
|
2509 closeWindowListeners[i].close (newEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2510 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2511 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2512 * 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
|
2513 * 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
|
2514 * 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
|
2515 * 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
|
2516 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2517 browser.dispose (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2518 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2519 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2520 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2521 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2522 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
|
2523 size = new Point (aCX, aCY); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2524 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
|
2525 if (isChrome) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2526 Shell shell = browser.getShell (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2527 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
|
2528 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2529 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2530 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2531 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2532 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2533 nsresult ShowAsModal () { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2534 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2535 nsIServiceManager serviceManager; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2536 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2537 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2538 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2539 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2540 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2541 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2542 //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
|
2543 nsIJSContextStack stack; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2544 rc = serviceManager.GetServiceByContractID (XPCOM.NS_CONTEXTSTACK_CONTRACTID.ptr, &nsIJSContextStack.IID, cast(void**)&stack); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2545 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2546 if (stack is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2547 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2548 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2549 //nsIJSContextStack stack = new nsIJSContextStack (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2550 //result[0] = 0; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2551 rc = stack.Push (null); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2552 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2553 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2554 Shell shell = browser.getShell (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2555 Display display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2556 while (!shell.isDisposed ()) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2557 if (!display.readAndDispatch ()) display.sleep (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2558 } |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2559 JSContext* result; |
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2560 rc = stack.Pop (&result); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2561 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2562 stack.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2563 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2564 } |
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 IsWindowModal (PRBool* retval) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2568 *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
|
2569 //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
|
2570 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2571 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2572 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2573 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2574 nsresult ExitModalEventLoop (nsresult aStatus) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2575 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2576 } |
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 /* nsIEmbeddingSiteWindow */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2579 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2580 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2581 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
|
2582 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
|
2583 location = new Point (x, y); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2584 browser.getShell ().setLocation (x, y); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2585 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2586 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
|
2587 browser.setSize (cx, cy); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2588 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2589 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
|
2590 browser.getShell ().setSize (cx, cy); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2591 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2592 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2593 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2594 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2595 extern(System) |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
340
diff
changeset
|
2596 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
|
2597 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
|
2598 Point location = browser.getShell ().getLocation (); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2599 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
|
2600 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
|
2601 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2602 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
|
2603 Point size = browser.getSize (); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2604 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
|
2605 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
|
2606 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2607 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
|
2608 Point size = browser.getShell().getSize (); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2609 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
|
2610 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
|
2611 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2612 return XPCOM.NS_OK; |
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 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2615 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2616 nsresult SetFocus () { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2617 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2618 nsIBaseWindow baseWindow; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2619 int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2620 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2621 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2622 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2623 //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
|
2624 rc = baseWindow.SetFocus (); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2625 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2626 baseWindow.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2627 |
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 * 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
|
2630 * 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
|
2631 * event on Browser focus listeners. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2632 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2633 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2634 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2635 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2636 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2637 nsresult GetVisibility (PRBool* aVisibility) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2638 bool visible = browser.isVisible () && !browser.getShell ().getMinimized (); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2639 *aVisibility = visible ? 1 : 0; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2640 //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
|
2641 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2642 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2643 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2644 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2645 nsresult SetVisibility (PRBool aVisibility) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2646 if (isChild) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2647 WindowEvent event = new WindowEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2648 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2649 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2650 if (aVisibility !is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2651 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2652 * 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
|
2653 * 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
|
2654 * to ignore subsequent notifications. |
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 if (!visible) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2657 visible = true; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2658 event.location = location; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2659 event.size = size; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2660 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
|
2661 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
|
2662 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
|
2663 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
|
2664 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
|
2665 visibilityWindowListeners[i].show (event); |
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 location = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2668 size = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2669 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2670 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2671 visible = false; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2672 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
|
2673 visibilityWindowListeners[i].hide (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2674 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2675 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2676 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2677 visible = aVisibility !is 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2678 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2679 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2680 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2681 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2682 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2683 nsresult GetTitle (PRUnichar** aTitle) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2684 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2685 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2686 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2687 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2688 nsresult SetTitle (PRUnichar* aTitle) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2689 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
|
2690 TitleEvent event = new TitleEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2691 event.display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2692 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2693 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2694 * 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
|
2695 * 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
|
2696 * tag. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2697 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2698 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
|
2699 if (length > 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2700 //char[] dest = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2701 //XPCOM.memmove (dest, aTitle, length * 2); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2702 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
|
2703 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2704 event.title = getUrl (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2705 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2706 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
|
2707 titleListeners[i].changed (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2708 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2709 return XPCOM.NS_OK; |
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 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2712 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2713 nsresult GetSiteWindow (void** aSiteWindow) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2714 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2715 * 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
|
2716 * 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
|
2717 * 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
|
2718 * 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
|
2719 * 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
|
2720 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2721 *aSiteWindow = cast(void*) embedHandle; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2722 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2723 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2724 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2725 /* nsIWebBrowserChromeFocus */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2726 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2727 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2728 nsresult FocusNextElement () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2729 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2730 * 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
|
2731 * 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
|
2732 * 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
|
2733 * 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
|
2734 */ |
340 | 2735 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
|
2736 public void run () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2737 if (browser.isDisposed ()) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2738 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
|
2739 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2740 }); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2741 return XPCOM.NS_OK; |
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 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2744 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2745 nsresult FocusPrevElement () { |
278
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 * 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
|
2748 * 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
|
2749 * 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
|
2750 * 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
|
2751 */ |
340 | 2752 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
|
2753 public void run () { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2754 if (browser.isDisposed ()) return; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2755 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
|
2756 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2757 }); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2758 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2759 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2760 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2761 /* nsIContextMenuListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2762 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2763 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2764 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
|
2765 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
|
2766 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2767 //nsIDOMEvent domEvent = new nsIDOMEvent (aEvent); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2768 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2769 nsIDOMMouseEvent domMouseEvent; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2770 int rc = aEvent.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2771 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2772 if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2773 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2774 //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2775 PRInt32 aScreenX, aScreenY; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2776 rc = domMouseEvent.GetScreenX (&aScreenX); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2777 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2778 rc = domMouseEvent.GetScreenY (&aScreenY); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2779 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2780 domMouseEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2781 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2782 Event event; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2783 event.x = aScreenX; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2784 event.y = aScreenY; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2785 browser.notifyListeners (DWT.MenuDetect, event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2786 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
|
2787 Menu menu = browser.getMenu (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2788 if (menu !is null && !menu.isDisposed ()) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2789 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
|
2790 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
|
2791 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2792 menu.setVisible (true); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2793 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2794 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2795 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2796 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2797 /* nsIURIContentListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2798 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2799 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2800 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
|
2801 if (awaitingNavigate || locationListeners.length is 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2802 *retval = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2803 //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
|
2804 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2805 } |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2806 //nsIURI location = new nsIURI (aURI); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2807 scope auto aSpec = new nsEmbedCString; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2808 aURI.GetSpec (cast(nsACString*)aSpec); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2809 //int length = XPCOM.nsEmbedCString_Length (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2810 //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2811 //buffer = XPCOM.nsEmbedCString_get (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2812 //byte[] dest = new byte[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2813 //XPCOM.memmove (dest, buffer, length); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2814 //XPCOM.nsEmbedCString_delete (aSpec); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2815 String value = aSpec.toString; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2816 bool doit = true; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2817 if (request is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2818 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2819 * 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
|
2820 * 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
|
2821 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2822 if (!value.startsWith (PREFIX_JAVASCRIPT)) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2823 LocationEvent event = new LocationEvent (browser); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2824 event.display = browser.getDisplay(); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2825 event.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2826 event.location = value; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2827 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2828 * 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
|
2829 * (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
|
2830 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2831 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
|
2832 event.doit = doit; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2833 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
|
2834 locationListeners[i].changing (event); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2835 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2836 doit = event.doit && !browser.isDisposed(); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2837 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2838 } |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2839 *retval = doit ? 0 : 1; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2840 //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
|
2841 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2842 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2843 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2844 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2845 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
|
2846 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
|
2847 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2848 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2849 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2850 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
|
2851 bool preferred = false; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2852 auto size = strlen (aContentType); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2853 if (size > 0) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2854 //byte[] typeBytes = new byte[size + 1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2855 //XPCOM.memmove (typeBytes, aContentType, size); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2856 String contentType = fromStringz(aContentType); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2857 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2858 /* 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
|
2859 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
|
2860 /* 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
|
2861 // int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2862 nsIServiceManager serviceManager; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2863 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2864 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2865 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2866 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2867 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2868 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2869 /* 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
|
2870 //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
|
2871 nsIWebNavigationInfo info; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2872 rc = serviceManager.GetServiceByContractID (XPCOM.NS_WEBNAVIGATIONINFO_CONTRACTID.ptr, &nsIWebNavigationInfo.IID, cast(void**)&info); |
352
a3c5f744d03f
Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
John Reimer <terminal.node@gmail.com>
parents:
350
diff
changeset
|
2873 if (rc is XPCOM.NS_OK) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2874 //byte[] bytes = MozillaDelegate.wcsToMbcs (null, contentType, true); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2875 scope auto typePtr = new nsEmbedCString(contentType); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2876 //nsIWebNavigationInfo info = new nsIWebNavigationInfo (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2877 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2878 PRUint32 isSupportedResult; /* PRUint32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2879 rc = info.IsTypeSupported (cast(nsACString*)typePtr, null, &isSupportedResult); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2880 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2881 info.Release (); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2882 //XPCOM.nsEmbedCString_delete (typePtr); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2883 preferred = isSupportedResult !is 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2884 } else { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2885 /* 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
|
2886 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2887 nsICategoryManager categoryManager; |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2888 rc = serviceManager.GetService (&XPCOM.NS_CATEGORYMANAGER_CID, &nsICategoryManager.IID, cast(void**)&categoryManager); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2889 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2890 if (categoryManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2891 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2892 //nsICategoryManager categoryManager = new nsICategoryManager (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2893 //result[0] = 0; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2894 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
|
2895 char* result; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2896 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
|
2897 categoryManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2898 /* 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
|
2899 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
|
2900 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2901 serviceManager.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2902 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2903 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2904 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2905 *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
|
2906 if (preferred) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2907 *aDesiredContentType = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2908 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2909 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2910 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2911 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2912 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2913 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
|
2914 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
|
2915 } |
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 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2918 nsresult GetLoadCookie (nsISupports* aLoadCookie) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2919 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
|
2920 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2921 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2922 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2923 nsresult SetLoadCookie (nsISupports aLoadCookie) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2924 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
|
2925 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2926 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2927 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2928 nsresult GetParentContentListener (nsIURIContentListener* aParentContentListener) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2929 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
|
2930 } |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2931 |
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2932 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2933 nsresult SetParentContentListener (nsIURIContentListener aParentContentListener) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2934 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
|
2935 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2936 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2937 /* nsITooltipListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2938 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2939 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2940 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
|
2941 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
|
2942 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2943 //int length = XPCOM.strlen_PRUnichar (aTipText); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2944 //char[] dest = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2945 //XPCOM.memmove (dest, aTipText, length * 2); |
343
96243e3ebcf0
Mozilla.d compiles successfully :)
John Reimer <terminal.node@gmail.com>
parents:
341
diff
changeset
|
2946 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
|
2947 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
|
2948 Display display = browser.getDisplay (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2949 Shell parent = browser.getShell (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2950 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
|
2951 tip.setLayout (new FillLayout()); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2952 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
|
2953 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
|
2954 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
|
2955 label.setText (text); |
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 * 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
|
2958 * 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
|
2959 * 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
|
2960 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2961 Point point = display.getCursorLocation (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2962 /* 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
|
2963 * the arrow cursor on Windows |
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 point.y += 21; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2966 tip.setLocation (point); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2967 tip.pack (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2968 tip.setVisible (true); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2969 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2970 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2971 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2972 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2973 nsresult OnHideTooltip () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2974 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
|
2975 tip = null; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2976 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2977 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2978 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2979 /* nsIDOMEventListener */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2980 |
348
9a4d7706df52
Test Update to fix linux XPCOM interface issues
John Reimer <terminal.node@gmail.com>
parents:
346
diff
changeset
|
2981 extern(System) |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2982 nsresult HandleEvent (nsIDOMEvent event) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2983 //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
|
2984 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2985 scope auto type = new nsEmbedString; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2986 int rc = event.GetType (cast(nsAString*)type); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2987 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2988 //int length = XPCOM.nsEmbedString_Length (type); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2989 //int /*long*/ buffer = XPCOM.nsEmbedString_get (type); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2990 //char[] chars = new char[length]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2991 //XPCOM.memmove (chars, buffer, length * 2); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2992 String typeString = type.toString; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2993 //XPCOM.nsEmbedString_delete (type); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2994 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2995 if (XPCOM.DOMEVENT_UNLOAD.equals (typeString)) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2996 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2997 nsIDOMEventTarget target; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
2998 rc = event.GetCurrentTarget (&target); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
2999 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3000 if (target is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3001 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3002 //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
|
3003 unhookDOMListeners (target); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3004 target.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3005 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3006 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3007 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3008 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
|
3009 mozDelegate.handleFocus (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3010 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3011 } |
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 if (XPCOM.DOMEVENT_KEYDOWN.equals (typeString)) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3014 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3015 nsIDOMKeyEvent domKeyEvent; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3016 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3017 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3018 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3019 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3020 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3021 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3022 PRUint32 aKeyCode; /* PRUint32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3023 rc = domKeyEvent.GetKeyCode (&aKeyCode); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3024 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3025 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
|
3026 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3027 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3028 * 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
|
3029 * 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
|
3030 * 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
|
3031 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3032 if (keyCode !is lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3033 lastKeyCode = keyCode; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3034 switch (keyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3035 case DWT.SHIFT: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3036 case DWT.CONTROL: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3037 case DWT.ALT: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3038 case DWT.CAPS_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3039 case DWT.NUM_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3040 case DWT.SCROLL_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3041 case DWT.COMMAND: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3042 /* 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
|
3043 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3044 rc = domKeyEvent.GetAltKey (&aAltKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3045 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3046 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3047 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3048 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3049 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3050 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3051 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
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 Event keyEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3054 keyEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3055 keyEvent.type = DWT.KeyDown; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3056 keyEvent.keyCode = keyCode; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3057 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
|
3058 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
|
3059 browser.notifyListeners (keyEvent.type, keyEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3060 if (!keyEvent.doit) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3061 event.PreventDefault (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3062 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3063 break; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3064 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3065 default: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3066 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3067 * 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
|
3068 * 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
|
3069 * 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
|
3070 * 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
|
3071 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3072 PRBool aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3073 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3074 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3075 if (aMetaKey !is 0) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3076 PRBool aCtrlKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3077 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3078 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3079 if (aCtrlKey is 0) { |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3080 PRBool aAltKey, aShiftKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3081 rc = domKeyEvent.GetAltKey (&aAltKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3082 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3083 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3084 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
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 Event keyEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3087 keyEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3088 keyEvent.type = DWT.KeyDown; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3089 keyEvent.keyCode = lastKeyCode; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3090 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
|
3091 browser.notifyListeners (keyEvent.type, keyEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3092 if (!keyEvent.doit) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3093 event.PreventDefault (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3094 } |
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 } |
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 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3100 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3101 domKeyEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3102 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3103 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3104 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3105 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
|
3106 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3107 * 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
|
3108 * 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
|
3109 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3110 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
|
3111 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3112 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3113 * 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
|
3114 * 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
|
3115 * 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
|
3116 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3117 switch (lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3118 case DWT.CAPS_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3119 case DWT.NUM_LOCK: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3120 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
|
3121 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3122 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3123 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3124 nsIDOMKeyEvent domKeyEvent; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3125 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3126 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3127 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3128 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3129 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3130 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3131 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3132 rc = domKeyEvent.GetAltKey (&aAltKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3133 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3134 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3135 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3136 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3137 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3138 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3139 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3140 domKeyEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3141 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3142 PRUint32 aCharCode; /* PRUint32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3143 rc = domKeyEvent.GetCharCode (&aCharCode); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3144 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3145 lastCharCode = aCharCode; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3146 if (lastCharCode is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3147 switch (lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3148 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
|
3149 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
|
3150 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
|
3151 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
|
3152 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
|
3153 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3154 } |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3155 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
|
3156 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
|
3157 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
|
3158 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3159 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3160 Event keyEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3161 keyEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3162 keyEvent.type = DWT.KeyDown; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3163 keyEvent.keyCode = lastKeyCode; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3164 keyEvent.character = cast(wchar)lastCharCode; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3165 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
|
3166 browser.notifyListeners (keyEvent.type, keyEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3167 if (!keyEvent.doit) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3168 event.PreventDefault (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3169 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3170 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3171 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3172 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3173 if (XPCOM.DOMEVENT_KEYUP.equals (typeString)) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3174 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3175 nsIDOMKeyEvent domKeyEvent; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3176 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3177 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3178 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3179 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3180 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3181 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3182 PRUint32 aKeyCode; /* PRUint32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3183 rc = domKeyEvent.GetKeyCode (&aKeyCode); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3184 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3185 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
|
3186 if (keyCode is 0) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3187 /* 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
|
3188 domKeyEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3189 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3190 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3191 if (keyCode !is lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3192 /* 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
|
3193 lastKeyCode = keyCode; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3194 lastCharCode = 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3195 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3196 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3197 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3198 rc = domKeyEvent.GetAltKey (&aAltKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3199 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3200 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3201 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3202 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3203 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3204 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3205 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3206 domKeyEvent.Release (); |
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 Event keyEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3209 keyEvent.widget = browser; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3210 keyEvent.type = DWT.KeyUp; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3211 keyEvent.keyCode = lastKeyCode; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3212 keyEvent.character = cast(wchar)lastCharCode; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3213 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
|
3214 switch (lastKeyCode) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3215 case DWT.SHIFT: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3216 case DWT.CONTROL: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3217 case DWT.ALT: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3218 case DWT.COMMAND: { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3219 keyEvent.stateMask |= lastKeyCode; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3220 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3221 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3222 browser.notifyListeners (keyEvent.type, keyEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3223 if (!keyEvent.doit) { |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3224 event.PreventDefault (); |
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 lastKeyCode = lastCharCode = 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3227 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3228 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3229 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3230 /* mouse event */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3231 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3232 //int /*long*/[] result = new int /*long*/[1]; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3233 nsIDOMMouseEvent domMouseEvent; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3234 rc = event.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3235 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3236 if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3237 //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3238 //result[0] = 0; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3239 |
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 * 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
|
3242 * 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
|
3243 * 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
|
3244 * 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
|
3245 * is within the Browser. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3246 */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3247 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
|
3248 nsIDOMEventTarget eventTarget; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3249 rc = domMouseEvent.GetRelatedTarget (&eventTarget); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3250 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3251 if (eventTarget !is null) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3252 domMouseEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3253 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3254 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3255 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3256 |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3257 PRInt32 aClientX, aClientY, aDetail; /* PRInt32 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3258 rc = domMouseEvent.GetClientX (&aClientX); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3259 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3260 rc = domMouseEvent.GetClientY (&aClientY); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3261 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3262 rc = domMouseEvent.GetDetail (&aDetail); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3263 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3264 PRUint16 aButton; /* PRUint16 */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3265 rc = domMouseEvent.GetButton (&aButton); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3266 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3267 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3268 rc = domMouseEvent.GetAltKey (&aAltKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3269 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3270 rc = domMouseEvent.GetCtrlKey (&aCtrlKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3271 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3272 rc = domMouseEvent.GetShiftKey (&aShiftKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3273 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3274 rc = domMouseEvent.GetMetaKey (&aMetaKey); |
350
373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
John Reimer <terminal.node@gmail.com>
parents:
348
diff
changeset
|
3275 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3276 domMouseEvent.Release (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3277 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3278 Event mouseEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3279 mouseEvent.widget = browser; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3280 mouseEvent.x = aClientX; mouseEvent.y = aClientY; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3281 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
|
3282 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3283 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
|
3284 mozDelegate.handleMouseDown (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3285 mouseEvent.type = DWT.MouseDown; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3286 mouseEvent.button = aButton + 1; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3287 mouseEvent.count = aDetail; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3288 } 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
|
3289 /* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3290 * 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
|
3291 * 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
|
3292 * 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
|
3293 * 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
|
3294 * 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
|
3295 */ |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3296 int button = aButton + 1; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3297 int count = aDetail; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3298 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
|
3299 mouseEvent.type = DWT.MouseUp; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3300 mouseEvent.button = button; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3301 mouseEvent.count = count; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3302 } 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
|
3303 mouseEvent.type = DWT.MouseMove; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3304 } 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
|
3305 mouseEvent.type = DWT.MouseWheel; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3306 mouseEvent.count = -aDetail; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3307 } 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
|
3308 mouseEvent.type = DWT.MouseEnter; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3309 } 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
|
3310 mouseEvent.type = DWT.MouseExit; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3311 } 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
|
3312 mouseEvent.type = DWT.DragDetect; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3313 mouseEvent.button = aButton + 1; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3314 switch (mouseEvent.button) { |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3315 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
|
3316 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
|
3317 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
|
3318 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
|
3319 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
|
3320 } |
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 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3323 browser.notifyListeners (mouseEvent.type, mouseEvent); |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3324 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
|
3325 mouseEvent = new Event (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3326 mouseEvent.widget = browser; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3327 mouseEvent.x = aClientX; mouseEvent.y = aClientY; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3328 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
|
3329 mouseEvent.type = DWT.MouseDoubleClick; |
339
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3330 mouseEvent.button = aButton + 1; |
c317081df76f
Mozilla module complete (first phase complete)
John Reimer <terminal.node@gmail.com>
parents:
337
diff
changeset
|
3331 mouseEvent.count = aDetail; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3332 browser.notifyListeners (mouseEvent.type, mouseEvent); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3333 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3334 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3335 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3336 } |