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