diff --git a/lib/main.js b/lib/main.js index 64f41f3..0cf169d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -146,8 +146,10 @@ function supersededFixes(service) { // If possible, decied based on the UXP platform, not the application or version // Keep entries in each block in the same order as in evaluateFix's switch statement const superseded = new Set(); - if (service.isPlatform51Up) { + if (service.hasqueueMicrotask) { superseded.add("std-queueMicrotask"); + } + if (service.hasOptionalChainingOperator) { superseded.add("dhl-optchain"); superseded.add("tmx-optchain"); } @@ -550,7 +552,16 @@ class PolyfillService { constructor() { this.isSeaMonkey = Services.appinfo.name == "SeaMonkey"; this.isPaleMoon = Services.appinfo.name == "Pale Moon"; - this.isPlatform51Up = Services.vc.compare(Services.appinfo.platformVersion, "4.8.5") >= 0; + + // Detect available platform features + // - queueMicrotask + this.hasqueueMicrotask = typeof queueMicrotask === "function"; + // - Optional Chaining Operator (?.) + var code = "this?.fourtytwo"; + var valid = true; + try { new Function(code); } catch(exc) { valid = false; } + this.hasOptionalChainingOperator = valid; + this.fixCache = new Map(); this.rules = new RuleEngine(); this.exclusion = new RuleEngine();