Skip to content

Commit

Permalink
Merge pull request #104 from browserstack/revert-103-AXE-570_a11yEngi…
Browse files Browse the repository at this point in the history
…neErrors

Revert "Fix: AXE-570 Fixed a11yEngineErrors being accessed on undefined"
  • Loading branch information
ansh21 authored Oct 9, 2024
2 parents 1f811bf + 5610917 commit a8b0958
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
5 changes: 1 addition & 4 deletions lib/core/public/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 1 addition & 4 deletions lib/core/public/run-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/core/utils/merge-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a8b0958

Please sign in to comment.