When <img crossorigin> fails the CORS check, we should fire the error event
https://bugs.webkit.org/show_bug.cgi?id=81998
Reviewed by Nate Chapin.
Source/WebCore:
The spec says we're supposed to fire the error event when the CORS
check fails, but we haven't been. This patch is larger than it might
otherwise be because we're firing the event asynchronously, but that
seems like the right thing to do.
Tests: http/tests/security/img-with-failed-cors-check-fails-to-load.html
* dom/Document.cpp:
(WebCore::Document::implicitClose):
* loader/ImageLoader.cpp:
(WebCore::errorEventSender):
(WebCore):
(WebCore::ImageLoader::ImageLoader):
(WebCore::ImageLoader::~ImageLoader):
(WebCore::ImageLoader::setImage):
(WebCore::ImageLoader::updateFromElement):
(WebCore::ImageLoader::notifyFinished):
(WebCore::ImageLoader::dispatchPendingEvent):
(WebCore::ImageLoader::dispatchPendingErrorEvent):
(WebCore::ImageLoader::dispatchPendingErrorEvents):
* loader/ImageLoader.h:
(ImageLoader):
LayoutTests:
Check that we're firing the error event in this case.
* http/tests/security/img-with-failed-cors-check-fails-to-load-expected.txt:
* http/tests/security/img-with-failed-cors-check-fails-to-load.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
7 files changed