Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

canvas.toDataURL throwing DOM exception 18 on data src images #12660

Closed
emepyc opened this issue Oct 17, 2014 · 1 comment
Closed

canvas.toDataURL throwing DOM exception 18 on data src images #12660

emepyc opened this issue Oct 17, 2014 · 1 comment
Labels

Comments

@emepyc
Copy link

emepyc commented Oct 17, 2014

The following script:

var page = require('webpage').create();

page.evaluate(function() {
    var svg = '<svg class="tnt_tracks_svg" width="800" height="180" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/\
xlink"><rect width="10" height="10" fill="red"></rect></svg>';

    var src = 'data:image/svg+xml;base64,' + window.btoa(unescape(encodeURIComponent(svg)));

    var img = new Image();
    img.src = src;
    img.onload = function() {
        var canvas = document.createElement('canvas');
        canvas.width = img.width;
        canvas.height = img.height;
        var context = canvas.getContext('2d');
        context.drawImage(img, 0, 0);
        var src = canvas.toDataURL(); // DOM Exception 18!
    }
});

Throws a DOM exception 18. The image src is passed as data, so no cross-domain violation should be triggered. Using '--web-security=false' doesn't solve the problem.
Tested on phantomjs version 1.9.7

@emepyc emepyc changed the title canvas.toDataURL throwing DOM exception 18 on src images canvas.toDataURL throwing DOM exception 18 on data src images Oct 17, 2014
@stale stale bot added the stale label Dec 25, 2019
@stale
Copy link

stale bot commented Dec 28, 2019

Due to our very limited maintenance capacity (see #14541 for more details), we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed. In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant