Skip to content

Commit

Permalink
Clean up missing globals code a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
heimskr committed Nov 25, 2024
1 parent 1789364 commit 1baa1b6
Showing 1 changed file with 16 additions and 31 deletions.
47 changes: 16 additions & 31 deletions test/napi/node-napi-tests/test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,38 +356,23 @@ let knownGlobals = [
onerror,
];

if (global.gc) {
knownGlobals.push(global.gc);
}

if (global.navigator) {
knownGlobals.push(global.navigator);
}

if (global.Navigator) {
knownGlobals.push(global.Navigator);
}
const globalKeys = [
"gc",
"navigator",
"Navigator",
"Performance",
"performance",
"PerformanceMark",
"PerformanceMeasure",
"PerformanceResourceTiming",
"PerformanceServerTiming",
"PerformanceTiming",
];

if (global.Performance) {
knownGlobals.push(global.Performance);
}
if (global.performance) {
knownGlobals.push(global.performance);
}
if (global.PerformanceMark) {
knownGlobals.push(global.PerformanceMark);
}
if (global.PerformanceMeasure) {
knownGlobals.push(global.PerformanceMeasure);
}
if (global.PerformanceResourceTiming) {
knownGlobals.push(global.PerformanceResourceTiming);
}
if (global.PerformanceServerTiming) {
knownGlobals.push(global.PerformanceServerTiming);
}
if (global.PerformanceTiming) {
knownGlobals.push(global.PerformanceTiming);
for (const key of globalKeys) {
if (global[key]) {
knownGlobals.push(global[key]);
}
}

// TODO(@ethan-arrowood): Similar to previous checks, this can be temporary
Expand Down

0 comments on commit 1baa1b6

Please sign in to comment.