From 5610917a90e66b25e7b2f993bec713d599a333ad Mon Sep 17 00:00:00 2001 From: Anshul Gupta Date: Wed, 9 Oct 2024 13:19:11 +0530 Subject: [PATCH] Revert "Fix: AXE-570 Fixed a11yEngineErrors being accessed on undefined" --- lib/core/public/load.js | 5 +---- lib/core/public/run-rules.js | 5 +---- lib/core/utils/merge-results.js | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/core/public/load.js b/lib/core/public/load.js index 0d7e0caf..e80d3d8f 100644 --- a/lib/core/public/load.js +++ b/lib/core/public/load.js @@ -42,10 +42,7 @@ function runCommand(data, keepalive, callback) { //a11y-engine iframe rules error merging logic const errors = a11yEngine.getErrors(); if (Object.keys(errors).length !== 0) { - if ( - results.length > 0 && - results[results.length - 1]?.a11yEngineErrors - ) { + if (results[results.length - 1].a11yEngineErrors) { const error = results.pop(); delete error.a11yEngineErrors; const mergedErrors = mergeErrors(error, errors); diff --git a/lib/core/public/run-rules.js b/lib/core/public/run-rules.js index 9193d437..8e04c13d 100644 --- a/lib/core/public/run-rules.js +++ b/lib/core/public/run-rules.js @@ -67,10 +67,7 @@ export default function runRules(context, options, resolve, reject) { // after should only run once, so ensure we are in the top level window if (context.initiator) { // Return a11y-engine errors when at top level window - if ( - results.length > 0 && - results[results.length - 1]?.a11yEngineErrors - ) { + if (results[results.length - 1].a11yEngineErrors) { const error = results.pop(); delete error.a11yEngineErrors; a11yEngine.mergeErrors(error); diff --git a/lib/core/utils/merge-results.js b/lib/core/utils/merge-results.js index 79aa935b..0e627713 100644 --- a/lib/core/utils/merge-results.js +++ b/lib/core/utils/merge-results.js @@ -86,7 +86,7 @@ function mergeResults(frameResults, options) { const frameSpec = getFrameSpec(frameResult); // Extract existing errors and merge with new ones - if (results.length > 0 && results[results.length - 1]?.a11yEngineErrors) { + if (results[results.length - 1].a11yEngineErrors) { const error = results.pop(); delete error.a11yEngineErrors; mergedErrors = mergeErrors(mergedErrors, error, frameSpec);