Skip to content

Commit

Permalink
fix(respondable): Avoid message duplication with messageId (#2816)
Browse files Browse the repository at this point in the history
* refactor: rewrite respondable

* fix: use nodejs crypto for uuid.v4

* test(cmd): allow require('crypto')
  • Loading branch information
WilcoFiers authored Mar 1, 2021
1 parent 813ee7e commit 4bd0acf
Show file tree
Hide file tree
Showing 25 changed files with 1,084 additions and 904 deletions.
18 changes: 10 additions & 8 deletions lib/core/public/load.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Audit from '../base/audit';
import cleanup from './cleanup';
import runRules from './run-rules';
import respondable from '../utils/respondable';

function runCommand(data, keepalive, callback) {
var resolve = callback;
Expand Down Expand Up @@ -43,20 +44,21 @@ function runCommand(data, keepalive, callback) {
}
}

if (window.top !== window) {
respondable.subscribe('axe.start', runCommand);
respondable.subscribe('axe.ping', (data, keepalive, respond) => {
respond({
axe: true
});
});
}

/**
* Sets up Rules, Messages and default options for Checks, must be invoked before attempting analysis
* @param {Object} audit The "audit specification" object
* @private
*/
function load(audit) {
axe.utils.respondable.subscribe('axe.ping', (data, keepalive, respond) => {
respond({
axe: true
});
});

axe.utils.respondable.subscribe('axe.start', runCommand);

axe._audit = new Audit(audit);
}

Expand Down
1 change: 1 addition & 0 deletions lib/core/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ export { default as setScrollState } from './set-scroll-state';
export { default as toArray } from './to-array';
export { default as tokenList } from './token-list';
export { default as uniqueArray } from './unique-array';
export { default as uuid } from './uuid';
export { default as validInputTypes } from './valid-input-type';
export { default as isValidLang, validLangs } from './valid-langs';
Loading

0 comments on commit 4bd0acf

Please sign in to comment.