test_dom-objects-enumeration-worker.py 7.27 KB
Newer Older
1
from marionette_harness import MarionetteTestCase
2
import testsuite
3

4
class Test(testsuite.TorBrowserTest):
5
6

    def setUp(self):
7
        testsuite.TorBrowserTest.setUp(self)
8

9
10
        self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False)
        self.test_page_file_url = self.marionette.absolute_url("dom-objects-enumeration.html?testType=worker")
11
12

        self.expectedObjects = [
13
14
                "AbortController",
                "AbortSignal",
15
                "addEventListener",
16
17
                "Array",
                "ArrayBuffer",
18
                "atob",
19
20
21
22
                "Atomics",
                "BigInt",
                "BigInt64Array",
                "BigUint64Array",
23
24
25
                "Blob",
                "Boolean",
                "BroadcastChannel",
26
                "btoa",
27
                "ByteLengthQueuingStrategy",
28
                "Cache",
29
                "caches",
30
                "CacheStorage",
31
32
33
                "clearInterval",
                "clearTimeout",
                "close",
34
                "CloseEvent",
35
36
                "console",
                "constructor",
37
                "CountQueuingStrategy",
38
                "createImageBitmap",
39
                "crossOriginIsolated",
40
41
42
                "crypto",
                "Crypto",
                "CustomEvent",
43
44
45
46
47
48
49
                "DataView",
                "Date",
                "decodeURI",
                "decodeURIComponent",
                "DedicatedWorkerGlobalScope",
                "__defineGetter__",
                "__defineSetter__",
50
                "Directory",
51
                "dispatchEvent",
52
                "DOMException",
53
54
55
56
57
58
59
                "DOMMatrix",
                "DOMMatrixReadOnly",
                "DOMPoint",
                "DOMPointReadOnly",
                "DOMQuad",
                "DOMRect",
                "DOMRectReadOnly",
60
61
                "DOMRequest",
                "DOMStringList",
62
63
64
                "dump",
                "encodeURI",
                "encodeURIComponent",
65
                "Error",
66
                "ErrorEvent",
67
68
                "escape",
                "eval",
69
70
                "EvalError",
                "Event",
71
                "EventSource",
72
                "EventTarget",
73
                "fetch",
74
                "File",
75
                "FileList",
76
                "FileReader",
77
78
79
80
81
                "FileReaderSync",
                "Float32Array",
                "Float64Array",
                "FormData",
                "Function",
82
                "globalThis",
83
                "hasOwnProperty",
84
85
86
87
88
89
90
91
92
93
94
95
96
                "Headers",
                "IDBCursor",
                "IDBCursorWithValue",
                "IDBDatabase",
                "IDBFactory",
                "IDBIndex",
                "IDBKeyRange",
                "IDBObjectStore",
                "IDBOpenDBRequest",
                "IDBRequest",
                "IDBTransaction",
                "IDBVersionChangeEvent",
                "ImageBitmap",
97
                "ImageBitmapRenderingContext",
98
                "ImageData",
99
100
                "importScripts",
                "indexedDB",
101
102
103
104
105
106
                "Infinity",
                "Int16Array",
                "Int32Array",
                "Int8Array",
                "InternalError",
                "Intl",
107
108
109
                "isFinite",
                "isNaN",
                "isPrototypeOf",
110
                "isSecureContext",
111
                "JSON",
112
113
114
                "location",
                "__lookupGetter__",
                "__lookupSetter__",
115
116
                "Map",
                "Math",
117
118
                "MediaCapabilities",
                "MediaCapabilitiesInfo",
119
120
121
                "MessageChannel",
                "MessageEvent",
                "MessagePort",
122
                "name",
123
                "NaN",
124
                "navigator",
125
126
127
                "Notification",
                "Number",
                "Object",
128
                "onerror",
129
                "onlanguagechange",
130
                "onmessage",
131
                "onmessageerror",
132
133
                "onoffline",
                "ononline",
134
135
                "onrejectionhandled",
                "onunhandledrejection",
136
                "origin",
137
138
139
                "parseFloat",
                "parseInt",
                "performance",
140
141
142
143
                "Performance",
                "PerformanceEntry",
                "PerformanceMark",
                "PerformanceMeasure",
144
145
146
                "PerformanceObserver",
                "PerformanceObserverEntryList",
                "PerformanceResourceTiming",
147
                "PerformanceServerTiming",
148
                "postMessage",
149
                "ProgressEvent",
150
                "Promise",
151
                "PromiseRejectionEvent",
152
153
                "propertyIsEnumerable",
                "__proto__",
154
                "Proxy",
155
                "queueMicrotask",
156
                "RangeError",
157
                "ReadableStream",
158
159
160
                "ReferenceError",
                "Reflect",
                "RegExp",
161
                "removeEventListener",
162
163
                "Request",
                "Response",
164
                "self",
165
                "Set",
166
167
                "setInterval",
                "setTimeout",
168
                "StorageManager",
169
                "String",
170
                "SubtleCrypto",
171
172
173
174
                "Symbol",
                "SyntaxError",
                "TextDecoder",
                "TextEncoder",
175
176
                "toLocaleString",
                "toString",
177
178
179
180
181
                "TypeError",
                "Uint16Array",
                "Uint32Array",
                "Uint8Array",
                "Uint8ClampedArray",
182
183
184
185
186
187
                "undefined",
                "unescape",
                "URIError",
                "URL",
                "URLSearchParams",
                "valueOf",
188
189
                "WeakMap",
                "WeakSet",
190
                "WebAssembly",
191
192
193
194
195
196
197
198
199
                "WebSocket",
                "Worker",
                "WorkerGlobalScope",
                "WorkerLocation",
                "WorkerNavigator",
                "XMLHttpRequest",
                "XMLHttpRequestEventTarget",
                "XMLHttpRequestUpload",
                ]
200
201
        self.expectedObjects80 = self.expectedObjects + ["AggregateError", "FinalizationRegistry", "WeakRef"]
        self.expectedObjects80.sort()
202
203

    def test_dom_objects_enumeration_workers(self):
204
205
206
207
        expectedObjects = self.expectedObjects
        if self.get_version() >= 80:
            expectedObjects = self.expectedObjects80

208
        with self.marionette.using_context('content'):
209
210
            self.marionette.navigate(self.test_page_file_url)
            self.marionette.timeout.implicit = 5
211
            elt = self.marionette.find_element('id', 'enumeration')
212
            r = elt.text.split("\n")
213
214
            err = False
            unknown_objects = ''
215
            for l in r:
216
                if l in expectedObjects:
217
218
219
220
221
222
                    continue
                err = True
                unknown_objects += l + "\n"

            err_msg = "Unknown objects:\n%s" % unknown_objects
            self.assertFalse(err, msg=err_msg)
223

224
            for l in expectedObjects:
225
226
227
228
229
230
231
                if l in r:
                    continue
                err = True
                unknown_objects += l + "\n"

            err_msg = "Expected objects not found:\n%s" % unknown_objects
            self.assertFalse(err, msg=err_msg)