annotate dwt/browser/Mozilla.d @ 361:4bffbf81e2d6

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