Skip to content

Commit 4799bf6

Browse files
committed
test: merge knownGlobals in common
1 parent 92ca0b7 commit 4799bf6

File tree

1 file changed

+13
-90
lines changed

1 file changed

+13
-90
lines changed

test/common/index.js

+13-90
Original file line numberDiff line numberDiff line change
@@ -299,96 +299,19 @@ function platformTimeout(ms) {
299299
}
300300

301301
let knownGlobals = [
302-
AbortController,
303-
atob,
304-
btoa,
305-
clearImmediate,
306-
clearInterval,
307-
clearTimeout,
308-
global,
309-
setImmediate,
310-
setInterval,
311-
setTimeout,
312-
queueMicrotask,
313-
];
314-
315-
if (global.gc) {
316-
knownGlobals.push(global.gc);
317-
}
318-
319-
if (global.navigator) {
320-
knownGlobals.push(global.navigator);
321-
}
322-
323-
if (global.Navigator) {
324-
knownGlobals.push(global.Navigator);
325-
}
326-
327-
if (global.Performance) {
328-
knownGlobals.push(global.Performance);
329-
}
330-
if (global.performance) {
331-
knownGlobals.push(global.performance);
332-
}
333-
if (global.PerformanceMark) {
334-
knownGlobals.push(global.PerformanceMark);
335-
}
336-
if (global.PerformanceMeasure) {
337-
knownGlobals.push(global.PerformanceMeasure);
338-
}
339-
340-
// TODO(@ethan-arrowood): Similar to previous checks, this can be temporary
341-
// until v16.x is EOL. Once all supported versions have structuredClone we
342-
// can add this to the list above instead.
343-
if (global.structuredClone) {
344-
knownGlobals.push(global.structuredClone);
345-
}
346-
347-
if (global.EventSource) {
348-
knownGlobals.push(EventSource);
349-
}
350-
351-
if (global.fetch) {
352-
knownGlobals.push(fetch);
353-
}
354-
if (hasCrypto && global.crypto) {
355-
knownGlobals.push(global.crypto);
356-
knownGlobals.push(global.Crypto);
357-
knownGlobals.push(global.CryptoKey);
358-
knownGlobals.push(global.SubtleCrypto);
359-
}
360-
if (global.CustomEvent) {
361-
knownGlobals.push(global.CustomEvent);
362-
}
363-
if (global.ReadableStream) {
364-
knownGlobals.push(
365-
global.ReadableStream,
366-
global.ReadableStreamDefaultReader,
367-
global.ReadableStreamBYOBReader,
368-
global.ReadableStreamBYOBRequest,
369-
global.ReadableByteStreamController,
370-
global.ReadableStreamDefaultController,
371-
global.TransformStream,
372-
global.TransformStreamDefaultController,
373-
global.WritableStream,
374-
global.WritableStreamDefaultWriter,
375-
global.WritableStreamDefaultController,
376-
global.ByteLengthQueuingStrategy,
377-
global.CountQueuingStrategy,
378-
global.TextEncoderStream,
379-
global.TextDecoderStream,
380-
global.CompressionStream,
381-
global.DecompressionStream,
382-
);
383-
}
384-
385-
if (global.Storage) {
386-
knownGlobals.push(
387-
global.localStorage,
388-
global.sessionStorage,
389-
global.Storage,
390-
);
391-
}
302+
AbortController, atob, btoa, clearImmediate, clearInterval, clearTimeout, global,
303+
setImmediate, setInterval, setTimeout, queueMicrotask, structuredClone, global.gc,
304+
global.navigator, global.Navigator, global.Performance, global.performance,
305+
global.PerformanceMeasure, global.EventSource, global.fetch, global.PerformanceMark,
306+
global.ReadableStream, global.ReadableStreamDefaultReader, global.ReadableStreamBYOBReader,
307+
global.ReadableStreamBYOBRequest, global.ReadableByteStreamController, global.TransformStream,
308+
global.ReadableStreamDefaultController, global.TransformStreamDefaultController,
309+
global.WritableStream, global.WritableStreamDefaultWriter, global.WritableStreamDefaultController,
310+
global.ByteLengthQueuingStrategy, global.CountQueuingStrategy, global.TextEncoderStream,
311+
global.TextDecoderStream, global.CompressionStream, global.DecompressionStream, global.crypto,
312+
global.Crypto, global.CryptoKey, global.SubtleCrypto, global.CustomEvent, global.Storage,
313+
global.localStorage, global.sessionStorage,
314+
].filter((g) => g !== undefined);
392315

393316
function allowGlobals(...allowlist) {
394317
knownGlobals = knownGlobals.concat(allowlist);

0 commit comments

Comments
 (0)