Bug 123978 - CORS enabled data:URL images fail to load
Summary: CORS enabled data:URL images fail to load
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.9
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 109199
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-07 02:19 PST by Stefan Kienzle
Modified: 2014-06-11 08:25 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Kienzle 2013-11-07 02:19:15 PST
Steps to reproduce the problem:
I want to load CORS enabled data:URL images (in JS or HTML) - both cases are failing.
JS:
var img = document.createElement('img');
img.onload = function () {
 ...
};
img.crossOrigin = '';
img.src = <data-url>;

HTML:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAlQTFRFa2tr3Nzc////HKA8dAAAAD9JREFUeNpiYCAAmMCAkQkrTaQ0DkAdaZx2AxmMQAAmYUwmGDmoXU6ZNCPCl5jkoHY5ZU4jyt+D0uV4DQcIMADuxwY6Y1aBvAAAAABJRU5ErkJggg==" crossorigin />

Open this jsfiddle: http://jsfiddle.net/Kienz/Dv3Eu/ 
You should see three w3c images!

What is the expected behavior?
Images should be loaded.

What went wrong?
The images don't load and you got the following error in dev console:
Cross-origin image load denied by Cross-Origin Resource Sharing policy.

In Safari 5.1 (Windows 7) it works. Safari 7 (Mac OS 10.9) it fails.
Comment 1 youenn fablet 2014-06-11 06:33:50 PDT
The case of crossorigin="anonymous" should be handled once data url processing is handled within WebCore (see bug 109199).