axe-core icon indicating copy to clipboard operation
axe-core copied to clipboard

[axe-extension] Dom error when insert a iframe

Open woody-li opened this issue 1 year ago • 6 comments

Product

axe-core

Product Version

4.8.2

Latest Version

  • [X] I have tested the issue with the latest version of the product

Issue Description

Expectation

No errors.

Actual

Console error:

Uncaught TypeError: Cannot read properties of undefined (reading 'appendChild')

at:

document.getElementsByTagName("head")[0].appendChild(ee)

The element quey result is a empty list, so the index 0 is undefined.

How to Reproduce

  • Open a site, such as https://www.google.com/
  • Execute the script:
var frame = document.createElement('iframe');
frame.setAttribute("sandbox", "");
document.body.append(frame);

Additional context

Chrome: 119.0.6045.160 (Official Build) (64-bit) axe Extension: 4.68.1

woody-li avatar Nov 23 '23 03:11 woody-li

Thanks for the issue. I've let the appropriate team know.

straker avatar Nov 27 '23 17:11 straker

Hi @woody-li.

Thanks for reporting this issue. The error message you are seeing should be benign. It's caused because some code in a 3rd-party dependency assumes there is a <head> element, but there's not one in the iframe you injected to the page. Aside from the error message itself, it shouldn't cause any problems.

Are there any problems you are noticing other than the error message?

thuey avatar Nov 27 '23 18:11 thuey

Yeah, it doesn't metter about any feature. Only error log message.

woody-li avatar Nov 28 '23 04:11 woody-li

@woody-li Thanks for the additional information.

Since it's not causing any issues, is coming from a 3rd-party package, and happens in this edge case, I'm going to go ahead and close this for now.

Thank you again for reporting it, though, and feel free to reach out if it starts causing problems.

thuey avatar Nov 28 '23 16:11 thuey

I don't think it should be closed. Although it's a 3rd-party dependency, shouldn't we report it to the 3rd-party for solution?

Our customer thinks it's a web page bug in accessibility audit.

woody-li avatar Nov 29 '23 01:11 woody-li

@woody-li

After investigating this more, it looks like that 3rd-party dependency shouldn't be included in this scenario you described. I'm re-opening the ticket. We'll work to get it addressed.

thuey avatar Dec 01 '23 14:12 thuey

This issue was fixed in Axe Devtools Extension v4.73.0 release, so I am closing this ticket.

Amandeque avatar Aug 09 '24 17:08 Amandeque