Closed
Bug 783789
Opened 13 years ago
Closed 13 years ago
document.domain causes canvas to become dirty when using images on same host/subdomain/domain
Categories
(Core :: General, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 567511
People
(Reporter: wojjie, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.79 Safari/537.1
Steps to reproduce:
Due to some workarounds implemented in the past the website I am currently working on defines document.domain. Due to this, it causes canvases to be deemed as dirty when drawing images that are origin clean.
Actual results:
If you have document.domain specified anywhere in your page flow it will cause all canvases to be "orgin-clean=false" when using "drawImage" using any image as a source, even ones that are provided with a relative path (ie: <img src="/images/logo.png" />). Due to this, calling "toDataURL" causes "SecurityError: The operation is insecure." to be thrown.
Even doing something like "document.domain=document.domain;" causes this problem!
This bug exists in 14.0.1 and newest 15 beta.
Expected results:
Calls "toDataURL" should work as the canvas should be "origin-clean=true". This is only an issue in Firefox, has been tested in IE, Chrome, Safari, and Opera.
| Reporter | ||
Comment 1•13 years ago
|
||
<html>
<img id="useImg" src="/image.png" />
<script type="text/javascript">
document.domain=document.domain;
function testDirty(){
function createCanvas(){
var c=document.createElement('canvas')
c.width=200;
c.height=200;
return c;
}
var c=createCanvas(),x=c.getContext('2d'),d=[c],i=document.getElementById('useImg');;
x.drawImage(i,15,15);
console.log(d[0].toDataURL('image/jpeg',85).length);
};
setTimeout(testDirty,1000);
</script>
</html>
Comment 2•13 years ago
|
||
This is probably the same as bug 567511.
| Reporter | ||
Comment 3•13 years ago
|
||
(In reply to Josh Matthews [:jdm] from comment #2)
> This is probably the same as bug 567511.
It looks like it, I am shocked it's been known since 2010 and still not fixed!
| Reporter | ||
Updated•13 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Comment 5•13 years ago
|
||
> It looks like it, I am shocked it's been known since 2010 and still not fixed!
Revamping of fundamental security architecture (which is what needs to happen to fix it) is not something that's done lightly. :(
Updated•12 years ago
|
Summary: document.domain causes cavas to become dirty when using images on same host/subdomain/domain → document.domain causes canvas to become dirty when using images on same host/subdomain/domain
You need to log in
before you can comment on or make changes to this bug.
Description
•