-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
types.d.ts
177 lines (151 loc) · 4.92 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import type { XULBrowserWindow } from "components/XULBrowserWindow.sys.mjs";
import "./mozbuild";
import "./third_party/dothq/gecko-types";
import * as Gecko from "./third_party/dothq/gecko-types/lib";
import type { DotBrowserWindow } from "components/DotBrowserWindow.sys.mjs";
type MozXULElement = {
prototype: Gecko.MozXULElement;
new (): Gecko.MozXULElement;
} & Gecko.MozElementMixinStatic;
type MozHTMLElement = {
prototype: Gecko.MozHTMLElement;
new (): Gecko.MozHTMLElement;
} & Gecko.MozElementMixinStatic;
declare global {
/* Only available in secure contexts */
interface Screen {
availTop: number;
availLeft: number;
}
var BrowserUIUtils: Gecko.BrowserUIUtils;
var PathUtils: Gecko.PathUtils;
var IOUtils: Gecko.IOUtils;
var gDot: BrowserApplication;
var gDotInit: typeof gDotInit;
var XULBrowserWindow: XULBrowserWindow;
var browserDOMWindow: DotBrowserWindow;
var XULElement: Gecko.XULElement;
var XULFrameElement: Gecko.XULElement;
var XULMenuElement: Gecko.XULElement;
var XULPopupElement: Gecko.XULPopupElement;
var XULResizerElement: Gecko.XULElement;
var XULTextElement: Gecko.XULElement;
var XULTreeElement: Gecko.XULElement;
var MozXULElement: MozXULElement;
var MozHTMLElement: MozHTMLElement;
var MozElements: Gecko.MozElements;
var BrowsingContext: Gecko.BrowsingContextGlobal;
var WebExtensionPolicy: Gecko.WebExtensionPolicy;
var Localization: Gecko.Localization;
/**
* browser-compat is used as a compatibility layer to translate Dot APIs to the original FF/Gecko APIs
*
* When building Dot Browser, we eventually need to use existing code built by Mozilla, and we don't really
* want to move code into the Dot tree that could easily be changed upstream.
*
* For this reason, it's easier for us to create a compatibility layer between our APIs and the Mozilla APIs,
* to avoid breaking these important scripts.
*
* @deprecated You shouldn't use this in Dot code directly! This is purely intended for use by existing Mozilla modules and scripts to maintain compatibility.
*/
var gBrowser: typeof gBrowser;
interface Window {
html: (
tagName: string,
attributes?: { [key: string]: string | boolean | number },
...children: Array<HTMLElement | string>
) => HTMLElement;
arguments: any;
CSS: typeof CSS;
openDialog: (
url?: string,
target?: string,
features?: string,
...extraArguments: any[]
) => Window;
MozXULElement: MozXULElement;
MozHTMLElement: MozHTMLElement;
gDot: BrowserApplication;
minimize(): void;
maximize(): void;
restore(): void;
fullScreen: boolean;
STATE_MAXIMIZED: 1;
STATE_MINIMIZED: 2;
STATE_NORMAL: 3;
STATE_FULLSCREEN: 4;
windowState: number;
gDotInit: typeof gDotInit;
mozInnerScreenX: number;
mozInnerScreenY: number;
windowRoot: Gecko.WindowRoot;
browsingContext: Gecko.BrowsingContext;
promiseDocumentFlushed: (callback: Function) => Promise<any>
XULBrowserWindow: XULBrowserWindow;
browserDOMWindow: DotBrowserWindow;
}
interface Document {
l10n: Gecko.LocalizationInstance;
commandDispatcher: Gecko.nsIDOMXULCommandDispatcher;
}
interface Event {
defaultCancelled: boolean;
defaultPreventedByChrome: boolean;
composedTarget: EventTarget;
}
interface Console {
createInstance: (options: {
// An optional function to intercept all strings written to stdout.
dump?: (message: string) => void;
// An optional prefix string to be printed before the actual logged message.
prefix?: string;
// An ID representing the source of the message. Normally the inner ID of a
// DOM window.
innerID?: string;
// String identified for the console, this will be passed through the console
// notifications.
consoleID?: string;
// Identifier that allows to filter which messages are logged based on their
// log level.
maxLogLevel?:
| "All"
| "Debug"
| "Log"
| "Info"
| "Clear"
| "Trace"
| "TimeLog"
| "TimeEnd"
| "Time"
| "Group"
| "GroupEnd"
| "Profile"
| "ProfileEnd"
| "Dir"
| "Dirxml"
| "Warn"
| "Error"
| "Off";
// String pref name which contains the level to use for maxLogLevel. If the
// pref doesn't exist, gets removed or it is used in workers, the maxLogLevel
// will default to the value passed to this constructor (or "all" if it wasn't
// specified).
maxLogLevelPref?: string;
}) => Console;
}
interface CustomElementRegistry {
getName(constructor: CustomElementConstructor): string | undefined;
}
interface Element {
scrollTopMin: number;
scrollTopMax: number;
scrollLeftMin: number;
scrollLeftMax: number;
}
interface Node {
nodePrincipal: any /** @todo: nsIPrincipal */;
}
}