annotate dwt/browser/Mozilla.d @ 354:59b54fea05d0

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