Skip to content

Commit

Permalink
Merge pull request #2861 from dequelabs/release-4.1.4
Browse files Browse the repository at this point in the history
chore(release): 4.1.4
  • Loading branch information
straker authored Apr 2, 2021
2 parents ca8c2c7 + 3081252 commit e44aecf
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [4.1.4](https://github.com/dequelabs/axe-core/compare/v4.1.3...v4.1.4) (2021-04-01)

### Bug Fixes

- **respondable:** work on iframes in shadow DOM ([#2857](https://github.com/dequelabs/axe-core/issues/2857)) ([65cbfd0](https://github.com/dequelabs/axe-core/commit/65cbfd04edbbf48ceee2ef35f500575a4ad88afc))
- **utils:** fix warning thrown by Webpack ([#2843](https://github.com/dequelabs/axe-core/issues/2843)) ([df5d01b](https://github.com/dequelabs/axe-core/commit/df5d01b94fef43e6ca8d2fab5219f90811700405)), closes [#2840](https://github.com/dequelabs/axe-core/issues/2840)

### [4.1.3](https://github.com/dequelabs/axe-core/compare/v4.1.2...v4.1.3) (2021-03-04)

t/8a699ecba6c77f6a705d44616f1bcefd634ff89b))
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axe-core",
"version": "4.1.3",
"version": "4.1.4",
"contributors": [
{
"name": "David Sturley",
Expand Down
8 changes: 4 additions & 4 deletions lib/core/utils/respondable/assert-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export function assertIsParentWindow(win) {

export function assertIsFrameWindow(win) {
assetNotGlobalWindow(win);
const frames = Array.from(window.frames);
if (!frames.some(frame => frame === win)) {
throw new Error('Respondable target must be a frame in the current window');
}
assert(
win.parent === window,
'Respondable target must be a frame in the current window'
);
}

export function assetNotGlobalWindow(win) {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/utils/uuid.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (!_rng && _crypto && _crypto.getRandomValues) {
}

try {
if (!_rng && require) {
if (!_rng) {
const nodeCrypto = require('crypto');
_rng = () => nodeCrypto.randomBytes(16);
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "axe-core",
"description": "Accessibility engine for automated Web UI testing",
"version": "4.1.3",
"version": "4.1.4",
"license": "MPL-2.0",
"engines": {
"node": ">=4"
Expand Down
4 changes: 4 additions & 0 deletions sri-history.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,9 @@
"4.1.3": {
"axe.js": "sha256-T1FukaTlhjibBqAm8SBwYmo8GLAHdn45r52XRllMdv8=",
"axe.min.js": "sha256-2Z3/OrInIQjAzZ5kMvTBZ2CDUiAgUG/2J5ca1XpNfYw="
},
"4.1.4": {
"axe.js": "sha256-MURsYMNnII8EGBcbmd0FGY36x9dICBq6IDOz+hnaJns=",
"axe.min.js": "sha256-dYHtyLO/5lpm5JgQFWzcf3DFg4BvMTf9MDfZG7nxMEM="
}
}
48 changes: 47 additions & 1 deletion test/core/utils/respondable.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('axe.utils.respondable', function() {
var postMessage = window.postMessage;
var captureError = axe.testUtils.captureError;
var isIE11 = axe.testUtils.isIE11;
var shadowSupported = axe.testUtils.shadowSupport.v1;
this.timeout(1000);

beforeEach(function(done) {
Expand Down Expand Up @@ -152,6 +153,37 @@ describe('axe.utils.respondable', function() {
);
});

(shadowSupported ? it : xit)('works with frames in shadow DOM', function(
done
) {
fixture.innerHTML = '<div id="shadow-root"></div>';
var shadowRoot = fixture
.querySelector('#shadow-root')
.attachShadow({ mode: 'open' });
frame = document.createElement('iframe');
frame.src = '../mock/frames/test.html';

frame.addEventListener('load', function() {
var called = false;
frameWin = frame.contentWindow;
frameSubscribe = frameWin.axe.utils.respondable.subscribe;

frameSubscribe('greeting', function(msg) {
assert.equal(msg, 'hello');
called = true;
});
respondable(frameWin, 'greeting', 'hello');
afterMessage(
frameWin,
captureError(function() {
assert.isTrue(called);
done();
}, done)
);
});
shadowRoot.appendChild(frame);
});

it('is not called on a different topic', function(done) {
var called = false;
frameSubscribe('otherTopic', function() {
Expand Down Expand Up @@ -227,6 +259,17 @@ describe('axe.utils.respondable', function() {
respondable(frameWin, 'greeting', new Error('expected message'));
});

(isIE11 ? it.skip : it)(
// In IE win.parent is read-only
'throws if frame.parent is not the window',
function() {
frameWin.parent = frameWin;
assert.throws(function() {
respondable(frameWin, 'greeting');
});
}
);

(isIE11 ? it.skip : it)(
// In IE win.parent is read-only
'is not called when the source is not a frame in the page',
Expand All @@ -240,8 +283,10 @@ describe('axe.utils.respondable', function() {
frameSubscribe('greeting', function() {
doneOnce(new Error('subscribe should not be called'));
});
frameWin.parent = frameWin;
respondable(frameWin, 'greeting');
// Swap parent after the message is sent, but before it is received:
frameWin.parent = frameWin;

setTimeout(
captureError(function() {
assert.isTrue(called);
Expand Down Expand Up @@ -269,6 +314,7 @@ describe('axe.utils.respondable', function() {
if (!blankPage) {
return;
}

// Cleanup
setTimeout(function() {
blankPage.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<div id="target"></div>

<div id="mocha"></div>
<script src="/test/testutils.js"></script>
<script src="configure-options.js"></script>
<script src="/test/integration/adapter.js"></script>
</body>
Expand Down
8 changes: 4 additions & 4 deletions test/integration/full/configure-options/configure-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ describe('Configure Options', function() {
iframe.src = '/test/mock/frames/context.html';
iframe.onload = function() {
axe.configure(config);
iframe.contentWindow.axe.configure(config);
iframe.contentWindow.axe.configure({ noHtml: true });

axe.run(
'#target',
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('Configure Options', function() {
iframe.src = '/test/mock/frames/noHtml-config.html';
iframe.onload = function() {
axe.configure(config);
iframe.contentWindow.axe.configure(config);
iframe.contentWindow.axe.configure({ noHtml: true });

axe.run('#target', {
runOnly: {
Expand All @@ -260,9 +260,9 @@ describe('Configure Options', function() {

window.addEventListener('message', function(e) {
var data = JSON.parse(e.data);
if (Array.isArray(data.message)) {
if (Array.isArray(data.payload)) {
try {
assert.isNull(data.message[0].nodes[0].node.source);
assert.isNull(data.payload[0].nodes[0].node.source);
done();
} catch (e) {
done(e);
Expand Down
2 changes: 1 addition & 1 deletion test/version.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// This is temporary as the tests still need to use this file
axe.version = '4.1.3';
axe.version = '4.1.4';

0 comments on commit e44aecf

Please sign in to comment.