Skip to content

XMLHttpRequest for image data should also check for status code 0 #196

Open
@austinkkoehler

Description

@austinkkoehler

Use case: description, code

When retrieving image data, dom-to-image-more checks for a status code of >=300 as a generic catch-all for errors.

The library fails when there is something that returns a status of 0, such as DNS or CORS rejection errors (among a few other things, see the answers here: https://stackoverflow.com/questions/2000609/why-is-ajax-returning-http-status-code-0).

I'm unable to provide a fix myself.

Expected behavior

XMLHttpRequest accounts for 0 as it does >=300: be considered a failure, but allow SVG conversion to continue.

Actual behavior (stack traces, console logs etc)

The request is treated as a success, so readAsDataURL fails because it attempts to operate on a null response. This is viewable through the browser's error logs.

Library version

3.4.5

Browsers

  • Chrome 49+
  • Firefox 45+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions