annotate dwt/browser/Mozilla.d @ 356:8ebacc5c07dc

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