annotate dwt/browser/Mozilla.d @ 341:942da4b6558a

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