Bug 599975 - Fire error event for images with empty string src value; r=smaug a=jst

--HG--
extra : rebase_source : 7a28c7b1524de3d059e62fd253b8a6daf614d904
This commit is contained in:
Ms2ger 2011-02-04 14:46:01 -05:00
Родитель 4a882b87b9
Коммит a1428ec198
3 изменённых файлов: 37 добавлений и 1 удалений

Просмотреть файл

@ -641,7 +641,6 @@ nsImageLoadingContent::LoadImage(const nsAString& aNewURI,
doc->GetDocumentURI() &&
NS_SUCCEEDED(doc->GetDocumentURI()->Equals(imageURI, &equal)) &&
equal) {
// Loading an embedded img from the same URI as the document URI will not work
// as a resource cannot recursively embed itself. Attempting to do so generally
// results in having to pre-emptively close down an in-flight HTTP transaction
@ -650,6 +649,7 @@ nsImageLoadingContent::LoadImage(const nsAString& aNewURI,
// In light of that, just skip loading it..
// Do make sure to drop our existing image, if any
CancelImageRequests(aNotify);
FireEvent(NS_LITERAL_STRING("error"));
return NS_OK;
}

Просмотреть файл

@ -236,6 +236,7 @@ _TEST_FILES = \
test_bug607145.html \
test_bug601061.html \
test_bug596511.html \
test_bug599975.html \
reflect.js \
test_bug611189.html \
test_bug613113.html \

Просмотреть файл

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=599975
-->
<head>
<title>Test for Bug 599975</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=599975">Mozilla Bug 599975</a>
<p id="display"></p>
<div id="content" style="display: none">
<img id=image>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 599975 **/
SimpleTest.waitForExplicitFinish();
var img = document.getElementById("image");
img.onerror = function() {
ok(true, "onerror fired");
SimpleTest.finish();
}
img.onload = function() {
ok(false, "onload fired");
SimpleTest.finish();
}
img.src = "";
</script>
</pre>
</body>
</html>