Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(respondable): Avoid message duplication with messageId #2816

Merged
merged 3 commits into from
Mar 1, 2021

Conversation

WilcoFiers
Copy link
Contributor

This change is a precursor to us adding custom message listeners to axe-core. Those would allow communication between windows without using window.postMessage, which can interfere with other scripts in a page, especially in environments like browser extensions.

This rewrite patches up a number of gaps as well. It gives every message a unique ID to avoid a message accidentally getting accepted twice. It now does a better job of logging invalid messages, and behavior between subscribers and responders has been made consistent.

This respondable implementation also prevents overriding the subscriber, which is why a lot of tests had to be tweaked.

@WilcoFiers WilcoFiers requested a review from a team as a code owner February 23, 2021 11:07
Comment on lines +48 to +49
respondable.subscribe('axe.start', runCommand);
respondable.subscribe('axe.ping', (data, keepalive, respond) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled these out to avoid registering them each time load is called.

dylanb
dylanb previously approved these changes Feb 23, 2021
@dylanb
Copy link
Contributor

dylanb commented Feb 23, 2021

Approved but please look into the Windows failures and fix before a release

locales/pl.json Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
sri-history.json Outdated Show resolved Hide resolved
test/core/utils/respondable.js Outdated Show resolved Hide resolved
test/core/utils/respondable.js Outdated Show resolved Hide resolved
test/core/utils/respondable.js Show resolved Hide resolved
test/core/utils/respondable.js Outdated Show resolved Hide resolved
test/core/utils/respondable.js Show resolved Hide resolved
test/core/utils/respondable.js Outdated Show resolved Hide resolved
test/core/utils/send-command-to-frame.js Show resolved Hide resolved
straker
straker previously approved these changes Feb 24, 2021
@WilcoFiers WilcoFiers changed the title refactor: rewrite respondable fix(respondable): Avoid message duplication with messageId Feb 24, 2021
dylanb
dylanb previously approved these changes Feb 26, 2021
@WilcoFiers WilcoFiers merged commit 4bd0acf into develop Mar 1, 2021
@WilcoFiers WilcoFiers deleted the respondable-rewrite branch March 1, 2021 15:22
straker pushed a commit that referenced this pull request Mar 2, 2021
* refactor: rewrite respondable

* fix: use nodejs crypto for uuid.v4

* test(cmd): allow require('crypto')
straker added a commit that referenced this pull request Mar 4, 2021
* fix(types): Add noHtml option (#2810)

* Add noHtml to the typescript types

* Update axe.d.ts

Co-authored-by: Stephen Mathieson <me@stephenmathieson.com>

* fix(respondable): Avoid message duplication with messageId (#2816)

* refactor: rewrite respondable

* fix: use nodejs crypto for uuid.v4

* test(cmd): allow require('crypto')

* tests: fix respondable tests

* remove failing tests

* chore(release): 4.1.3

Co-authored-by: Dylan Barrell <dylan@barrell.com>
Co-authored-by: Stephen Mathieson <me@stephenmathieson.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants