Skip to content

axe-core emits errors instead of frame-tested violations for some types of iframes #3002

@dbjorge

Description

@dbjorge

Product: axe-core

Summary: When axe-core's default frameMessenger hits a postMessage error, it results in an Error leaking from await axe.run(), where it would ideally instead result in the scan completing with a frame-tested violation for the frame in question.

Some specific variants that can trigger the issue:

  • A file:// url that embeds an iframe which axe-core could normally reach will emit an error with message allowedOrigins value "null" is not a valid origin
  • Any page that embeds an iframe which the browser prevents cross-origin access to (eg, a file:// url that embeds an https:// page) will emit a SecurityError with message Blocked a frame with origin "null" from accessing a cross-origin frame.
    • In Chromium, the message is Blocked a frame with origin "null" from accessing a cross-origin frame.
    • In Firefox, the message is Permission denied to access property "DOMException" on cross-origin object

Repro steps:

  1. Download this self-contained repro gist to a local html file
  2. Open it via a file:/// url
  3. Click the two "scan" buttons
  4. Observe the errors displayed in the <textarea>

Expectation: if the scan context includes iframes which the default postMessage implementation cannot communicate with, it should result in scans which complete with frame-tested violations, not errors emitted from await axe.run()

Actual: await axe.run() emits Errors in the two variants from the repro file

Motivation: Caused a regression in one of our sample projects when upgrading from 4.1.x to 4.2.x, see TroyWalshProf/SeleniumAxeDotnet#154 and microsoft/axe-pipelines-samples#552.


axe-core version: 4.2.2
axe-webdriver, extension or other integration version: n/a

Browser and Assistive Technology versions:
* Browser versions: repros under each of the following:
    * Microsoft Edge Version 91.0.864.48 (Official build) (64-bit)
    * Google Chrome Version 91.0.4472.106 (Official Build) (64-bit)
    * Firefox 89.0 (64-bit)
        * **Note: SecurityException variant works manifests slightly differently in Firefox vs Chromium**
* AT versions: n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreIssues in the core code (lib/core)fixBug fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions