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

When injected into a page, the axe script can override other anonymous modules loaded via requireJS #849

Closed
noead01 opened this issue Apr 18, 2018 · 2 comments · Fixed by #859
Labels
core Issues in the core code (lib/core) fix Bug fixes

Comments

@noead01
Copy link
Contributor

noead01 commented Apr 18, 2018

I am using AXE.java to inject the axe script into the pages during execution of my selenium automated tests.

The script seems to have a side effect on the application javascript code, and when accessing certain functions of my application, I see:


Error: Mismatched anonymous define() module: function ()
{"use strict”; return axe}

This seems to be linked to the fact that because the script is injected, the required module should not be anonymous. If I change axe.js to name the injected module as per:


  if (typeof define === 'function' && define.amd) {
      define('axe', [], function() {
      'use strict';
      return axe;
    });
  }

Then everything works as expected.


axe-core version: 2.6.1
browser: chrome (all versions)
@WilcoFiers
Copy link
Contributor

This seems to be a problem in lib/core/index.js. Would you like to put in a PR for this?

@WilcoFiers WilcoFiers added fix Bug fixes core Issues in the core code (lib/core) labels Apr 19, 2018
@noead01
Copy link
Contributor Author

noead01 commented Apr 21, 2018

Yes, please

noead01 added a commit to noead01/axe-core that referenced this issue Apr 22, 2018
Avoid the "Mismatched anonymous define() modules" error when the axe script is injected in a page that uses requireJS

Closes dequelabs#849
noead01 added a commit to noead01/axe-core that referenced this issue May 3, 2018
Avoid the "Mismatched anonymous define() modules" error when the axe script is injected in a page that uses requireJS

Closes dequelabs#849
noead01 added a commit to noead01/axe-core that referenced this issue May 3, 2018
Added integration test to check the value of the first argument to define()

Closes dequelabs#849
WilcoFiers pushed a commit that referenced this issue May 19, 2018
* fix(core): Explicitly name the axe module 'axe-core'

Avoid the "Mismatched anonymous define() modules" error when the axe script is injected in a page that uses requireJS

Closes #849

* fix: Prevent color rules from crashing Chrome 66+ #856 (#861)

* chore: Release axe-core 3.0.2

* chore: Enable Greenkeeper for managing dependencies (#847)

* chore: add Greenkeeper config file

* chore(package): update dependencies

* chore(package): update dependencies

* chore(package): update dependencies

* chore(package): update dependencies

* chore(package): update dependencies

* chore(package): update dependencies

* docs(readme): add Greenkeeper badge

* chore: update to use babel-core

* chore: update to latest uglify config properties

`bracketize` became `braces` and `expect` became `reserved`

* chore: add sri-history lifecycle hook to release (#844)

* chore: disable growl to prevent errors in testing

* chore: Rename Jest example to help greenkeeper (#871)

* chore: rename jest example to help greenkeeper

plus signs are invalid in filenames/directories

Closes #869

* chore: add config to jest_react example

Closes #865

* fix(core): Explicitly name the axe module 'axe-core'

Avoid the "Mismatched anonymous define() modules" error when the axe script is injected in a page that uses requireJS

Closes #849

* test(core): Validate that the axe module is named 'axe-core'

Added integration test to check the value of the first argument to define()

Closes #849
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues in the core code (lib/core) fix Bug fixes
Projects
None yet
2 participants